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
|
loom_version=1.10-SNAPSHOT
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.0.5
|
mod_version=1.0.6
|
||||||
maven_group=konhaiii.powered_jetpacks
|
maven_group=konhaiii.powered_jetpacks
|
||||||
archives_base_name=powered_jetpacks
|
archives_base_name=powered_jetpacks
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package konhaiii.powered_jetpacks.models;
|
package konhaiii.powered_jetpacks.models;
|
||||||
|
|
||||||
|
import konhaiii.powered_jetpacks.PoweredJetpacks;
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.entity.model.EntityModel;
|
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;
|
private final ModelPart mainRight;
|
||||||
|
|
||||||
public JetpackModel() {
|
public JetpackModel() {
|
||||||
// Middle part
|
ModelPart middleTemp;
|
||||||
Map<Direction, UV> middleUVs = Map.of(
|
ModelPart bottomLeftTemp;
|
||||||
Direction.NORTH, new UV(8, 2, 16, 16),
|
ModelPart bottomRightTemp;
|
||||||
Direction.EAST, new UV(6, 2, 16, 16),
|
ModelPart mainLeftTemp;
|
||||||
Direction.SOUTH, new UV(4, 2, 16, 16),
|
ModelPart mainRightTemp;
|
||||||
Direction.WEST, new UV(10, 2, 16, 16),
|
Map<Direction, UV> middleUVs;
|
||||||
Direction.UP, new UV(4, 4, 16, 16),
|
Map<Direction, UV> bottomLeftUVs;
|
||||||
Direction.DOWN, new UV(6, 6, 16, 16)
|
Map<Direction, UV> bottomRightUVs;
|
||||||
);
|
Map<Direction, UV> mainLeftUVs;
|
||||||
this.middle = createCuboid(7, 2, 7, 2, 8, 2, middleUVs);
|
Map<Direction, UV> mainRightUVs;
|
||||||
|
if (PoweredJetpacks.isSodiumLoaded) {
|
||||||
// Bottom left part
|
// Middle part
|
||||||
Map<Direction, UV> bottomLeftUVs = Map.of(
|
middleUVs = Map.of(
|
||||||
Direction.NORTH, new UV(4, 0, 16, 16),
|
Direction.NORTH, new UV(8, 2),
|
||||||
Direction.EAST, new UV(2, 0, 16, 16),
|
Direction.EAST, new UV(10, 2),
|
||||||
Direction.SOUTH, new UV(0, 0, 16, 16),
|
Direction.SOUTH, new UV(4, 2),
|
||||||
Direction.WEST, new UV(6, 0, 16, 16),
|
Direction.WEST, new UV(6, 2),
|
||||||
Direction.UP, new UV(2, 0, 16, 16),
|
Direction.UP, new UV(4, 4),
|
||||||
Direction.DOWN, new UV(4, 0, 16, 16)
|
Direction.DOWN, new UV(6, 6)
|
||||||
);
|
);
|
||||||
this.bottomLeft = createCuboid(4, 0, 7, 2, 1, 2, bottomLeftUVs);
|
// Bottom left part
|
||||||
|
bottomLeftUVs = Map.of(
|
||||||
// Bottom right part
|
Direction.NORTH, new UV(4, 0),
|
||||||
Map<Direction, UV> bottomRightUVs = Map.of(
|
Direction.EAST, new UV(6, 0),
|
||||||
Direction.NORTH, new UV(4, 0, 16, 16),
|
Direction.SOUTH, new UV(0, 0),
|
||||||
Direction.EAST, new UV(2, 0, 16, 16),
|
Direction.WEST, new UV(6, 0),
|
||||||
Direction.SOUTH, new UV(0, 0, 16, 16),
|
Direction.UP, new UV(2, 0),
|
||||||
Direction.WEST, new UV(6, 0, 16, 16),
|
Direction.DOWN, new UV(4, 0)
|
||||||
Direction.UP, new UV(2, 0, 16, 16),
|
);
|
||||||
Direction.DOWN, new UV(4, 0, 16, 16)
|
// Bottom right part
|
||||||
);
|
bottomRightUVs = Map.of(
|
||||||
this.bottomRight = createCuboid(10, 0, 7, 2, 1, 2, bottomRightUVs);
|
Direction.NORTH, new UV(4, 0),
|
||||||
|
Direction.EAST, new UV(6, 0),
|
||||||
// Main left part
|
Direction.SOUTH, new UV(0, 0),
|
||||||
Map<Direction, UV> mainLeftUVs = Map.of(
|
Direction.WEST, new UV(6, 0),
|
||||||
Direction.NORTH, new UV(8, 0, 16, 16),
|
Direction.UP, new UV(2, 0),
|
||||||
Direction.EAST, new UV(4, 0, 16, 16),
|
Direction.DOWN, new UV(4, 0)
|
||||||
Direction.SOUTH, new UV(0, 0, 16, 16),
|
);
|
||||||
Direction.WEST, new UV(12, 0, 16, 16),
|
// Main left part
|
||||||
Direction.UP, new UV(4, 0, 16, 16),
|
mainLeftUVs = Map.of(
|
||||||
Direction.DOWN, new UV(4, 0, 16, 16)
|
Direction.NORTH, new UV(8, 0),
|
||||||
);
|
Direction.EAST, new UV(-4, 0),
|
||||||
this.mainLeft = createCuboid(3, 1, 6, 4, 10, 4, mainLeftUVs);
|
Direction.SOUTH, new UV(0, 0),
|
||||||
|
Direction.WEST, new UV(4, 0),
|
||||||
// Main right part
|
Direction.UP, new UV(4, 0),
|
||||||
Map<Direction, UV> mainRightUVs = Map.of(
|
Direction.DOWN, new UV(4, 0)
|
||||||
Direction.NORTH, new UV(8, 0, 16, 16),
|
);
|
||||||
Direction.EAST, new UV(4, 0, 16, 16),
|
// Main right part
|
||||||
Direction.SOUTH, new UV(0, 0, 16, 16),
|
mainRightUVs = Map.of(
|
||||||
Direction.WEST, new UV(12, 0, 16, 16),
|
Direction.NORTH, new UV(8, 0),
|
||||||
Direction.UP, new UV(4, 0, 16, 16),
|
Direction.EAST, new UV(-4, 0),
|
||||||
Direction.DOWN, new UV(4, 0, 16, 16)
|
Direction.SOUTH, new UV(0, 0),
|
||||||
);
|
Direction.WEST, new UV(4, 0),
|
||||||
this.mainRight = createCuboid(9, 1, 6, 4, 10, 4, mainRightUVs);
|
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<Direction, UV> faceUVs) {
|
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,
|
width, height, depth,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
false,
|
false,
|
||||||
uv.uWidth, uv.vHeight,
|
16, 16,
|
||||||
EnumSet.of(face)
|
EnumSet.of(face)
|
||||||
);
|
);
|
||||||
cuboids.add(cuboid);
|
cuboids.add(cuboid);
|
||||||
|
|
@ -93,7 +153,7 @@ public class JetpackModel<T extends LivingEntity> extends EntityModel<T> {
|
||||||
return new ModelPart(cuboids, Map.of());
|
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
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,15 @@ public class PoweredJetpacks implements ModInitializer {
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||||
public static ModConfig config;
|
public static ModConfig config;
|
||||||
public static boolean isTrinketsLoaded = false;
|
public static boolean isTrinketsLoaded = false;
|
||||||
|
public static boolean isSodiumLoaded = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
if (FabricLoader.getInstance().isModLoaded("trinkets")) {
|
if (FabricLoader.getInstance().isModLoaded("trinkets")) {
|
||||||
isTrinketsLoaded = true;
|
isTrinketsLoaded = true;
|
||||||
PoweredJetpacks.LOGGER.info("TRINKETS LOADED");
|
}
|
||||||
|
if (FabricLoader.getInstance().isModLoaded("sodium")) {
|
||||||
|
isSodiumLoaded = true;
|
||||||
}
|
}
|
||||||
config = ModConfig.loadConfig();
|
config = ModConfig.loadConfig();
|
||||||
ModItems.initialize();
|
ModItems.initialize();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue