From ed8be81fab3d02ff009a47511892490a9110ccdc Mon Sep 17 00:00:00 2001 From: Charm8er Date: Tue, 19 Sep 2023 08:23:44 -0700 Subject: [PATCH] 1.18.2->1.19.2 --- build.gradle | 6 +- gradle.properties | 13 +- .../blocks/entity/SecretBlockEntity.java | 653 +++++++++--------- .../dashloader/DashSecretBlockBakedModel.java | 30 - .../secretblocks/mixin/DirectionAccessor.java | 18 - .../render/SecretBlockBakedModel.java | 18 +- src/main/resources/fabric.mod.json | 4 +- src/main/resources/secretblocks.mixins.json | 2 +- 8 files changed, 352 insertions(+), 392 deletions(-) delete mode 100644 src/main/java/net/calibermc/secretblocks/dashloader/DashSecretBlockBakedModel.java delete mode 100644 src/main/java/net/calibermc/secretblocks/mixin/DirectionAccessor.java diff --git a/build.gradle b/build.gradle index 439c212..02c82b0 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,10 @@ version = project.minecraft_version+ "-" +project.mod_version group = project.maven_group repositories { - maven { url "https://oskarstrom.net/maven" } + maven { + url "https://cursemaven.com" + + } } dependencies { @@ -19,7 +22,6 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation "net.oskarstrom:DashLoader:${project.dashloader_version}" } def includeMod(String dep) { diff --git a/gradle.properties b/gradle.properties index 0529f7b..67f1c80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,13 @@ org.gradle.jvmargs=-Xmx1G #Minecraft Properties - #check these on https://fabricmc.net/versions.html -minecraft_version=1.18.2 -yarn_mappings=1.18.2+build.4 -loader_version=0.14.19 -fabric_version=0.76.0+1.18.2 -dashloader_version=2.0 +#check these on https://fabricmc.net/versions.html +minecraft_version=1.19.2 +yarn_mappings=1.19.2+build.28 +loader_version=0.14.22 +fabric_version=0.76.1+1.19.2 #Mod Properties -mod_version = 1.0.1 +mod_version = 1.2.0 maven_group = net.calibermc archives_base_name = secret-blocks diff --git a/src/main/java/net/calibermc/secretblocks/blocks/entity/SecretBlockEntity.java b/src/main/java/net/calibermc/secretblocks/blocks/entity/SecretBlockEntity.java index e677471..cc2e43b 100644 --- a/src/main/java/net/calibermc/secretblocks/blocks/entity/SecretBlockEntity.java +++ b/src/main/java/net/calibermc/secretblocks/blocks/entity/SecretBlockEntity.java @@ -4,7 +4,6 @@ import net.calibermc.secretblocks.blocks.DoorBlock; import net.calibermc.secretblocks.blocks.TrapdoorBlock; import net.calibermc.secretblocks.mixin.AccessibleBakedQuad; -import net.calibermc.secretblocks.mixin.DirectionAccessor; import net.calibermc.secretblocks.registry.ModEntities; import net.calibermc.secretblocks.screen.SecretChestScreenHandler; import net.calibermc.secretblocks.util.ImplementedInventory; @@ -34,7 +33,6 @@ import net.minecraft.screen.ScreenHandler; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -43,7 +41,6 @@ import java.util.List; import java.util.Locale; -import java.util.Random; import java.util.function.Supplier; public class SecretBlockEntity extends BlockEntity implements NamedScreenHandlerFactory, ImplementedInventory, BlockEntityTicker { @@ -101,9 +98,9 @@ public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, Pla @Override public Text getDisplayName() { - return new TranslatableText(getCachedState().getBlock().getTranslationKey()); + // for 1.19+ - //return Text.translatable(getCachedState().getBlock().getTranslationKey()); + return Text.translatable(getCachedState().getBlock().getTranslationKey()); } @Override @@ -226,24 +223,24 @@ public void deserialize(NbtCompound tag) { public void setState(Direction dir, BlockState newState) { switch (dir) { - case UP: - this.upState = newState; - break; - case DOWN: - this.downState = newState; - break; - case NORTH: - this.northState = newState; - break; - case EAST: - this.eastState = newState; - break; - case SOUTH: - this.southState = newState; - break; - case WEST: - this.westState = newState; - break; + case UP: + this.upState = newState; + break; + case DOWN: + this.downState = newState; + break; + case NORTH: + this.northState = newState; + break; + case EAST: + this.eastState = newState; + break; + case SOUTH: + this.southState = newState; + break; + case WEST: + this.westState = newState; + break; } update(); } @@ -262,24 +259,24 @@ public void setState(BlockState newState) { public void setDirection(Direction dir, Direction newDir) { switch (dir) { - case UP: - this.upDirection = newDir; - break; - case DOWN: - this.downDirection = newDir; - break; - case NORTH: - this.northDirection = newDir; - break; - case EAST: - this.eastDirection = newDir; - break; - case SOUTH: - this.southDirection = newDir; - break; - case WEST: - this.westDirection = newDir; - break; + case UP: + this.upDirection = newDir; + break; + case DOWN: + this.downDirection = newDir; + break; + case NORTH: + this.northDirection = newDir; + break; + case EAST: + this.eastDirection = newDir; + break; + case SOUTH: + this.southDirection = newDir; + break; + case WEST: + this.westDirection = newDir; + break; } update(); } @@ -299,24 +296,24 @@ public BlockState getState(Direction dir) { BlockState tempState; switch (dir) { case DOWN: - tempState = downState; - break; - case NORTH: - tempState = northState; - break; - case EAST: - tempState = eastState; - break; - case SOUTH: - tempState = southState; - break; - case WEST: - tempState = westState; - break; + tempState = downState; + break; + case NORTH: + tempState = northState; + break; + case EAST: + tempState = eastState; + break; + case SOUTH: + tempState = southState; + break; + case WEST: + tempState = westState; + break; case UP: default: - tempState = upState; - break; + tempState = upState; + break; } return tempState; } @@ -325,36 +322,36 @@ public static BlockState getState(Direction dir, NbtCompound tag) { BlockState tempState = Blocks.STONE.getDefaultState(); switch (dir) { case DOWN: - if (tag.contains("downState")) { - tempState = NbtHelper.toBlockState(tag.getCompound("downState")); - } - break; - case NORTH: - if (tag.contains("northState")) { - tempState = NbtHelper.toBlockState(tag.getCompound("northState")); - } - break; - case EAST: - if (tag.contains("eastState")) { - tempState = NbtHelper.toBlockState(tag.getCompound("eastState")); - } - break; - case SOUTH: - if (tag.contains("southState")) { - tempState = NbtHelper.toBlockState(tag.getCompound("southState")); - } - break; - case WEST: - if (tag.contains("westState")) { - tempState = NbtHelper.toBlockState(tag.getCompound("westState")); - } - break; + if (tag.contains("downState")) { + tempState = NbtHelper.toBlockState(tag.getCompound("downState")); + } + break; + case NORTH: + if (tag.contains("northState")) { + tempState = NbtHelper.toBlockState(tag.getCompound("northState")); + } + break; + case EAST: + if (tag.contains("eastState")) { + tempState = NbtHelper.toBlockState(tag.getCompound("eastState")); + } + break; + case SOUTH: + if (tag.contains("southState")) { + tempState = NbtHelper.toBlockState(tag.getCompound("southState")); + } + break; + case WEST: + if (tag.contains("westState")) { + tempState = NbtHelper.toBlockState(tag.getCompound("westState")); + } + break; case UP: default: - if (tag.contains("upState")) { - tempState = NbtHelper.toBlockState(tag.getCompound("upState")); - } - break; + if (tag.contains("upState")) { + tempState = NbtHelper.toBlockState(tag.getCompound("upState")); + } + break; } return tempState; } @@ -363,24 +360,24 @@ public Direction getDir(Direction dir) { Direction tempDir; switch (dir) { case DOWN: - tempDir = downDirection; - break; - case NORTH: - tempDir = northDirection; - break; - case EAST: - tempDir = eastDirection; - break; - case SOUTH: - tempDir = southDirection; - break; - case WEST: - tempDir = westDirection; - break; + tempDir = downDirection; + break; + case NORTH: + tempDir = northDirection; + break; + case EAST: + tempDir = eastDirection; + break; + case SOUTH: + tempDir = southDirection; + break; + case WEST: + tempDir = westDirection; + break; case UP: default: - tempDir = upDirection; - break; + tempDir = upDirection; + break; } return tempDir; } @@ -389,24 +386,24 @@ public static Direction getDir(Direction dir, NbtCompound tag) { Direction tempDir; switch (dir) { case DOWN: - tempDir = byName(tag.getString("downDirection")); - break; - case NORTH: - tempDir = byName(tag.getString("northDirection")); - break; - case EAST: - tempDir = byName(tag.getString("eastDirection")); - break; - case SOUTH: - tempDir = byName(tag.getString("southDirection")); - break; - case WEST: - tempDir = byName(tag.getString("westDirection")); - break; + tempDir = byName(tag.getString("downDirection")); + break; + case NORTH: + tempDir = byName(tag.getString("northDirection")); + break; + case EAST: + tempDir = byName(tag.getString("eastDirection")); + break; + case SOUTH: + tempDir = byName(tag.getString("southDirection")); + break; + case WEST: + tempDir = byName(tag.getString("westDirection")); + break; case UP: default: - tempDir = byName(tag.getString("upDirection")); - break; + tempDir = byName(tag.getString("upDirection")); + break; } return tempDir; } @@ -414,24 +411,24 @@ public static Direction getDir(Direction dir, NbtCompound tag) { public void setRotation(Direction dir, int rotation) { switch (dir) { - case UP: - this.upRotation = rotation; - break; - case DOWN: - this.downRotation = rotation; - break; - case NORTH: - this.northRotation = rotation; - break; - case EAST: - this.eastRotation = rotation; - break; - case SOUTH: - this.southRotation = rotation; - break; - case WEST: - this.westRotation = rotation; - break; + case UP: + this.upRotation = rotation; + break; + case DOWN: + this.downRotation = rotation; + break; + case NORTH: + this.northRotation = rotation; + break; + case EAST: + this.eastRotation = rotation; + break; + case SOUTH: + this.southRotation = rotation; + break; + case WEST: + this.westRotation = rotation; + break; } update(); } @@ -450,27 +447,27 @@ public void setRotation(int rotation) { public int getRotation(Direction dir) { int tempInt; switch (dir) { - case UP: - tempInt = upRotation; - break; - case DOWN: - tempInt = downRotation; - break; - case NORTH: - tempInt = northRotation; - break; - case EAST: - tempInt = eastRotation; - break; - case SOUTH: - tempInt = southRotation; - break; - case WEST: - tempInt = westRotation; - break; - default: - tempInt = upRotation; - break; + case UP: + tempInt = upRotation; + break; + case DOWN: + tempInt = downRotation; + break; + case NORTH: + tempInt = northRotation; + break; + case EAST: + tempInt = eastRotation; + break; + case SOUTH: + tempInt = southRotation; + break; + case WEST: + tempInt = westRotation; + break; + default: + tempInt = upRotation; + break; } return tempInt; } @@ -488,30 +485,30 @@ public static int getRotation(Direction dir, NbtCompound tag) { int tempInt; switch (dir) { case DOWN: - tempInt = tag.getInt("downRotation"); - break; - case NORTH: - tempInt = tag.getInt("northRotation"); - break; - case EAST: - tempInt = tag.getInt("eastRotation"); - break; - case SOUTH: - tempInt = tag.getInt("southRotation"); - break; - case WEST: - tempInt = tag.getInt("westRotation"); - break; + tempInt = tag.getInt("downRotation"); + break; + case NORTH: + tempInt = tag.getInt("northRotation"); + break; + case EAST: + tempInt = tag.getInt("eastRotation"); + break; + case SOUTH: + tempInt = tag.getInt("southRotation"); + break; + case WEST: + tempInt = tag.getInt("westRotation"); + break; case UP: default: - tempInt = tag.getInt("upRotation"); - break; + tempInt = tag.getInt("upRotation"); + break; } return tempInt; } @Environment(EnvType.CLIENT) - public void renderBlock(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + public void renderBlock(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { QuadEmitter emitter = context.getEmitter(); @@ -540,7 +537,7 @@ public void renderBlock(BlockRenderView blockView, BlockState state, BlockPos po } BakedModel fullModel = MinecraftClient.getInstance().getBlockRenderManager().getModel(tempState); - List abqList = fullModel.getQuads(tempState, tempDirection, randomSupplier.get()); + List abqList = fullModel.getQuads(tempState, tempDirection, randomSupplier.get()); BlockColors colors = MinecraftClient.getInstance().getBlockColors(); int color = 0xFF00_0000 | colors.getColor(tempState, blockView, pos, 0xFF); @@ -576,107 +573,107 @@ public void renderBlock(BlockRenderView blockView, BlockState state, BlockPos po private void renderDoorCuboid(QuadEmitter emitter, Direction faceDirection, Direction cuboidDirection) { switch (cuboidDirection) { - case NORTH: - - if (faceDirection == Direction.NORTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); - } else if (faceDirection == Direction.SOUTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); - } else if (faceDirection == Direction.EAST) { - emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.WEST) { - emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); - } else if (faceDirection == Direction.UP) { - emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.DOWN) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); - } - break; - - case EAST: - - if (faceDirection == Direction.SOUTH) { - emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.NORTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); - } else if (faceDirection == Direction.EAST) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); - } else if (faceDirection == Direction.WEST) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); - } else if (faceDirection == Direction.UP) { - emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.DOWN) { - emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); - } - break; - - case SOUTH: - - if (faceDirection == Direction.SOUTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); - } else if (faceDirection == Direction.NORTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); - } else if (faceDirection == Direction.WEST) { - emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.EAST) { - emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); - } else if (faceDirection == Direction.DOWN) { - emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.UP) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); - } - break; - - case WEST: - - if (faceDirection == Direction.NORTH) { - emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.SOUTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); - } else if (faceDirection == Direction.WEST) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); - } else if (faceDirection == Direction.EAST) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); - } else if (faceDirection == Direction.UP) { - emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); - } else if (faceDirection == Direction.DOWN) { - emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); - } - break; - - case UP: - - if (faceDirection == Direction.SOUTH) { - emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.NORTH) { - emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.WEST) { - emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.EAST) { - emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.UP) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.DOWN) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); - } - break; - - case DOWN: - - if (faceDirection == Direction.SOUTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); - } else if (faceDirection == Direction.NORTH) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); - } else if (faceDirection == Direction.WEST) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); - } else if (faceDirection == Direction.EAST) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); - } else if (faceDirection == Direction.DOWN) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f); - } else if (faceDirection == Direction.UP) { - emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); - } - break; + case NORTH: + + if (faceDirection == Direction.NORTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); + } else if (faceDirection == Direction.SOUTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); + } else if (faceDirection == Direction.EAST) { + emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.WEST) { + emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); + } else if (faceDirection == Direction.UP) { + emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.DOWN) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); + } + break; + + case EAST: + + if (faceDirection == Direction.SOUTH) { + emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.NORTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); + } else if (faceDirection == Direction.EAST) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); + } else if (faceDirection == Direction.WEST) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); + } else if (faceDirection == Direction.UP) { + emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.DOWN) { + emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); + } + break; + + case SOUTH: + + if (faceDirection == Direction.SOUTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); + } else if (faceDirection == Direction.NORTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); + } else if (faceDirection == Direction.WEST) { + emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.EAST) { + emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); + } else if (faceDirection == Direction.DOWN) { + emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.UP) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); + } + break; + + case WEST: + + if (faceDirection == Direction.NORTH) { + emitter.square(faceDirection, 0.8125f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.SOUTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); + } else if (faceDirection == Direction.WEST) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0f); + } else if (faceDirection == Direction.EAST) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); + } else if (faceDirection == Direction.UP) { + emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); + } else if (faceDirection == Direction.DOWN) { + emitter.square(faceDirection, 0.0f, 0.0f, 0.1875f, 1.0f, 0.0f); + } + break; + + case UP: + + if (faceDirection == Direction.SOUTH) { + emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.NORTH) { + emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.WEST) { + emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.EAST) { + emitter.square(faceDirection, 0.0f, 0.8125f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.UP) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.DOWN) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); + } + break; + + case DOWN: + + if (faceDirection == Direction.SOUTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); + } else if (faceDirection == Direction.NORTH) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); + } else if (faceDirection == Direction.WEST) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); + } else if (faceDirection == Direction.EAST) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 0.1875f, 0.0f); + } else if (faceDirection == Direction.DOWN) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f); + } else if (faceDirection == Direction.UP) { + emitter.square(faceDirection, 0.0f, 0.0f, 1.0f, 1.0f, 0.8125f); + } + break; } } @@ -725,65 +722,65 @@ private void rotateAndFlip(QuadEmitter emitter, int rotation, Direction dir) { float v3 = emitter.spriteV(3, 0); switch (rotation) { - case 0: - if (dir.equals(Direction.UP)) { - emitter.sprite(0, 0, u3, v3); - emitter.sprite(1, 0, u2, v2); - emitter.sprite(2, 0, u1, v1); - emitter.sprite(3, 0, u0, v0); - } else { - emitter.sprite(0, 0, u0, v0); - emitter.sprite(1, 0, u1, v1); - emitter.sprite(2, 0, u2, v2); - emitter.sprite(3, 0, u3, v3); - } - break; - case 90: - if (dir.equals(Direction.UP)) { - emitter.sprite(0, 0, u0, v0); - emitter.sprite(1, 0, u3, v3); - emitter.sprite(2, 0, u2, v2); - emitter.sprite(3, 0, u1, v1); - } else { - emitter.sprite(0, 0, u1, v1); - emitter.sprite(1, 0, u2, v2); - emitter.sprite(2, 0, u3, v3); - emitter.sprite(3, 0, u0, v0); - } - break; - case 180: - if (dir.equals(Direction.UP)) { - emitter.sprite(0, 0, u1, v1); - emitter.sprite(1, 0, u0, v0); - emitter.sprite(2, 0, u3, v3); - emitter.sprite(3, 0, u2, v2); - } else { - emitter.sprite(0, 0, u2, v2); - emitter.sprite(1, 0, u3, v3); - emitter.sprite(2, 0, u0, v0); - emitter.sprite(3, 0, u1, v1); - } + case 0: + if (dir.equals(Direction.UP)) { + emitter.sprite(0, 0, u3, v3); + emitter.sprite(1, 0, u2, v2); + emitter.sprite(2, 0, u1, v1); + emitter.sprite(3, 0, u0, v0); + } else { + emitter.sprite(0, 0, u0, v0); + emitter.sprite(1, 0, u1, v1); + emitter.sprite(2, 0, u2, v2); + emitter.sprite(3, 0, u3, v3); + } + break; + case 90: + if (dir.equals(Direction.UP)) { + emitter.sprite(0, 0, u0, v0); + emitter.sprite(1, 0, u3, v3); + emitter.sprite(2, 0, u2, v2); + emitter.sprite(3, 0, u1, v1); + } else { + emitter.sprite(0, 0, u1, v1); + emitter.sprite(1, 0, u2, v2); + emitter.sprite(2, 0, u3, v3); + emitter.sprite(3, 0, u0, v0); + } + break; + case 180: + if (dir.equals(Direction.UP)) { + emitter.sprite(0, 0, u1, v1); + emitter.sprite(1, 0, u0, v0); + emitter.sprite(2, 0, u3, v3); + emitter.sprite(3, 0, u2, v2); + } else { + emitter.sprite(0, 0, u2, v2); + emitter.sprite(1, 0, u3, v3); + emitter.sprite(2, 0, u0, v0); + emitter.sprite(3, 0, u1, v1); + } - break; - case 270: - if (dir.equals(Direction.UP)) { - emitter.sprite(0, 0, u2, v2); - emitter.sprite(1, 0, u1, v1); - emitter.sprite(2, 0, u0, v0); - emitter.sprite(3, 0, u3, v3); - } else { - emitter.sprite(0, 0, u3, v3); - emitter.sprite(1, 0, u0, v0); - emitter.sprite(2, 0, u1, v1); - emitter.sprite(3, 0, u2, v2); - } + break; + case 270: + if (dir.equals(Direction.UP)) { + emitter.sprite(0, 0, u2, v2); + emitter.sprite(1, 0, u1, v1); + emitter.sprite(2, 0, u0, v0); + emitter.sprite(3, 0, u3, v3); + } else { + emitter.sprite(0, 0, u3, v3); + emitter.sprite(1, 0, u0, v0); + emitter.sprite(2, 0, u1, v1); + emitter.sprite(3, 0, u2, v2); + } - break; + break; } } public static Direction byName(String name) { - return name == null ? null : (Direction) DirectionAccessor.NAME_MAP().get(name.toLowerCase(Locale.ROOT)); + return Direction.byName(name.toLowerCase(Locale.ROOT)); } public void update() { diff --git a/src/main/java/net/calibermc/secretblocks/dashloader/DashSecretBlockBakedModel.java b/src/main/java/net/calibermc/secretblocks/dashloader/DashSecretBlockBakedModel.java deleted file mode 100644 index ebc2811..0000000 --- a/src/main/java/net/calibermc/secretblocks/dashloader/DashSecretBlockBakedModel.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.calibermc.secretblocks.dashloader; - -import net.calibermc.secretblocks.render.SecretBlockBakedModel; -import net.minecraft.client.texture.Sprite; -import net.oskarstrom.dashloader.DashRegistry; -import net.oskarstrom.dashloader.api.annotation.DashConstructor; -import net.oskarstrom.dashloader.api.annotation.DashObject; -import net.oskarstrom.dashloader.api.enums.ConstructorMode; -import net.oskarstrom.dashloader.model.DashModel; - -@DashObject(SecretBlockBakedModel.class) -public class DashSecretBlockBakedModel implements DashModel { - - @DashConstructor(ConstructorMode.EMPTY) - public DashSecretBlockBakedModel() { - } - - public SecretBlockBakedModel toUndash(DashRegistry registry) { - return new SecretBlockBakedModel() { - @Override - public Sprite getParticleSprite() { - return null; - } - }; - } - - public int getStage() { - return 0; - } -} diff --git a/src/main/java/net/calibermc/secretblocks/mixin/DirectionAccessor.java b/src/main/java/net/calibermc/secretblocks/mixin/DirectionAccessor.java deleted file mode 100644 index ab1fae8..0000000 --- a/src/main/java/net/calibermc/secretblocks/mixin/DirectionAccessor.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.calibermc.secretblocks.mixin; - -import java.util.Map; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import net.minecraft.util.math.Direction; - -@Mixin(Direction.class) -public interface DirectionAccessor { - - @Accessor("NAME_MAP") - public static Map NAME_MAP() { - throw new AssertionError(); - } - -} diff --git a/src/main/java/net/calibermc/secretblocks/render/SecretBlockBakedModel.java b/src/main/java/net/calibermc/secretblocks/render/SecretBlockBakedModel.java index e9ea496..9d52aa3 100644 --- a/src/main/java/net/calibermc/secretblocks/render/SecretBlockBakedModel.java +++ b/src/main/java/net/calibermc/secretblocks/render/SecretBlockBakedModel.java @@ -22,12 +22,19 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; +import org.jetbrains.annotations.Nullable; public class SecretBlockBakedModel implements FabricBakedModel, BakedModel { + + @Override - public List getQuads(BlockState state, Direction face, Random random) { - return new ArrayList<>(); + public List getQuads(@Nullable BlockState state, @Nullable Direction face, net.minecraft.util.math.random.Random random) { + if(state==null || face == null) { + return null; + }else { + return new ArrayList<>(); + } } @Override @@ -71,7 +78,7 @@ public boolean isVanillaAdapter() { } @Override - public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { BlockEntity entity = blockView.getBlockEntity(pos); if (entity instanceof SecretBlockEntity) { ((SecretBlockEntity) entity).renderBlock(blockView, state, pos, randomSupplier, context); @@ -79,8 +86,11 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos } @Override - public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + + } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ec937c1..81fb076 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,9 +28,9 @@ "secretblocks.mixins.json" ], "depends": { - "fabricloader": ">=0.14.18", + "fabricloader": ">=0.14.21", "fabric": "*", - "minecraft": "1.18.x", + "minecraft": "~1.19", "java": ">=17" }, "suggests": { diff --git a/src/main/resources/secretblocks.mixins.json b/src/main/resources/secretblocks.mixins.json index 3c607f3..5bf990c 100644 --- a/src/main/resources/secretblocks.mixins.json +++ b/src/main/resources/secretblocks.mixins.json @@ -4,7 +4,7 @@ "package": "net.calibermc.secretblocks.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "DirectionAccessor" + ], "client": [ "DrawSideMixin",