diff --git a/gradle.properties b/gradle.properties index c130107..bf23743 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ loader_version=0.16.14 loom_version=1.10-SNAPSHOT # Mod Properties -mod_version=1.0.5 +mod_version=1.0.6 maven_group=konhaiii.powered_jetpacks archives_base_name=powered_jetpacks diff --git a/src/client/java/konhaiii/powered_jetpacks/models/JetpackModel.java b/src/client/java/konhaiii/powered_jetpacks/models/JetpackModel.java index 0ea5c4e..2738f6d 100644 --- a/src/client/java/konhaiii/powered_jetpacks/models/JetpackModel.java +++ b/src/client/java/konhaiii/powered_jetpacks/models/JetpackModel.java @@ -1,5 +1,6 @@ package konhaiii.powered_jetpacks.models; +import konhaiii.powered_jetpacks.PoweredJetpacks; import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.entity.model.EntityModel; @@ -17,60 +18,119 @@ public class JetpackModel extends EntityModel { private final ModelPart mainRight; public JetpackModel() { - // Middle part - Map middleUVs = Map.of( - Direction.NORTH, new UV(8, 2, 16, 16), - Direction.EAST, new UV(6, 2, 16, 16), - Direction.SOUTH, new UV(4, 2, 16, 16), - Direction.WEST, new UV(10, 2, 16, 16), - Direction.UP, new UV(4, 4, 16, 16), - Direction.DOWN, new UV(6, 6, 16, 16) - ); - this.middle = createCuboid(7, 2, 7, 2, 8, 2, middleUVs); - - // Bottom left part - Map bottomLeftUVs = Map.of( - Direction.NORTH, new UV(4, 0, 16, 16), - Direction.EAST, new UV(2, 0, 16, 16), - Direction.SOUTH, new UV(0, 0, 16, 16), - Direction.WEST, new UV(6, 0, 16, 16), - Direction.UP, new UV(2, 0, 16, 16), - Direction.DOWN, new UV(4, 0, 16, 16) - ); - this.bottomLeft = createCuboid(4, 0, 7, 2, 1, 2, bottomLeftUVs); - - // Bottom right part - Map bottomRightUVs = Map.of( - Direction.NORTH, new UV(4, 0, 16, 16), - Direction.EAST, new UV(2, 0, 16, 16), - Direction.SOUTH, new UV(0, 0, 16, 16), - Direction.WEST, new UV(6, 0, 16, 16), - Direction.UP, new UV(2, 0, 16, 16), - Direction.DOWN, new UV(4, 0, 16, 16) - ); - this.bottomRight = createCuboid(10, 0, 7, 2, 1, 2, bottomRightUVs); - - // Main left part - Map mainLeftUVs = Map.of( - Direction.NORTH, new UV(8, 0, 16, 16), - Direction.EAST, new UV(4, 0, 16, 16), - Direction.SOUTH, new UV(0, 0, 16, 16), - Direction.WEST, new UV(12, 0, 16, 16), - Direction.UP, new UV(4, 0, 16, 16), - Direction.DOWN, new UV(4, 0, 16, 16) - ); - this.mainLeft = createCuboid(3, 1, 6, 4, 10, 4, mainLeftUVs); - - // Main right part - Map mainRightUVs = Map.of( - Direction.NORTH, new UV(8, 0, 16, 16), - Direction.EAST, new UV(4, 0, 16, 16), - Direction.SOUTH, new UV(0, 0, 16, 16), - Direction.WEST, new UV(12, 0, 16, 16), - Direction.UP, new UV(4, 0, 16, 16), - Direction.DOWN, new UV(4, 0, 16, 16) - ); - this.mainRight = createCuboid(9, 1, 6, 4, 10, 4, mainRightUVs); + ModelPart middleTemp; + ModelPart bottomLeftTemp; + ModelPart bottomRightTemp; + ModelPart mainLeftTemp; + ModelPart mainRightTemp; + Map middleUVs; + Map bottomLeftUVs; + Map bottomRightUVs; + Map mainLeftUVs; + Map mainRightUVs; + if (PoweredJetpacks.isSodiumLoaded) { + // Middle part + middleUVs = Map.of( + Direction.NORTH, new UV(8, 2), + Direction.EAST, new UV(10, 2), + Direction.SOUTH, new UV(4, 2), + Direction.WEST, new UV(6, 2), + Direction.UP, new UV(4, 4), + Direction.DOWN, new UV(6, 6) + ); + // Bottom left part + bottomLeftUVs = Map.of( + Direction.NORTH, new UV(4, 0), + Direction.EAST, new UV(6, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(6, 0), + Direction.UP, new UV(2, 0), + Direction.DOWN, new UV(4, 0) + ); + // Bottom right part + bottomRightUVs = Map.of( + Direction.NORTH, new UV(4, 0), + Direction.EAST, new UV(6, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(6, 0), + Direction.UP, new UV(2, 0), + Direction.DOWN, new UV(4, 0) + ); + // Main left part + mainLeftUVs = Map.of( + Direction.NORTH, new UV(8, 0), + Direction.EAST, new UV(-4, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(4, 0), + Direction.UP, new UV(4, 0), + Direction.DOWN, new UV(4, 0) + ); + // Main right part + mainRightUVs = Map.of( + Direction.NORTH, new UV(8, 0), + Direction.EAST, new UV(-4, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(4, 0), + Direction.UP, new UV(4, 0), + Direction.DOWN, new UV(4, 0) + ); + } else { + // Middle part + middleUVs = Map.of( + Direction.NORTH, new UV(8, 2), + Direction.EAST, new UV(6, 2), + Direction.SOUTH, new UV(4, 2), + Direction.WEST, new UV(10, 2), + Direction.UP, new UV(4, 4), + Direction.DOWN, new UV(6, 6) + ); + // Bottom left part + bottomLeftUVs = Map.of( + Direction.NORTH, new UV(4, 0), + Direction.EAST, new UV(2, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(6, 0), + Direction.UP, new UV(2, 0), + Direction.DOWN, new UV(4, 0) + ); + // Bottom right part + bottomRightUVs = Map.of( + Direction.NORTH, new UV(4, 0), + Direction.EAST, new UV(2, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(6, 0), + Direction.UP, new UV(2, 0), + Direction.DOWN, new UV(4, 0) + ); + // Main left part + mainLeftUVs = Map.of( + Direction.NORTH, new UV(8, 0), + Direction.EAST, new UV(4, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(12, 0), + Direction.UP, new UV(4, 0), + Direction.DOWN, new UV(4, 0) + ); + // Main right part + mainRightUVs = Map.of( + Direction.NORTH, new UV(8, 0), + Direction.EAST, new UV(4, 0), + Direction.SOUTH, new UV(0, 0), + Direction.WEST, new UV(12, 0), + Direction.UP, new UV(4, 0), + Direction.DOWN, new UV(4, 0) + ); + } + middleTemp = createCuboid(7, 2, 7, 2, 8, 2, middleUVs); + bottomLeftTemp = createCuboid(4, 0, 7, 2, 1, 2, bottomLeftUVs); + bottomRightTemp = createCuboid(10, 0, 7, 2, 1, 2, bottomRightUVs); + mainLeftTemp = createCuboid(3, 1, 6, 4, 10, 4, mainLeftUVs); + mainRightTemp = createCuboid(9, 1, 6, 4, 10, 4, mainRightUVs); + this.bottomRight = bottomRightTemp; + this.bottomLeft = bottomLeftTemp; + this.mainLeft = mainLeftTemp; + this.middle = middleTemp; + this.mainRight = mainRightTemp; } private ModelPart createCuboid(int x, int y, int z, int width, int height, int depth, Map faceUVs) { @@ -84,7 +144,7 @@ public class JetpackModel extends EntityModel { width, height, depth, 0, 0, 0, false, - uv.uWidth, uv.vHeight, + 16, 16, EnumSet.of(face) ); cuboids.add(cuboid); @@ -93,7 +153,7 @@ public class JetpackModel extends EntityModel { return new ModelPart(cuboids, Map.of()); } - public record UV(int u, int v, int uWidth, int vHeight) { + public record UV(int u, int v) { } @Override diff --git a/src/main/java/konhaiii/powered_jetpacks/PoweredJetpacks.java b/src/main/java/konhaiii/powered_jetpacks/PoweredJetpacks.java index c547cf2..82727e6 100644 --- a/src/main/java/konhaiii/powered_jetpacks/PoweredJetpacks.java +++ b/src/main/java/konhaiii/powered_jetpacks/PoweredJetpacks.java @@ -16,12 +16,15 @@ public class PoweredJetpacks implements ModInitializer { public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static ModConfig config; public static boolean isTrinketsLoaded = false; + public static boolean isSodiumLoaded = false; @Override public void onInitialize() { if (FabricLoader.getInstance().isModLoaded("trinkets")) { isTrinketsLoaded = true; - PoweredJetpacks.LOGGER.info("TRINKETS LOADED"); + } + if (FabricLoader.getInstance().isModLoaded("sodium")) { + isSodiumLoaded = true; } config = ModConfig.loadConfig(); ModItems.initialize();