Fix jetpack model when using sodium
This commit is contained in:
parent
a8f7faf11f
commit
c3903552c8
3 changed files with 121 additions and 58 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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<T extends LivingEntity> extends EntityModel<T> {
|
|||
private final ModelPart mainRight;
|
||||
|
||||
public JetpackModel() {
|
||||
ModelPart middleTemp;
|
||||
ModelPart bottomLeftTemp;
|
||||
ModelPart bottomRightTemp;
|
||||
ModelPart mainLeftTemp;
|
||||
ModelPart mainRightTemp;
|
||||
Map<Direction, UV> middleUVs;
|
||||
Map<Direction, UV> bottomLeftUVs;
|
||||
Map<Direction, UV> bottomRightUVs;
|
||||
Map<Direction, UV> mainLeftUVs;
|
||||
Map<Direction, UV> mainRightUVs;
|
||||
if (PoweredJetpacks.isSodiumLoaded) {
|
||||
// Middle part
|
||||
Map<Direction, UV> 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)
|
||||
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)
|
||||
);
|
||||
this.middle = createCuboid(7, 2, 7, 2, 8, 2, middleUVs);
|
||||
|
||||
// Bottom left part
|
||||
Map<Direction, UV> 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)
|
||||
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)
|
||||
);
|
||||
this.bottomLeft = createCuboid(4, 0, 7, 2, 1, 2, bottomLeftUVs);
|
||||
|
||||
// Bottom right part
|
||||
Map<Direction, UV> 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)
|
||||
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)
|
||||
);
|
||||
this.bottomRight = createCuboid(10, 0, 7, 2, 1, 2, bottomRightUVs);
|
||||
|
||||
// Main left part
|
||||
Map<Direction, UV> 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)
|
||||
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)
|
||||
);
|
||||
this.mainLeft = createCuboid(3, 1, 6, 4, 10, 4, mainLeftUVs);
|
||||
|
||||
// Main right part
|
||||
Map<Direction, UV> 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)
|
||||
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)
|
||||
);
|
||||
this.mainRight = createCuboid(9, 1, 6, 4, 10, 4, mainRightUVs);
|
||||
} 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<Direction, UV> faceUVs) {
|
||||
|
|
@ -84,7 +144,7 @@ public class JetpackModel<T extends LivingEntity> extends EntityModel<T> {
|
|||
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<T extends LivingEntity> extends EntityModel<T> {
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue