Skip to content

Commit

Permalink
Update to CC:Tweaked 1.111.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jul 12, 2024
1 parent 710d2e8 commit b42a28e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repositories {
maven { url 'https://maven.nucleoid.xyz' }

maven {
url "https://squiddev.cc/maven/"
url "https://maven.squiddev.cc"
content {
includeGroup("cc.tweaked")
}
Expand All @@ -44,16 +44,16 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "cc.tweaked:cc-tweaked-1.21-fabric:1.111.0"
modImplementation "cc.tweaked:cc-tweaked-1.21-fabric:1.111.1"

modImplementation include('eu.pb4:sgui:1.6.0+1.21')
modImplementation include('eu.pb4:player-data-api:0.6.0+1.21')
modImplementation include('eu.pb4:map-canvas-api:0.4.1+1.21')
modImplementation include('eu.pb4:factorytools:0.3.1+1.21')
modImplementation 'eu.pb4:polymer-core:0.9.2+1.21'
modImplementation 'eu.pb4:polymer-resource-pack:0.9.2+1.21'
modImplementation 'eu.pb4:polymer-autohost:0.9.2+1.21'
modImplementation 'eu.pb4:polymer-virtual-entity:0.9.2+1.21'
modImplementation 'eu.pb4:polymer-core:0.9.4+1.21'
modImplementation 'eu.pb4:polymer-resource-pack:0.9.4+1.21'
modImplementation 'eu.pb4:polymer-autohost:0.9.4+1.21'
modImplementation 'eu.pb4:polymer-virtual-entity:0.9.4+1.21'


modCompileOnly ("nl.theepicblock:PolyMc:5.6.1+1.20.4") {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.1
loader_version=0.15.11

# Mod Properties
mod_version=1.111.0.2+1.21
mod_version=1.111.1.2+1.21
maven_group=eu.pb4.cctpatch
archives_base_name=cc-tweaked-polymer-patch

Expand Down
16 changes: 3 additions & 13 deletions src/main/java/eu/pb4/cctpatch/impl/ComputerCraftPolymerPatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import dan200.computercraft.shared.ModRegistry;
import dan200.computercraft.shared.recipe.TransformShapelessRecipe;
import dan200.computercraft.shared.turtle.TurtleOverlay;
import eu.pb4.cctpatch.impl.config.PatchConfig;
import eu.pb4.cctpatch.impl.poly.font.Fonts;
import eu.pb4.cctpatch.impl.poly.PolymerSetup;
Expand Down Expand Up @@ -40,22 +39,13 @@ public void onInitialize() {
PolymerResourcePackUtils.addModAssets(MOD_ID);
ServerLifecycleEvents.SERVER_STARTING.register((server1 -> {
server = server1;
for (var x : server1.getRecipeManager().values()) {
var res = x.value().getResult(server1.getRegistryManager());
if (res.contains(ModRegistry.DataComponents.OVERLAY.get())) {
TurtleModel.registerOverlay(res.get(ModRegistry.DataComponents.OVERLAY.get()));
}
for (var x : server1.getRegistryManager().get(TurtleOverlay.REGISTRY)) {
TurtleModel.registerOverlay(x.model());
}
}));
ServerLifecycleEvents.SERVER_STOPPED.register((server1 -> server = null));
ServerLifecycleEvents.END_DATA_PACK_RELOAD.register(((a, b, c) -> {
PatchConfig.loadOrCreateConfig();
for (var x : a.getRecipeManager().values()) {
var res = x.value().getResult(a.getRegistryManager());
if (res.contains(ModRegistry.DataComponents.OVERLAY.get())) {
TurtleModel.registerOverlay(res.get(ModRegistry.DataComponents.OVERLAY.get()));
}
}
}));

TurtleModel.registerOverlay(TurtleModel.ELF_OVERLAY_MODEL);
Expand Down
23 changes: 18 additions & 5 deletions src/main/java/eu/pb4/cctpatch/impl/poly/model/TurtleModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class TurtleModel extends BlockModel {
private static final Map<Identifier, ItemStack> OVERLAYS = new HashMap<>();
private final ItemDisplayElement base;
private final ItemDisplayElement overlay;
private final ItemDisplayElement overlay2;
private final ItemDisplayElement leftAttachment;
private final ItemDisplayElement rightAttachment;

Expand All @@ -58,6 +59,7 @@ public class TurtleModel extends BlockModel {
private Vec3d lastPos;
private int color = -1;
private Identifier overlayId;
private Identifier overlayId2;

public static void registerOverlay(Identifier identifier) {
if (!OVERLAYS.containsKey(identifier)) {
Expand All @@ -76,6 +78,10 @@ public TurtleModel(BlockState state, BlockPos pos) {
this.overlay.setTeleportDuration(1);
this.overlay.setModelTransformation(ModelTransformationMode.NONE);
this.overlay.setYaw(this.baseYaw);
this.overlay2 = ItemDisplayElementUtil.createSimple();
this.overlay2.setTeleportDuration(1);
this.overlay2.setModelTransformation(ModelTransformationMode.NONE);
this.overlay2.setYaw(this.baseYaw);
this.leftAttachment = ItemDisplayElementUtil.createSimple();
this.leftAttachment.setInterpolationDuration(1);
this.leftAttachment.setModelTransformation(ModelTransformationMode.NONE);
Expand All @@ -86,6 +92,7 @@ public TurtleModel(BlockState state, BlockPos pos) {
this.rightAttachment.setYaw(this.baseYaw);
this.addElement(this.base);
this.addElement(this.overlay);
this.addElement(this.overlay2);
this.addElement(this.leftAttachment);
this.addElement(this.rightAttachment);
}
Expand All @@ -109,6 +116,7 @@ public void setYaw(float yaw) {
this.baseYaw = yaw;
this.base.setYaw(this.baseYaw);
this.overlay.setYaw(this.baseYaw);
this.overlay2.setYaw(this.baseYaw);
this.leftAttachment.setYaw(this.baseYaw);
this.rightAttachment.setYaw(this.baseYaw);
}
Expand Down Expand Up @@ -164,15 +172,20 @@ public void update(TurtleBrain turtleBrain) {

{
var overlay = turtleBrain.getOverlay();

if (overlay == null && Holiday.getCurrent() == Holiday.CHRISTMAS) {
overlay = ELF_OVERLAY_MODEL;
Identifier overlay2 = null;
if ((overlay == null || overlay.value().showElfOverlay()) && Holiday.getCurrent() == Holiday.CHRISTMAS) {
overlay2 = ELF_OVERLAY_MODEL;
}

if (!Objects.equals(this.overlayId, overlay)) {
this.overlayId = overlay;
if ((this.overlayId != null && overlay == null) || (overlay != null && !overlay.value().model().equals(this.overlayId))) {
this.overlayId = overlay != null ? overlay.value().model() : null;
this.overlay.setItem(OVERLAYS.getOrDefault(this.overlayId, ItemStack.EMPTY));
}

if (!Objects.equals(overlay2, this.overlayId2)) {
this.overlayId2 = overlay2;
this.overlay2.setItem(OVERLAYS.getOrDefault(this.overlayId2, ItemStack.EMPTY));
}
}

this.setUpgrades(turtleBrain, turtleBrain.getUpgrade(TurtleSide.LEFT), turtleBrain.getUpgrade(TurtleSide.RIGHT));
Expand Down

0 comments on commit b42a28e

Please sign in to comment.