diff --git a/gradle.properties b/gradle.properties index ac1f83d..19910ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 loader_version=0.18.3 # Mod Properties -mod_version=26.3.23 +mod_version=26.3.25 maven_group=dev.tggamesyt archives_base_name=szar # Dependencies diff --git a/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java b/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java new file mode 100644 index 0000000..07cb1fd --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/BlueprintBlockEntityRenderer.java @@ -0,0 +1,102 @@ +package dev.tggamesyt.szar.client; + +import dev.tggamesyt.szar.BlueprintBlockEntity; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.BlockRenderManager; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.registry.Registries; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.random.Random; + +public class BlueprintBlockEntityRenderer implements BlockEntityRenderer { + + public BlueprintBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {} + + @Override + public void render(BlueprintBlockEntity entity, float tickDelta, MatrixStack matrices, + VertexConsumerProvider vertexConsumers, int light, int overlay) { + if (!entity.hasStoredBlock()) return; + + String storedId = entity.getStoredBlockId(); + if (storedId == null) return; + + var block = Registries.BLOCK.get(new Identifier(storedId)); + if (block == null) return; + + BlockState storedState = block.getDefaultState(); + if (storedState.getRenderType() == BlockRenderType.INVISIBLE) return; + + // Get the shape/state of the blueprint block itself + BlockState blueprintState = entity.getCachedState(); + + // We want to render the stored block's TEXTURE but on the blueprint block's SHAPE. + // The way to do this: find the model for the blueprint block shape, + // but swap in the stored block's sprite via a custom render layer. + // Simplest approach: render the blueprint block's model with the stored block's + // textures by remapping the sprite. + + BlockRenderManager renderer = MinecraftClient.getInstance().getBlockRenderManager(); + + matrices.push(); + + // Render the blueprint shape using the stored block's texture + // by temporarily using the stored block's model sprites on our shape + renderWithStoredTexture(entity, blueprintState, storedState, matrices, vertexConsumers, light, overlay, renderer); + + matrices.pop(); + } + + private void renderWithStoredTexture(BlueprintBlockEntity entity, BlockState blueprintState, + BlockState storedState, MatrixStack matrices, + VertexConsumerProvider vertexConsumers, int light, int overlay, + BlockRenderManager renderer) { + // Get the first (main) sprite from the stored block's model + var storedModel = renderer.getModel(storedState); + var blueprintModel = renderer.getModel(blueprintState); + + var sprites = storedModel.getParticleSprite(); // main texture of stored block + + // Render blueprint model quads, replacing its texture with stored block's sprite + var random = Random.create(); + random.setSeed(42L); + + var bufferSource = vertexConsumers; + var layer = net.minecraft.client.render.RenderLayers.getBlockLayer(blueprintState); + var consumer = bufferSource.getBuffer(layer); + + for (var direction : new net.minecraft.util.math.Direction[]{ + null, + net.minecraft.util.math.Direction.UP, + net.minecraft.util.math.Direction.DOWN, + net.minecraft.util.math.Direction.NORTH, + net.minecraft.util.math.Direction.SOUTH, + net.minecraft.util.math.Direction.EAST, + net.minecraft.util.math.Direction.WEST + }) { + random.setSeed(42L); + var quads = blueprintModel.getQuads(blueprintState, direction, random); + for (var quad : quads) { + // Emit the quad but with the stored block's sprite UV remapped + emitQuadWithSprite(consumer, matrices, quad, sprites, light, overlay); + } + } + } + + private void emitQuadWithSprite(net.minecraft.client.render.VertexConsumer consumer, + MatrixStack matrices, + net.minecraft.client.render.model.BakedQuad quad, + net.minecraft.client.texture.Sprite sprite, + int light, int overlay) { + // Re-emit the quad geometry but remap UVs to the new sprite + consumer.quad(matrices.peek(), quad, 1f, 1f, 1f, light, overlay); + // Note: this uses the quad's original UVs which point to the blueprint texture. + // For full texture remapping you'd need to manually rewrite vertex data. + // This gives correct shape with blueprint texture as fallback — + // see note below for full UV remapping. + } +} \ No newline at end of file diff --git a/src/client/java/dev/tggamesyt/szar/client/ChessScreen.java b/src/client/java/dev/tggamesyt/szar/client/ChessScreen.java index 5041380..5312ba5 100644 --- a/src/client/java/dev/tggamesyt/szar/client/ChessScreen.java +++ b/src/client/java/dev/tggamesyt/szar/client/ChessScreen.java @@ -21,10 +21,6 @@ import java.util.*; public class ChessScreen extends Screen { - // Board background texture - private static final Identifier BOARD_TEX = - new Identifier("szar", "textures/gui/chess_board.png"); - // Piece textures — one per piece type // Naming: chess_wp.png (white pawn), chess_bn.png (black knight) etc. private static final Map PIECE_TEXTURES = new HashMap<>(); diff --git a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java index 1813c32..c1ee60e 100644 --- a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java +++ b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java @@ -90,6 +90,12 @@ public class SzarClient implements ClientModInitializer { ); @Override public void onInitializeClient() { + BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE, BlueprintBlockEntityRenderer::new); + BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE, BlueprintBlockEntityRenderer::new); + BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE, BlueprintBlockEntityRenderer::new); + BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_TRAPDOOR_BE_TYPE, BlueprintBlockEntityRenderer::new); + BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_WALL_BE_TYPE, BlueprintBlockEntityRenderer::new); + BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_FENCE_BE_TYPE, BlueprintBlockEntityRenderer::new); ClientPlayNetworking.registerGlobalReceiver(Szar.CHESS_OPEN_SCREEN, (client, handler, buf, sender) -> { BlockPos pos = buf.readBlockPos(); ChessBlockEntity.State state = ChessBlockEntity.readStateFromBuf(buf); @@ -312,6 +318,7 @@ public class SzarClient implements ClientModInitializer { }); }); ThirdpersonModelRegisterer.register(new Identifier(MOD_ID, "weed_joint"), new Identifier(MOD_ID, "weed_joint_in_hand")); + ThirdpersonModelRegisterer.register(new Identifier(MOD_ID, "empty_joint"), new Identifier(MOD_ID, "empty_joint_in_hand")); ThirdpersonModelRegisterer.register(new Identifier(MOD_ID, "fasz"), new Identifier(MOD_ID, "fasz_in_hand")); ThirdpersonModelRegisterer.register(new Identifier(MOD_ID, "slot_machine"), new Identifier(MOD_ID, "slot_machine_3d")); ClientTickEvents.END_CLIENT_TICK.register(client -> { diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintBehavior.java b/src/main/java/dev/tggamesyt/szar/BlueprintBehavior.java new file mode 100644 index 0000000..30d2779 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintBehavior.java @@ -0,0 +1,84 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintBehavior { + + /** + * Call from your block's onUse(). + * Right click with a block → stores it, consumes one from stack. + * Right click with empty hand → clears stored block. + */ + public static ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + if (world.isClient) return ActionResult.SUCCESS; + + BlockEntity be = world.getBlockEntity(pos); + if (!(be instanceof BlueprintBlockEntity blueprint)) return ActionResult.PASS; + + ItemStack held = player.getStackInHand(hand); + + if (held.isEmpty()) { + // Clear stored block + blueprint.clearStoredBlock(); + return ActionResult.SUCCESS; + } + + if (held.getItem() instanceof BlockItem blockItem) { + String id = Registries.BLOCK.getId(blockItem.getBlock()).toString(); + blueprint.setStoredBlock(id); + if (!player.isCreative()) held.decrement(1); + return ActionResult.SUCCESS; + } + + return ActionResult.PASS; + } + + /** + * Call from your block's calcBlockBreakingDelta() to apply stored hardness. + */ + public static float calcBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos, float baseHardness) { + BlockEntity be = world.getBlockEntity(pos); + if (!(be instanceof BlueprintBlockEntity blueprint) || !blueprint.hasStoredBlock()) { + return baseHardness; + } + float hardness = blueprint.getStoredHardness(); + if (hardness < 0) return 0f; // unbreakable + return player.getBlockBreakingSpeed(state) / hardness / 30f; + } + + /** + * Call from your block's onBreak() to drop the stored block instead. + */ + public static void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlockEntity be = world.getBlockEntity(pos); + if (!(be instanceof BlueprintBlockEntity blueprint) || !blueprint.hasStoredBlock()) return; + if (!player.isCreative()) { + ItemStack drop = blueprint.getStoredDrop(); + if (!drop.isEmpty()) { + dropStack(world, pos, drop); + } + } + } + + private static void dropStack(World world, BlockPos pos, ItemStack stack) { + net.minecraft.entity.ItemEntity entity = new net.minecraft.entity.ItemEntity( + world, + pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, + stack + ); + world.spawnEntity(entity); + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintBlockEntity.java b/src/main/java/dev/tggamesyt/szar/BlueprintBlockEntity.java new file mode 100644 index 0000000..8b62d29 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintBlockEntity.java @@ -0,0 +1,86 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; +import net.minecraft.registry.Registries; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import org.jetbrains.annotations.Nullable; + +public class BlueprintBlockEntity extends BlockEntity { + + @Nullable + private String storedBlockId = null; + + public BlueprintBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + public boolean hasStoredBlock() { + return storedBlockId != null; + } + + @Nullable + public String getStoredBlockId() { + return storedBlockId; + } + + public void setStoredBlock(String blockId) { + this.storedBlockId = blockId; + markDirty(); + if (world != null && !world.isClient) { + world.updateListeners(pos, getCachedState(), getCachedState(), 3); + } + } + + public void clearStoredBlock() { + this.storedBlockId = null; + markDirty(); + } + + /** Gets the hardness of the stored block, or default if none. */ + public float getStoredHardness() { + if (storedBlockId == null) return 1.0f; + var block = Registries.BLOCK.get(new Identifier(storedBlockId)); + return block.getDefaultState().getHardness(null, null); + } + + /** Gets the blast resistance of the stored block, or default if none. */ + public float getStoredResistance() { + if (storedBlockId == null) return 1.0f; + return Registries.BLOCK.get(new Identifier(storedBlockId)).getBlastResistance(); + } + + /** Returns an ItemStack of the stored block for dropping. */ + public ItemStack getStoredDrop() { + if (storedBlockId == null) return ItemStack.EMPTY; + var block = Registries.BLOCK.get(new Identifier(storedBlockId)); + return new ItemStack(block.asItem()); + } + + @Override + protected void writeNbt(NbtCompound nbt) { + super.writeNbt(nbt); + if (storedBlockId != null) nbt.putString("StoredBlock", storedBlockId); + } + + @Override + public void readNbt(NbtCompound nbt) { + super.readNbt(nbt); + storedBlockId = nbt.contains("StoredBlock") ? nbt.getString("StoredBlock") : null; + } + + @Override + public NbtCompound toInitialChunkDataNbt() { + return createNbt(); + } + + @Override + public BlockEntityUpdateS2CPacket toUpdatePacket() { + return BlockEntityUpdateS2CPacket.create(this); + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java b/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java new file mode 100644 index 0000000..7767245 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintBlocks.java @@ -0,0 +1,106 @@ +package dev.tggamesyt.szar; + +import dev.tggamesyt.szar.Szar; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.MapColor; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; + +public class BlueprintBlocks { + + private static AbstractBlock.Settings settings() { + return AbstractBlock.Settings.create() + .mapColor(MapColor.TERRACOTTA_LIGHT_BLUE) + .strength(1.0f); + } + + public static final BlueprintStairsBlock BLUEPRINT_STAIRS = + Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_stairs"), + new BlueprintStairsBlock(settings())); + + public static final BlueprintSlabBlock BLUEPRINT_SLAB = + Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_slab"), + new BlueprintSlabBlock(settings())); + + public static final BlueprintDoorBlock BLUEPRINT_DOOR = + Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_door"), + new BlueprintDoorBlock(settings())); + + public static final BlueprintTrapDoorBlock BLUEPRINT_TRAPDOOR = + Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_trapdoor"), + new BlueprintTrapDoorBlock(settings())); + + public static final BlueprintWallBlock BLUEPRINT_WALL = + Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_wall"), + new BlueprintWallBlock(settings())); + + public static final BlueprintFenceBlock BLUEPRINT_FENCE = + Registry.register(Registries.BLOCK, new Identifier(Szar.MOD_ID, "blueprint_fence"), + new BlueprintFenceBlock(settings())); + + public static final BlockEntityType BLUEPRINT_STAIRS_BE_TYPE = + Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_stairs_be"), + FabricBlockEntityTypeBuilder.create( + (pos, state) -> new BlueprintBlockEntity(null, pos, state), + BLUEPRINT_STAIRS).build()); + + public static final BlockEntityType BLUEPRINT_SLAB_BE_TYPE = + Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_slab_be"), + FabricBlockEntityTypeBuilder.create( + (pos, state) -> new BlueprintBlockEntity(null, pos, state), + BLUEPRINT_SLAB).build()); + + public static final BlockEntityType BLUEPRINT_DOOR_BE_TYPE = + Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_door_be"), + FabricBlockEntityTypeBuilder.create( + (pos, state) -> new BlueprintBlockEntity(null, pos, state), + BLUEPRINT_DOOR).build()); + + public static final BlockEntityType BLUEPRINT_TRAPDOOR_BE_TYPE = + Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_trapdoor_be"), + FabricBlockEntityTypeBuilder.create( + (pos, state) -> new BlueprintBlockEntity(null, pos, state), + BLUEPRINT_TRAPDOOR).build()); + + public static final BlockEntityType BLUEPRINT_WALL_BE_TYPE = + Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_wall_be"), + FabricBlockEntityTypeBuilder.create( + (pos, state) -> new BlueprintBlockEntity(null, pos, state), + BLUEPRINT_WALL).build()); + + public static final BlockEntityType BLUEPRINT_FENCE_BE_TYPE = + Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(Szar.MOD_ID, "blueprint_fence_be"), + FabricBlockEntityTypeBuilder.create( + (pos, state) -> new BlueprintBlockEntity(null, pos, state), + BLUEPRINT_FENCE).build()); + public static final BlockItem BLUEPRINT_STAIRS_ITEM = Registry.register(Registries.ITEM, + new Identifier(Szar.MOD_ID, "blueprint_stairs"), + new BlockItem(BLUEPRINT_STAIRS, new Item.Settings())); + + public static final BlockItem BLUEPRINT_SLAB_ITEM = Registry.register(Registries.ITEM, + new Identifier(Szar.MOD_ID, "blueprint_slab"), + new BlockItem(BLUEPRINT_SLAB, new Item.Settings())); + + public static final BlockItem BLUEPRINT_DOOR_ITEM = Registry.register(Registries.ITEM, + new Identifier(Szar.MOD_ID, "blueprint_door"), + new BlockItem(BLUEPRINT_DOOR, new Item.Settings())); + + public static final BlockItem BLUEPRINT_TRAPDOOR_ITEM = Registry.register(Registries.ITEM, + new Identifier(Szar.MOD_ID, "blueprint_trapdoor"), + new BlockItem(BLUEPRINT_TRAPDOOR, new Item.Settings())); + + public static final BlockItem BLUEPRINT_WALL_ITEM = Registry.register(Registries.ITEM, + new Identifier(Szar.MOD_ID, "blueprint_wall"), + new BlockItem(BLUEPRINT_WALL, new Item.Settings())); + + public static final BlockItem BLUEPRINT_FENCE_ITEM = Registry.register(Registries.ITEM, + new Identifier(Szar.MOD_ID, "blueprint_fence"), + new BlockItem(BLUEPRINT_FENCE, new Item.Settings())); + public static void init() {} // just call this to trigger class loading +} diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java new file mode 100644 index 0000000..605d898 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintDoorBlock.java @@ -0,0 +1,45 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.enums.Instrument; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintDoorBlock extends DoorBlock implements BlockEntityProvider { + + public BlueprintDoorBlock(Settings settings) { + super(settings, BlockSetType.STONE); // placeholder wood type sound + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE, pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + ActionResult behavior = BlueprintBehavior.onUse(state, world, pos, player, hand, hit); + if (behavior != ActionResult.PASS) return behavior; + return super.onUse(state, world, pos, player, hand, hit); // allow opening/closing + } + + @Override + public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos) { + return BlueprintBehavior.calcBreakingDelta(state, player, world, pos, + super.calcBlockBreakingDelta(state, player, world, pos)); + } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlueprintBehavior.onBreak(world, pos, state, player); + super.onBreak(world, pos, state, player); + } +} diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java new file mode 100644 index 0000000..3e3fdd3 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintFenceBlock.java @@ -0,0 +1,42 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintFenceBlock extends FenceBlock implements BlockEntityProvider { + + public BlueprintFenceBlock(Settings settings) { + super(settings); + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_FENCE_BE_TYPE, pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + return BlueprintBehavior.onUse(state, world, pos, player, hand, hit); + } + + @Override + public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos) { + return BlueprintBehavior.calcBreakingDelta(state, player, world, pos, + super.calcBlockBreakingDelta(state, player, world, pos)); + } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlueprintBehavior.onBreak(world, pos, state, player); + super.onBreak(world, pos, state, player); + } +} diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java new file mode 100644 index 0000000..b52501f --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintSlabBlock.java @@ -0,0 +1,42 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintSlabBlock extends SlabBlock implements BlockEntityProvider { + + public BlueprintSlabBlock(Settings settings) { + super(settings); + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE, pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + return BlueprintBehavior.onUse(state, world, pos, player, hand, hit); + } + + @Override + public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos) { + return BlueprintBehavior.calcBreakingDelta(state, player, world, pos, + super.calcBlockBreakingDelta(state, player, world, pos)); + } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlueprintBehavior.onBreak(world, pos, state, player); + super.onBreak(world, pos, state, player); + } +} diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java new file mode 100644 index 0000000..9cff796 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintStairsBlock.java @@ -0,0 +1,42 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintStairsBlock extends StairsBlock implements BlockEntityProvider { + + public BlueprintStairsBlock(Settings settings) { + super(Blocks.STONE.getDefaultState(), settings); + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE, pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + return BlueprintBehavior.onUse(state, world, pos, player, hand, hit); + } + + @Override + public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos) { + return BlueprintBehavior.calcBreakingDelta(state, player, world, pos, + super.calcBlockBreakingDelta(state, player, world, pos)); + } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlueprintBehavior.onBreak(world, pos, state, player); + super.onBreak(world, pos, state, player); + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java new file mode 100644 index 0000000..0355eb2 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintTrapDoorBlock.java @@ -0,0 +1,44 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintTrapDoorBlock extends TrapdoorBlock implements BlockEntityProvider { + + public BlueprintTrapDoorBlock(Settings settings) { + super(settings, BlockSetType.STONE); + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_TRAPDOOR_BE_TYPE, pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + ActionResult behavior = BlueprintBehavior.onUse(state, world, pos, player, hand, hit); + if (behavior != ActionResult.PASS) return behavior; + return super.onUse(state, world, pos, player, hand, hit); + } + + @Override + public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos) { + return BlueprintBehavior.calcBreakingDelta(state, player, world, pos, + super.calcBlockBreakingDelta(state, player, world, pos)); + } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlueprintBehavior.onBreak(world, pos, state, player); + super.onBreak(world, pos, state, player); + } +} diff --git a/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java b/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java new file mode 100644 index 0000000..4b965dd --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/BlueprintWallBlock.java @@ -0,0 +1,42 @@ +package dev.tggamesyt.szar; + +import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; + +public class BlueprintWallBlock extends WallBlock implements BlockEntityProvider { + + public BlueprintWallBlock(Settings settings) { + super(settings); + } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new BlueprintBlockEntity(BlueprintBlocks.BLUEPRINT_WALL_BE_TYPE, pos, state); + } + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, + PlayerEntity player, Hand hand, BlockHitResult hit) { + return BlueprintBehavior.onUse(state, world, pos, player, hand, hit); + } + + @Override + public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, + BlockView world, BlockPos pos) { + return BlueprintBehavior.calcBreakingDelta(state, player, world, pos, + super.calcBlockBreakingDelta(state, player, world, pos)); + } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + BlueprintBehavior.onBreak(world, pos, state, player); + super.onBreak(world, pos, state, player); + } +} diff --git a/src/main/java/dev/tggamesyt/szar/Joint.java b/src/main/java/dev/tggamesyt/szar/Joint.java index 5643ec3..650fec4 100644 --- a/src/main/java/dev/tggamesyt/szar/Joint.java +++ b/src/main/java/dev/tggamesyt/szar/Joint.java @@ -28,7 +28,7 @@ import static dev.tggamesyt.szar.Szar.MOD_ID; public class Joint extends SpyglassItem { public Joint(Settings settings) { - super(settings.maxDamage(20)); // max durability + super(settings.maxDamage(8)); // max durability } private static final int COOLDOWN_TICKS = 20 * 5; @Override @@ -72,7 +72,24 @@ public class Joint extends SpyglassItem { Szar.PLAYER_ADDICTION_LEVEL.put(user.getUuid(), true); } // Consume 1 durability - stack.damage(1, user, p -> p.sendToolBreakStatus(user.getActiveHand())); + int currentDamage = stack.getDamage(); + int maxDamage = stack.getMaxDamage(); + + if (currentDamage + 1 >= maxDamage) { + // About to break — give empty joint instead + stack.setCount(0); // remove the joint + if (user instanceof PlayerEntity player) { + ItemStack emptyJoint = new ItemStack(Szar.EMPTY_JOINT); + if (!player.getInventory().insertStack(emptyJoint)) { + // Inventory full, drop it at player's feet + player.dropItem(emptyJoint, false); + } + player.sendToolBreakStatus(user.getActiveHand()); + } + } else { + stack.damage(1, user, p -> p.sendToolBreakStatus(user.getActiveHand())); + } + if (user instanceof PlayerEntity player && !world.isClient) { player.getItemCooldownManager().set(this, COOLDOWN_TICKS); } diff --git a/src/main/java/dev/tggamesyt/szar/PlaneEntity.java b/src/main/java/dev/tggamesyt/szar/PlaneEntity.java index d6712bc..ae9a838 100644 --- a/src/main/java/dev/tggamesyt/szar/PlaneEntity.java +++ b/src/main/java/dev/tggamesyt/szar/PlaneEntity.java @@ -288,6 +288,14 @@ public class PlaneEntity extends Entity { @Override public void updatePassengerPosition(Entity passenger, PositionUpdater updater) { passenger.setPosition(getX(), getY() + 0.8, getZ()); + + if (passenger instanceof PlayerEntity player) { + float planeYaw = this.getYaw(); + float relativeYaw = MathHelper.wrapDegrees(player.getYaw() - planeYaw); + float clampedRelative = MathHelper.clamp(relativeYaw, -85f, 85f); + player.setYaw(planeYaw + clampedRelative); + player.setHeadYaw(planeYaw + clampedRelative); + } } private void playServerAnimation(PlaneAnimation anim) { if (this.currentServerAnimation == anim) return; diff --git a/src/main/java/dev/tggamesyt/szar/ServerConfig.java b/src/main/java/dev/tggamesyt/szar/ServerConfig.java new file mode 100644 index 0000000..9a495bf --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/ServerConfig.java @@ -0,0 +1,117 @@ +package dev.tggamesyt.szar; + +import com.google.gson.*; +import net.fabricmc.loader.api.FabricLoader; + +import java.io.*; +import java.nio.file.*; +import java.util.*; + +public class ServerConfig { + + private static final Path CONFIG_PATH = + FabricLoader.getInstance().getConfigDir().resolve("szar/config.json"); + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + + // ── Registry ────────────────────────────────────────────────────────────── + private static final LinkedHashMap VALUES = new LinkedHashMap<>(); + private static final LinkedHashMap DEFAULTS = new LinkedHashMap<>(); + private static final LinkedHashMap> PRESETS = new LinkedHashMap<>(); + private static String activePreset = "minor"; + + // ── Registration (call from ServerSettings.init()) ──────────────────────── + + public static void registerSetting(String id, boolean defaultValue) { + DEFAULTS.put(id, defaultValue); + VALUES.put(id, defaultValue); + } + + public static void registerPreset(String id, Map values) { + PRESETS.put(id, values == null ? null : new LinkedHashMap<>(values)); + } + + // ── Accessors ───────────────────────────────────────────────────────────── + + public static boolean get(String id) { + return VALUES.getOrDefault(id, true); + } + + public static void set(String id, boolean value) { + if (!VALUES.containsKey(id)) throw new IllegalArgumentException("Unknown setting: " + id); + VALUES.put(id, value); + // If this doesn't match any preset anymore, switch to custom + activePreset = detectPreset(); + } + + public static String getActivePreset() { return activePreset; } + + public static Set getSettingIds() { return VALUES.keySet(); } + + public static Map snapshot() { return Collections.unmodifiableMap(VALUES); } + + public static boolean hasPreset(String id) { return PRESETS.containsKey(id); } + + public static Set getPresetIds() { return PRESETS.keySet(); } + + /** Applies a preset by id. Returns false if unknown. */ + public static boolean applyPreset(String presetId) { + Map preset = PRESETS.get(presetId); + if (preset == null && !PRESETS.containsKey(presetId)) return false; // unknown + activePreset = presetId; + if (preset != null) { // null = "custom", don't touch values + preset.forEach((id, val) -> { + if (VALUES.containsKey(id)) VALUES.put(id, val); + }); + } + return true; + } + + private static String detectPreset() { + for (Map.Entry> entry : PRESETS.entrySet()) { + Map pValues = entry.getValue(); + if (pValues == null) continue; // skip custom + if (pValues.equals(VALUES)) return entry.getKey(); + } + return "custom"; + } + + // ── Save / Load ─────────────────────────────────────────────────────────── + + public static void save() { + JsonObject root = loadRawRoot(); + + JsonObject server = new JsonObject(); + server.addProperty("preset", activePreset); + JsonObject vals = new JsonObject(); + VALUES.forEach(vals::addProperty); + server.add("values", vals); + root.add("server", server); + + CONFIG_PATH.getParent().toFile().mkdirs(); + try (Writer w = Files.newBufferedWriter(CONFIG_PATH)) { + GSON.toJson(root, w); + } catch (IOException e) { e.printStackTrace(); } + } + + public static void load() { + JsonObject root = loadRawRoot(); + if (!root.has("server")) { save(); return; } + + JsonObject server = root.getAsJsonObject("server"); + if (server.has("preset")) activePreset = server.get("preset").getAsString(); + if (server.has("values")) { + JsonObject vals = server.getAsJsonObject("values"); + VALUES.forEach((id, def) -> { + if (vals.has(id)) VALUES.put(id, vals.get(id).getAsBoolean()); + }); + } + } + + private static JsonObject loadRawRoot() { + if (!Files.exists(CONFIG_PATH)) return new JsonObject(); + try (Reader r = Files.newBufferedReader(CONFIG_PATH)) { + JsonObject obj = GSON.fromJson(r, JsonObject.class); + return obj != null ? obj : new JsonObject(); + } catch (IOException e) { return new JsonObject(); } + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/ServerSettings.java b/src/main/java/dev/tggamesyt/szar/ServerSettings.java new file mode 100644 index 0000000..bd2011a --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/ServerSettings.java @@ -0,0 +1,31 @@ +package dev.tggamesyt.szar; + +import java.util.Map; + +public class ServerSettings { + + public static void init() { + // registerSetting(id, defaultValue) ← must match client setting ids + ServerConfig.registerSetting("racist", true); + ServerConfig.registerSetting("gambling", true); + ServerConfig.registerSetting("nsfw", true); + + // registerPreset(id, Map) ← null map = "custom" + ServerConfig.registerPreset("18+", Map.of( + "racist", false, + "gambling", false, + "nsfw", false + )); + ServerConfig.registerPreset("17+", Map.of( + "racist", false, + "gambling", false, + "nsfw", true + )); + ServerConfig.registerPreset("minor", Map.of( + "racist", true, + "gambling", true, + "nsfw", true + )); + ServerConfig.registerPreset("custom", null); + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index 1b11db7..4627980 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -1,6 +1,7 @@ package dev.tggamesyt.szar; import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.client.MinecraftClient; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.biome.v1.BiomeModifications; @@ -362,14 +363,15 @@ public class Szar implements ModInitializer { .displayName(Text.translatable("itemgroup.szar_group")) .icon(() -> new ItemStack(Szar.CANNABIS_ITEM)) // icon item .entries((displayContext, entries) -> { + boolean showRacist = !ServerConfig.get("racist"); + boolean showGambling = !ServerConfig.get("gambling"); + boolean showNsfw = !ServerConfig.get("nsfw"); // random ahh silly stuff entries.add(Szar.POPTART); entries.add(Szar.NYAN_SPAWNEGG); entries.add(Szar.BAITER_DISC); entries.add(Szar.MERL_SPAWNEGG); entries.add(Szar.EFN_DISK); - entries.add(Szar.SLOT_MACHINE); - entries.add(Szar.ROULETTE); entries.add(Szar.FIRTANA); entries.add(Szar.HELLO_DISC); entries.add(Szar.TRACKER_BLOCK_ITEM); @@ -383,9 +385,22 @@ public class Szar implements ModInitializer { entries.add(Szar.CAN_OF_BEANS); entries.add(Szar.ALMOND_WATER); entries.add(Szar.KEBAB); + + entries.add(BlueprintBlocks.BLUEPRINT_DOOR_ITEM); + entries.add(BlueprintBlocks.BLUEPRINT_TRAPDOOR_ITEM); + entries.add(BlueprintBlocks.BLUEPRINT_FENCE_ITEM); + entries.add(BlueprintBlocks.BLUEPRINT_SLAB_ITEM); + entries.add(BlueprintBlocks.BLUEPRINT_WALL_ITEM); + entries.add(BlueprintBlocks.BLUEPRINT_STAIRS_ITEM); + entries.add(Szar.TIC_TAC_TOE_ITEM); entries.add(Szar.CONNECT_FOUR_ITEM); entries.add(Szar.CHESS_ITEM); + // gambing + if (showGambling) { + entries.add(Szar.SLOT_MACHINE); + entries.add(Szar.ROULETTE); + } // crazy weponary entries.add(Szar.BULLET_ITEM); entries.add(Szar.AK47); @@ -398,12 +413,17 @@ public class Szar implements ModInitializer { entries.add(Szar.ATOM); entries.add(Szar.WHEEL); entries.add(Szar.PLANE); + // police + entries.add(Szar.POLICE_SPAWNEGG); + entries.add(Szar.KEY_ITEM); + entries.add(Szar.HANDCUFF_ITEM); // drugs entries.add(Szar.BEER); entries.add(Szar.CHEMICAL_WORKBENCH_ITEM); entries.add(Szar.CANNABIS_ITEM); entries.add(Szar.WEED_ITEM); entries.add(Szar.WEED_JOINT_ITEM); + entries.add(Szar.EMPTY_JOINT); // war guys entries.add(Szar.HITTER_SPAWNEGG); entries.add(Szar.NAZI_SPAWNEGG); @@ -412,33 +432,35 @@ public class Szar implements ModInitializer { entries.add(Szar.ERIKA_DISC); entries.add(Szar.USSR_DISC); // racism - entries.add(Szar.CIGANYBLOCK); - entries.add(Szar.NWORD_PASS); - entries.add(Szar.NIGGER_SPAWNEGG); - entries.add(Szar.GYPSY_SPAWNEGG); - entries.add(Szar.TERRORIST_SPAWNEGG); - entries.add(Szar.POLICE_SPAWNEGG); - entries.add(Szar.KEY_ITEM); - entries.add(Szar.HANDCUFF_ITEM); - // niggerite shits at the end - entries.add(Szar.NIGGERITE_INGOT); - entries.add(Szar.NIGGERITE_SWORD); - entries.add(Szar.NIGGERITE_AXE); - entries.add(Szar.NIGGERITE_PICKAXE); - entries.add(Szar.NIGGERITE_SHOVEL); - entries.add(Szar.NIGGERITE_HOE); - entries.add(Szar.NIGGERITE_HELMET); - entries.add(Szar.NIGGERITE_CHESTPLATE); - entries.add(Szar.NIGGERITE_LEGGINGS); - entries.add(Szar.NIGGERITE_BOOTS); - entries.add(Szar.NIGGERITE_BLOCK); + if (showRacist) { + entries.add(Szar.CIGANYBLOCK); + entries.add(Szar.NWORD_PASS); + entries.add(Szar.NIGGER_SPAWNEGG); + entries.add(Szar.GYPSY_SPAWNEGG); + entries.add(Szar.TERRORIST_SPAWNEGG); + + // niggerite shits at the end + entries.add(Szar.NIGGERITE_INGOT); + entries.add(Szar.NIGGERITE_SWORD); + entries.add(Szar.NIGGERITE_AXE); + entries.add(Szar.NIGGERITE_PICKAXE); + entries.add(Szar.NIGGERITE_SHOVEL); + entries.add(Szar.NIGGERITE_HOE); + entries.add(Szar.NIGGERITE_HELMET); + entries.add(Szar.NIGGERITE_CHESTPLATE); + entries.add(Szar.NIGGERITE_LEGGINGS); + entries.add(Szar.NIGGERITE_BOOTS); + entries.add(Szar.NIGGERITE_BLOCK); + } // nsfw - entries.add(Szar.EPSTEIN_FILES); - entries.add(Szar.EPSTEIN_SPAWNEGG); - entries.add(Szar.FASZITEM); - entries.add(Szar.CNDM); - entries.add(Szar.LATEX); - entries.add(Szar.WHITE_LIQUID); + if (showNsfw) { + entries.add(Szar.EPSTEIN_FILES); + entries.add(Szar.EPSTEIN_SPAWNEGG); + entries.add(Szar.FASZITEM); + entries.add(Szar.CNDM); + entries.add(Szar.LATEX); + entries.add(Szar.WHITE_LIQUID); + } }) .build() ); @@ -1349,6 +1371,13 @@ public class Szar implements ModInitializer { } }); }); + SzarGameRules.register(); + ServerSettings.init(); + ServerConfig.load(); + + ServerLifecycleEvents.SERVER_STARTED.register(SzarGameRules::pushToGameRules); + + BlueprintBlocks.init(); } public static final Block TIC_TAC_TOE_BLOCK = Registry.register( @@ -2002,6 +2031,11 @@ public class Szar implements ModInitializer { new Identifier(MOD_ID, "weed_joint"), new Joint(new Item.Settings()) ); + public static final Item EMPTY_JOINT = Registry.register( + Registries.ITEM, + new Identifier(MOD_ID, "empty_joint"), + new Item(new Item.Settings()) + ); public static final Item CIGANYBLOCK = Registry.register( Registries.ITEM, new Identifier(MOD_ID, "cigany"), diff --git a/src/main/java/dev/tggamesyt/szar/SzarGameRules.java b/src/main/java/dev/tggamesyt/szar/SzarGameRules.java new file mode 100644 index 0000000..1171ab6 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/SzarGameRules.java @@ -0,0 +1,48 @@ +package dev.tggamesyt.szar; + +import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.Identifier; +import net.minecraft.world.GameRules; + +public class SzarGameRules { + + public static GameRules.Key RULE_RACIST; + public static GameRules.Key RULE_GAMBLING; + public static GameRules.Key RULE_NSFW; + + public static void register() { + RULE_RACIST = GameRuleRegistry.register( + "szarBlockRacist", + GameRules.Category.PLAYER, + GameRules.BooleanRule.create(false, (server, rule) -> onRuleChanged(server)) + ); + RULE_GAMBLING = GameRuleRegistry.register( + "szarBlockGambling", + GameRules.Category.PLAYER, + GameRules.BooleanRule.create(false, (server, rule) -> onRuleChanged(server)) + ); + RULE_NSFW = GameRuleRegistry.register( + "szarBlockNsfw", + GameRules.Category.PLAYER, + GameRules.BooleanRule.create(true, (server, rule) -> onRuleChanged(server)) + ); + } + + private static void onRuleChanged(MinecraftServer server) { + GameRules rules = server.getGameRules(); + ServerConfig.set("racist", rules.getBoolean(RULE_RACIST)); + ServerConfig.set("gambling", rules.getBoolean(RULE_GAMBLING)); + ServerConfig.set("nsfw", rules.getBoolean(RULE_NSFW)); + ServerConfig.save(); + } + + /** Call on world load to push saved ServerConfig values back into gamerules. */ + public static void pushToGameRules(MinecraftServer server) { + GameRules rules = server.getGameRules(); + rules.get(RULE_RACIST).set(ServerConfig.get("racist"), server); + rules.get(RULE_GAMBLING).set(ServerConfig.get("gambling"), server); + rules.get(RULE_NSFW).set(ServerConfig.get("nsfw"), server); + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/blockstates/blueprint_door.json b/src/main/resources/assets/szar/blockstates/blueprint_door.json new file mode 100644 index 0000000..6c3ae61 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/blueprint_door.json @@ -0,0 +1,36 @@ +{ + "variants": { + "facing=east,half=lower,hinge=left,open=false": { "model": "szar:block/blueprint_door_bottom_left" }, + "facing=east,half=lower,hinge=left,open=true": { "model": "szar:block/blueprint_door_bottom_left_open", "y": 90 }, + "facing=east,half=lower,hinge=right,open=false": { "model": "szar:block/blueprint_door_bottom_right" }, + "facing=east,half=lower,hinge=right,open=true": { "model": "szar:block/blueprint_door_bottom_right_open", "y": 270 }, + "facing=east,half=upper,hinge=left,open=false": { "model": "szar:block/blueprint_door_top_left" }, + "facing=east,half=upper,hinge=left,open=true": { "model": "szar:block/blueprint_door_top_left_open", "y": 90 }, + "facing=east,half=upper,hinge=right,open=false": { "model": "szar:block/blueprint_door_top_right" }, + "facing=east,half=upper,hinge=right,open=true": { "model": "szar:block/blueprint_door_top_right_open", "y": 270 }, + "facing=north,half=lower,hinge=left,open=false": { "model": "szar:block/blueprint_door_bottom_left", "y": 270 }, + "facing=north,half=lower,hinge=left,open=true": { "model": "szar:block/blueprint_door_bottom_left_open" }, + "facing=north,half=lower,hinge=right,open=false":{ "model": "szar:block/blueprint_door_bottom_right", "y": 270 }, + "facing=north,half=lower,hinge=right,open=true": { "model": "szar:block/blueprint_door_bottom_right_open" }, + "facing=north,half=upper,hinge=left,open=false": { "model": "szar:block/blueprint_door_top_left", "y": 270 }, + "facing=north,half=upper,hinge=left,open=true": { "model": "szar:block/blueprint_door_top_left_open" }, + "facing=north,half=upper,hinge=right,open=false":{ "model": "szar:block/blueprint_door_top_right", "y": 270 }, + "facing=north,half=upper,hinge=right,open=true": { "model": "szar:block/blueprint_door_top_right_open" }, + "facing=south,half=lower,hinge=left,open=false": { "model": "szar:block/blueprint_door_bottom_left", "y": 90 }, + "facing=south,half=lower,hinge=left,open=true": { "model": "szar:block/blueprint_door_bottom_left_open", "y": 180 }, + "facing=south,half=lower,hinge=right,open=false":{ "model": "szar:block/blueprint_door_bottom_right", "y": 90 }, + "facing=south,half=lower,hinge=right,open=true": { "model": "szar:block/blueprint_door_bottom_right_open", "y": 180 }, + "facing=south,half=upper,hinge=left,open=false": { "model": "szar:block/blueprint_door_top_left", "y": 90 }, + "facing=south,half=upper,hinge=left,open=true": { "model": "szar:block/blueprint_door_top_left_open", "y": 180 }, + "facing=south,half=upper,hinge=right,open=false":{ "model": "szar:block/blueprint_door_top_right", "y": 90 }, + "facing=south,half=upper,hinge=right,open=true": { "model": "szar:block/blueprint_door_top_right_open", "y": 180 }, + "facing=west,half=lower,hinge=left,open=false": { "model": "szar:block/blueprint_door_bottom_left", "y": 180 }, + "facing=west,half=lower,hinge=left,open=true": { "model": "szar:block/blueprint_door_bottom_left_open", "y": 270 }, + "facing=west,half=lower,hinge=right,open=false": { "model": "szar:block/blueprint_door_bottom_right", "y": 180 }, + "facing=west,half=lower,hinge=right,open=true": { "model": "szar:block/blueprint_door_bottom_right_open", "y": 90 }, + "facing=west,half=upper,hinge=left,open=false": { "model": "szar:block/blueprint_door_top_left", "y": 180 }, + "facing=west,half=upper,hinge=left,open=true": { "model": "szar:block/blueprint_door_top_left_open", "y": 270 }, + "facing=west,half=upper,hinge=right,open=false": { "model": "szar:block/blueprint_door_top_right", "y": 180 }, + "facing=west,half=upper,hinge=right,open=true": { "model": "szar:block/blueprint_door_top_right_open", "y": 90 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/blockstates/blueprint_fence.json b/src/main/resources/assets/szar/blockstates/blueprint_fence.json new file mode 100644 index 0000000..21ccdf2 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/blueprint_fence.json @@ -0,0 +1,13 @@ +{ + "multipart": [ + { "apply": { "model": "szar:block/blueprint_fence_post" } }, + { "apply": { "model": "szar:block/blueprint_fence_side", "uvlock": true }, + "when": { "north": "true" } }, + { "apply": { "model": "szar:block/blueprint_fence_side", "y": 90, "uvlock": true }, + "when": { "east": "true" } }, + { "apply": { "model": "szar:block/blueprint_fence_side", "y": 180, "uvlock": true }, + "when": { "south": "true" } }, + { "apply": { "model": "szar:block/blueprint_fence_side", "y": 270, "uvlock": true }, + "when": { "west": "true" } } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/blockstates/blueprint_slab.json b/src/main/resources/assets/szar/blockstates/blueprint_slab.json new file mode 100644 index 0000000..9ee9c93 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/blueprint_slab.json @@ -0,0 +1,7 @@ +{ + "variants": { + "type=bottom": { "model": "szar:block/blueprint_slab" }, + "type=double": { "model": "szar:block/blueprint_slab_double" }, + "type=top": { "model": "szar:block/blueprint_slab_top" } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/blockstates/blueprint_stairs.json b/src/main/resources/assets/szar/blockstates/blueprint_stairs.json new file mode 100644 index 0000000..f17e9c8 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/blueprint_stairs.json @@ -0,0 +1,44 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "y": 270, "uvlock": true }, + "facing=east,half=bottom,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner" }, + "facing=east,half=bottom,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "y": 270, "uvlock": true }, + "facing=east,half=bottom,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer" }, + "facing=east,half=bottom,shape=straight": { "model": "szar:block/blueprint_stairs" }, + "facing=east,half=top,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "uvlock": true }, + "facing=east,half=top,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "y": 90, "uvlock": true }, + "facing=east,half=top,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "uvlock": true }, + "facing=east,half=top,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "y": 90, "uvlock": true }, + "facing=east,half=top,shape=straight": { "model": "szar:block/blueprint_stairs", "x": 180, "uvlock": true }, + "facing=north,half=bottom,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "y": 180, "uvlock": true }, + "facing=north,half=bottom,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "y": 270, "uvlock": true }, + "facing=north,half=bottom,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "y": 180, "uvlock": true }, + "facing=north,half=bottom,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "y": 270, "uvlock": true }, + "facing=north,half=bottom,shape=straight": { "model": "szar:block/blueprint_stairs", "y": 270, "uvlock": true }, + "facing=north,half=top,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "y": 270, "uvlock": true }, + "facing=north,half=top,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "uvlock": true }, + "facing=north,half=top,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "y": 270, "uvlock": true }, + "facing=north,half=top,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "uvlock": true }, + "facing=north,half=top,shape=straight": { "model": "szar:block/blueprint_stairs", "x": 180, "y": 270, "uvlock": true }, + "facing=south,half=bottom,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner" }, + "facing=south,half=bottom,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "y": 90, "uvlock": true }, + "facing=south,half=bottom,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer" }, + "facing=south,half=bottom,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "y": 90, "uvlock": true }, + "facing=south,half=bottom,shape=straight": { "model": "szar:block/blueprint_stairs", "y": 90, "uvlock": true }, + "facing=south,half=top,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "y": 90, "uvlock": true }, + "facing=south,half=top,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "y": 180, "uvlock": true }, + "facing=south,half=top,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "y": 90, "uvlock": true }, + "facing=south,half=top,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "y": 180, "uvlock": true }, + "facing=south,half=top,shape=straight": { "model": "szar:block/blueprint_stairs", "x": 180, "y": 90, "uvlock": true }, + "facing=west,half=bottom,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "y": 90, "uvlock": true }, + "facing=west,half=bottom,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "y": 180, "uvlock": true }, + "facing=west,half=bottom,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "y": 90, "uvlock": true }, + "facing=west,half=bottom,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "y": 180, "uvlock": true }, + "facing=west,half=bottom,shape=straight": { "model": "szar:block/blueprint_stairs", "y": 180, "uvlock": true }, + "facing=west,half=top,shape=inner_left": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "y": 180, "uvlock": true }, + "facing=west,half=top,shape=inner_right": { "model": "szar:block/blueprint_stairs_inner", "x": 180, "y": 270, "uvlock": true }, + "facing=west,half=top,shape=outer_left": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "y": 180, "uvlock": true }, + "facing=west,half=top,shape=outer_right": { "model": "szar:block/blueprint_stairs_outer", "x": 180, "y": 270, "uvlock": true }, + "facing=west,half=top,shape=straight": { "model": "szar:block/blueprint_stairs", "x": 180, "y": 180, "uvlock": true } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/blockstates/blueprint_trapdoor.json b/src/main/resources/assets/szar/blockstates/blueprint_trapdoor.json new file mode 100644 index 0000000..b692c79 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/blueprint_trapdoor.json @@ -0,0 +1,20 @@ +{ + "variants": { + "facing=east,half=bottom,open=false": { "model": "szar:block/blueprint_trapdoor_bottom" }, + "facing=east,half=bottom,open=true": { "model": "szar:block/blueprint_trapdoor_open", "y": 90 }, + "facing=east,half=top,open=false": { "model": "szar:block/blueprint_trapdoor_top" }, + "facing=east,half=top,open=true": { "model": "szar:block/blueprint_trapdoor_open", "y": 90 }, + "facing=north,half=bottom,open=false": { "model": "szar:block/blueprint_trapdoor_bottom" }, + "facing=north,half=bottom,open=true": { "model": "szar:block/blueprint_trapdoor_open" }, + "facing=north,half=top,open=false": { "model": "szar:block/blueprint_trapdoor_top" }, + "facing=north,half=top,open=true": { "model": "szar:block/blueprint_trapdoor_open" }, + "facing=south,half=bottom,open=false": { "model": "szar:block/blueprint_trapdoor_bottom" }, + "facing=south,half=bottom,open=true": { "model": "szar:block/blueprint_trapdoor_open", "y": 180 }, + "facing=south,half=top,open=false": { "model": "szar:block/blueprint_trapdoor_top" }, + "facing=south,half=top,open=true": { "model": "szar:block/blueprint_trapdoor_open", "y": 180 }, + "facing=west,half=bottom,open=false": { "model": "szar:block/blueprint_trapdoor_bottom" }, + "facing=west,half=bottom,open=true": { "model": "szar:block/blueprint_trapdoor_open", "y": 270 }, + "facing=west,half=top,open=false": { "model": "szar:block/blueprint_trapdoor_top" }, + "facing=west,half=top,open=true": { "model": "szar:block/blueprint_trapdoor_open", "y": 270 } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/blockstates/blueprint_wall.json b/src/main/resources/assets/szar/blockstates/blueprint_wall.json new file mode 100644 index 0000000..1a87b92 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/blueprint_wall.json @@ -0,0 +1,22 @@ +{ + "multipart": [ + { "apply": { "model": "szar:block/blueprint_wall_post" }, + "when": { "up": "true" } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "uvlock": true }, + "when": { "north": "low" } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "y": 90, "uvlock": true }, + "when": { "east": "low" } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "y": 180, "uvlock": true }, + "when": { "south": "low" } }, + { "apply": { "model": "szar:block/blueprint_wall_side", "y": 270, "uvlock": true }, + "when": { "west": "low" } }, + { "apply": { "model": "szar:block/blueprint_wall_side_tall", "uvlock": true }, + "when": { "north": "tall" } }, + { "apply": { "model": "szar:block/blueprint_wall_side_tall", "y": 90, "uvlock": true }, + "when": { "east": "tall" } }, + { "apply": { "model": "szar:block/blueprint_wall_side_tall", "y": 180, "uvlock": true }, + "when": { "south": "tall" } }, + { "apply": { "model": "szar:block/blueprint_wall_side_tall", "y": 270, "uvlock": true }, + "when": { "west": "tall" } } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/lang/en_us.json b/src/main/resources/assets/szar/lang/en_us.json index 7b2f230..0bddfc8 100644 --- a/src/main/resources/assets/szar/lang/en_us.json +++ b/src/main/resources/assets/szar/lang/en_us.json @@ -189,5 +189,13 @@ "block.szar.tictactoe": "Tic Tac Toe", "block.szar.connectfour": "Connect Four", - "block.szar.chess": "Chess" + "block.szar.chess": "Chess", + "item.szar.empty_joint": "Empty Joint", + + "block.szar.blueprint_stairs": "Blueprint Stairs", + "block.szar.blueprint_slab": "Blueprint Slab", + "block.szar.blueprint_door": "Blueprint Door", + "block.szar.blueprint_trapdoor": "Blueprint Trapdoor", + "block.szar.blueprint_wall": "Blueprint Wall", + "block.szar.blueprint_fence": "Blueprint Fence" } diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_bottom_left.json b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_left.json new file mode 100644 index 0000000..c4687ca --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_left.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_bottom_left", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_bottom_left_open.json b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_left_open.json new file mode 100644 index 0000000..020fa49 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_left_open.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_bottom_left_open", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_bottom_right.json b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_right.json new file mode 100644 index 0000000..9df4079 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_right.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_bottom_right", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_bottom_right_open.json b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_right_open.json new file mode 100644 index 0000000..6769091 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_bottom_right_open.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_bottom_right_open", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_top_left.json b/src/main/resources/assets/szar/models/block/blueprint_door_top_left.json new file mode 100644 index 0000000..a39b3eb --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_top_left.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_top_left", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_top_left_open.json b/src/main/resources/assets/szar/models/block/blueprint_door_top_left_open.json new file mode 100644 index 0000000..f0298fa --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_top_left_open.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_top_left_open", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_top_right.json b/src/main/resources/assets/szar/models/block/blueprint_door_top_right.json new file mode 100644 index 0000000..5d4de0f --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_top_right.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_top_right", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_door_top_right_open.json b/src/main/resources/assets/szar/models/block/blueprint_door_top_right_open.json new file mode 100644 index 0000000..d5004eb --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_door_top_right_open.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/door_top_right_open", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_fence_post.json b/src/main/resources/assets/szar/models/block/blueprint_fence_post.json new file mode 100644 index 0000000..54acfe3 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_fence_post.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/fence_post", + "textures": { "texture": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_fence_side.json b/src/main/resources/assets/szar/models/block/blueprint_fence_side.json new file mode 100644 index 0000000..121916f --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_fence_side.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/fence_side", + "textures": { "texture": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_slab.json b/src/main/resources/assets/szar/models/block/blueprint_slab.json new file mode 100644 index 0000000..332f6b8 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_slab.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/slab", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint", "side": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_slab_double.json b/src/main/resources/assets/szar/models/block/blueprint_slab_double.json new file mode 100644 index 0000000..46a8b8e --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_slab_double.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/cube_all", + "textures": { "all": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_slab_top.json b/src/main/resources/assets/szar/models/block/blueprint_slab_top.json new file mode 100644 index 0000000..71affce --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_slab_top.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/slab_top", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint", "side": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_stairs.json b/src/main/resources/assets/szar/models/block/blueprint_stairs.json new file mode 100644 index 0000000..fc1793e --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_stairs.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/stairs", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint", "side": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_stairs_inner.json b/src/main/resources/assets/szar/models/block/blueprint_stairs_inner.json new file mode 100644 index 0000000..86bac67 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_stairs_inner.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/inner_stairs", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint", "side": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_stairs_outer.json b/src/main/resources/assets/szar/models/block/blueprint_stairs_outer.json new file mode 100644 index 0000000..936a481 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_stairs_outer.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/outer_stairs", + "textures": { "bottom": "szar:block/blueprint", "top": "szar:block/blueprint", "side": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_trapdoor_bottom.json b/src/main/resources/assets/szar/models/block/blueprint_trapdoor_bottom.json new file mode 100644 index 0000000..d3b99cf --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_trapdoor_bottom.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/template_trapdoor_bottom", + "textures": { "texture": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_trapdoor_open.json b/src/main/resources/assets/szar/models/block/blueprint_trapdoor_open.json new file mode 100644 index 0000000..6329213 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_trapdoor_open.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/template_trapdoor_open", + "textures": { "texture": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_trapdoor_top.json b/src/main/resources/assets/szar/models/block/blueprint_trapdoor_top.json new file mode 100644 index 0000000..a06a10d --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_trapdoor_top.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/template_trapdoor_top", + "textures": { "texture": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_wall_post.json b/src/main/resources/assets/szar/models/block/blueprint_wall_post.json new file mode 100644 index 0000000..08a2053 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_wall_post.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/template_wall_post", + "textures": { "wall": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_wall_side.json b/src/main/resources/assets/szar/models/block/blueprint_wall_side.json new file mode 100644 index 0000000..af504e0 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_wall_side.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/template_wall_side", + "textures": { "wall": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/block/blueprint_wall_side_tall.json b/src/main/resources/assets/szar/models/block/blueprint_wall_side_tall.json new file mode 100644 index 0000000..6b21ba3 --- /dev/null +++ b/src/main/resources/assets/szar/models/block/blueprint_wall_side_tall.json @@ -0,0 +1,2 @@ +{ "parent": "minecraft:block/template_wall_side_tall", + "textures": { "wall": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/blueprint_door.json b/src/main/resources/assets/szar/models/item/blueprint_door.json new file mode 100644 index 0000000..4c643b5 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/blueprint_door.json @@ -0,0 +1 @@ +{ "parent": "minecraft:item/generated", "textures": { "layer0": "szar:block/blueprint" } } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/blueprint_fence.json b/src/main/resources/assets/szar/models/item/blueprint_fence.json new file mode 100644 index 0000000..1b76c2a --- /dev/null +++ b/src/main/resources/assets/szar/models/item/blueprint_fence.json @@ -0,0 +1 @@ +{ "parent": "szar:block/blueprint_fence_post" } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/blueprint_slab.json b/src/main/resources/assets/szar/models/item/blueprint_slab.json new file mode 100644 index 0000000..072d0be --- /dev/null +++ b/src/main/resources/assets/szar/models/item/blueprint_slab.json @@ -0,0 +1 @@ +{ "parent": "szar:block/blueprint_slab" } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/blueprint_stairs.json b/src/main/resources/assets/szar/models/item/blueprint_stairs.json new file mode 100644 index 0000000..80a158d --- /dev/null +++ b/src/main/resources/assets/szar/models/item/blueprint_stairs.json @@ -0,0 +1 @@ +{ "parent": "szar:block/blueprint_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/blueprint_trapdoor.json b/src/main/resources/assets/szar/models/item/blueprint_trapdoor.json new file mode 100644 index 0000000..c24cb01 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/blueprint_trapdoor.json @@ -0,0 +1 @@ +{ "parent": "szar:block/blueprint_trapdoor_bottom" } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/blueprint_wall.json b/src/main/resources/assets/szar/models/item/blueprint_wall.json new file mode 100644 index 0000000..26441b5 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/blueprint_wall.json @@ -0,0 +1 @@ +{ "parent": "szar:block/blueprint_wall_post" } \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/empty_joint.json b/src/main/resources/assets/szar/models/item/empty_joint.json new file mode 100644 index 0000000..dd4737d --- /dev/null +++ b/src/main/resources/assets/szar/models/item/empty_joint.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "szar:item/empty_joint" + } +} diff --git a/src/main/resources/assets/szar/models/item/empty_joint_in_hand.json b/src/main/resources/assets/szar/models/item/empty_joint_in_hand.json new file mode 100644 index 0000000..ca7bcb3 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/empty_joint_in_hand.json @@ -0,0 +1,57 @@ +{ + "format_version": "1.9.0", + "credit": "Made with Blockbench", + "textures": { + "0": "szar:item/emptyjoint3d", + "particle": "szar:item/emptyjoint3d" + }, + "elements": [ + { + "from": [7, 8.5, 7], + "to": [9, 13.5, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 8.5, 7]}, + "faces": { + "north": {"uv": [0, 0, 2, 5], "texture": "#0"}, + "east": {"uv": [2, 0, 4, 5], "texture": "#0"}, + "south": {"uv": [4, 0, 6, 5], "texture": "#0"}, + "west": {"uv": [6, 0, 8, 5], "texture": "#0"}, + "up": {"uv": [10, 2, 8, 0], "texture": "#0"} + } + }, + { + "from": [6.9, 2.4, 6.9], + "to": [9.1, 8.6, 9.1], + "rotation": {"angle": 0, "axis": "y", "origin": [6.9, 2.4, 6.9]}, + "faces": { + "north": {"uv": [0, 5, 2, 12], "texture": "#0"}, + "east": {"uv": [2, 5, 4, 12], "texture": "#0"}, + "south": {"uv": [4, 5, 6, 12], "texture": "#0"}, + "west": {"uv": [6, 5, 8, 12], "texture": "#0"}, + "up": {"uv": [10, 2, 8, 0], "texture": "#0"}, + "down": {"uv": [10, 2, 8, 4], "texture": "#0"} + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "translation": [0, -2, 0] + }, + "ground": { + "rotation": [90, 0, 0] + }, + "gui": { + "rotation": [-67.5, 0, 45], + "scale": [1.5, 1.5, 1.5] + }, + "head": { + "rotation": [90, 0, 0], + "translation": [0, 0, -16], + "scale": [1.6, 1.6, 1.6] + }, + "fixed": { + "translation": [0, 0, -1.5], + "scale": [1.5, 1.5, 1.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/textures/block/chess.png b/src/main/resources/assets/szar/textures/block/chess.png index 8af07ec..ea470a2 100644 Binary files a/src/main/resources/assets/szar/textures/block/chess.png and b/src/main/resources/assets/szar/textures/block/chess.png differ diff --git a/src/main/resources/assets/szar/textures/item/empty_joint.png b/src/main/resources/assets/szar/textures/item/empty_joint.png new file mode 100644 index 0000000..8b81684 Binary files /dev/null and b/src/main/resources/assets/szar/textures/item/empty_joint.png differ diff --git a/src/main/resources/assets/szar/textures/item/emptyjoint3d.png b/src/main/resources/assets/szar/textures/item/emptyjoint3d.png new file mode 100644 index 0000000..7f6cfbb Binary files /dev/null and b/src/main/resources/assets/szar/textures/item/emptyjoint3d.png differ diff --git a/src/main/resources/data/szar/recipes/empty_joint.json b/src/main/resources/data/szar/recipes/empty_joint.json new file mode 100644 index 0000000..388f88d --- /dev/null +++ b/src/main/resources/data/szar/recipes/empty_joint.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " P ", + "P P", + " P " + ], + "key": { + "P": { + "item": "minecraft:paper" + } + }, + "result": { + "item": "szar:empty_joint", + "count": 1 + } +} diff --git a/src/main/resources/data/szar/recipes/weed_joint.json b/src/main/resources/data/szar/recipes/weed_joint.json index bbf1b67..622e8ff 100644 --- a/src/main/resources/data/szar/recipes/weed_joint.json +++ b/src/main/resources/data/szar/recipes/weed_joint.json @@ -1,16 +1,16 @@ { "type": "minecraft:crafting_shaped", "pattern": [ - "WP ", + " P ", "PWP", - " PW" + " P " ], "key": { - "W": { + "P": { "item": "szar:weed" }, - "P": { - "item": "minecraft:paper" + "W": { + "item": "szar:empty_joint" } }, "result": { diff --git a/src/main/resources/szar.accesswidener b/src/main/resources/szar.accesswidener index 8378402..e1ec0a4 100644 --- a/src/main/resources/szar.accesswidener +++ b/src/main/resources/szar.accesswidener @@ -5,4 +5,5 @@ accessible field net/minecraft/entity/LivingEntity jumping Z accessible class net/minecraft/client/gui/hud/InGameHud$HeartType accessible field net/minecraft/server/network/ServerPlayerInteractionManager player Lnet/minecraft/server/network/ServerPlayerEntity; accessible method net/minecraft/client/render/entity/LivingEntityRenderer addFeature (Lnet/minecraft/client/render/entity/feature/FeatureRenderer;)Z -accessible field net/minecraft/client/render/entity/EntityRenderDispatcher renderers Ljava/util/Map; \ No newline at end of file +accessible field net/minecraft/client/render/entity/EntityRenderDispatcher renderers Ljava/util/Map; +accessible method net/minecraft/world/GameRules$BooleanRule create (ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/GameRules$Type; \ No newline at end of file