From 742ee92f3fe51c568bc3f768a292b24ca4b8602d Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Sun, 31 Dec 2023 12:30:21 +0100 Subject: [PATCH] feat: Add Ugly Steel Plating --- .../datagen/ModBlockLootTableProvider.java | 16 +++++++++-- .../fabric/datagen/ModModelGenerator.java | 27 ++++++++++++++++-- .../blockstates/blender.json | 23 ++++++++++++--- .../blockstates/printer.json | 23 ++++++++++++--- .../models/item/ugly_steel_plating.json | 6 ++++ .../loot_tables/blocks/blender.json | 19 ++++++++++++ .../loot_tables/blocks/printer.json | 19 ++++++++++++ .../block/BlenderBlock.java | 10 ++++++- .../block/CustomBlockStateProperties.java | 7 +++++ .../block/PrinterBlock.java | 8 ++++++ .../block/entity/BlenderBlockEntity.java | 14 ++++++--- .../client/render/BlenderRenderer.java | 8 +++++- .../forbiddensmoothies/item/ModItems.java | 4 +++ .../item/UglySteelPlatingItem.java | 27 ++++++++++++++++++ .../assets/forbiddensmoothies/lang/en_us.json | 2 ++ .../models/block/blender.json | 2 +- .../models/block/blender_ugly.json | 6 ++++ .../models/block/printer_ugly.json | 6 ++++ .../textures/block/blender_ugly.png | Bin 0 -> 5522 bytes .../textures/block/printer_ugly.png | Bin 0 -> 5595 bytes .../textures/item/ugly_steel_plating.png | Bin 0 -> 581 bytes 21 files changed, 208 insertions(+), 19 deletions(-) create mode 100644 shared/src/generated/resources/assets/forbiddensmoothies/models/item/ugly_steel_plating.json create mode 100644 shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/CustomBlockStateProperties.java create mode 100644 shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/UglySteelPlatingItem.java create mode 100644 shared/src/main/resources/assets/forbiddensmoothies/models/block/blender_ugly.json create mode 100644 shared/src/main/resources/assets/forbiddensmoothies/models/block/printer_ugly.json create mode 100644 shared/src/main/resources/assets/forbiddensmoothies/textures/block/blender_ugly.png create mode 100644 shared/src/main/resources/assets/forbiddensmoothies/textures/block/printer_ugly.png create mode 100644 shared/src/main/resources/assets/forbiddensmoothies/textures/item/ugly_steel_plating.png diff --git a/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModBlockLootTableProvider.java b/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModBlockLootTableProvider.java index ee24c40..249336f 100644 --- a/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModBlockLootTableProvider.java +++ b/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModBlockLootTableProvider.java @@ -1,8 +1,14 @@ package net.blay09.mods.forbiddensmoothies.fabric.datagen; +import net.blay09.mods.forbiddensmoothies.block.CustomBlockStateProperties; import net.blay09.mods.forbiddensmoothies.block.ModBlocks; +import net.blay09.mods.forbiddensmoothies.item.ModItems; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; +import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; public class ModBlockLootTableProvider extends FabricBlockLootTableProvider { protected ModBlockLootTableProvider(FabricDataOutput dataOutput) { @@ -11,7 +17,13 @@ protected ModBlockLootTableProvider(FabricDataOutput dataOutput) { @Override public void generate() { - add(ModBlocks.printer, createSingleItemTable(ModBlocks.printer)); - add(ModBlocks.blender, createSingleItemTable(ModBlocks.blender)); + add(ModBlocks.printer, createSingleItemTable(ModBlocks.printer) + .withPool(new LootPool.Builder().add(LootItem.lootTableItem(ModItems.uglySteelPlating)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.printer) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CustomBlockStateProperties.UGLY, true))))); + add(ModBlocks.blender, createSingleItemTable(ModBlocks.blender) + .withPool(new LootPool.Builder().add(LootItem.lootTableItem(ModItems.uglySteelPlating)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.blender) + .setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CustomBlockStateProperties.UGLY, true))))); } } diff --git a/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModModelGenerator.java b/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModModelGenerator.java index a7a52fb..1e2715a 100644 --- a/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModModelGenerator.java +++ b/fabric/src/main/java/net/blay09/mods/forbiddensmoothies/fabric/datagen/ModModelGenerator.java @@ -1,10 +1,22 @@ package net.blay09.mods.forbiddensmoothies.fabric.datagen; +import net.blay09.mods.forbiddensmoothies.block.CustomBlockStateProperties; import net.blay09.mods.forbiddensmoothies.block.ModBlocks; +import net.blay09.mods.forbiddensmoothies.item.ModItems; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; import net.minecraft.data.models.BlockModelGenerators; import net.minecraft.data.models.ItemModelGenerators; +import net.minecraft.data.models.blockstates.MultiVariantGenerator; +import net.minecraft.data.models.blockstates.PropertyDispatch; +import net.minecraft.data.models.blockstates.Variant; +import net.minecraft.data.models.blockstates.VariantProperties; +import net.minecraft.data.models.model.ModelLocationUtils; +import net.minecraft.data.models.model.ModelTemplates; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; + +import static net.minecraft.data.models.BlockModelGenerators.createHorizontalFacingDispatch; public class ModModelGenerator extends FabricModelProvider { public ModModelGenerator(FabricDataOutput output) { @@ -13,11 +25,22 @@ public ModModelGenerator(FabricDataOutput output) { @Override public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) { - blockStateModelGenerator.createNonTemplateHorizontalBlock(ModBlocks.printer); - blockStateModelGenerator.createNonTemplateHorizontalBlock(ModBlocks.blender); + createNonTemplateUglifyableHorizontalBlock(blockStateModelGenerator, ModBlocks.printer); + createNonTemplateUglifyableHorizontalBlock(blockStateModelGenerator, ModBlocks.blender); } @Override public void generateItemModels(ItemModelGenerators itemModelGenerator) { + itemModelGenerator.generateFlatItem(ModItems.uglySteelPlating, ModelTemplates.FLAT_ITEM); + } + + public final void createNonTemplateUglifyableHorizontalBlock(BlockModelGenerators blockStateModelGenerator, Block block) { + final var modelLocation = ModelLocationUtils.getModelLocation(block); + final var uglyModelLocation = ModelLocationUtils.getModelLocation(block, "_ugly"); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block, + Variant.variant().with(VariantProperties.MODEL, ModelLocationUtils.getModelLocation(block))).with(createHorizontalFacingDispatch()) + .with(PropertyDispatch.property(CustomBlockStateProperties.UGLY) + .select(false, Variant.variant().with(VariantProperties.MODEL, modelLocation)) + .select(true, Variant.variant().with(VariantProperties.MODEL, uglyModelLocation)))); } } diff --git a/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/blender.json b/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/blender.json index b3367f1..ac3e1a2 100644 --- a/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/blender.json +++ b/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/blender.json @@ -1,19 +1,34 @@ { "variants": { - "facing=east": { + "facing=east,ugly=false": { "model": "forbiddensmoothies:block/blender", "y": 90 }, - "facing=north": { + "facing=east,ugly=true": { + "model": "forbiddensmoothies:block/blender_ugly", + "y": 90 + }, + "facing=north,ugly=false": { "model": "forbiddensmoothies:block/blender" }, - "facing=south": { + "facing=north,ugly=true": { + "model": "forbiddensmoothies:block/blender_ugly" + }, + "facing=south,ugly=false": { "model": "forbiddensmoothies:block/blender", "y": 180 }, - "facing=west": { + "facing=south,ugly=true": { + "model": "forbiddensmoothies:block/blender_ugly", + "y": 180 + }, + "facing=west,ugly=false": { "model": "forbiddensmoothies:block/blender", "y": 270 + }, + "facing=west,ugly=true": { + "model": "forbiddensmoothies:block/blender_ugly", + "y": 270 } } } \ No newline at end of file diff --git a/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/printer.json b/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/printer.json index 847f078..c182755 100644 --- a/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/printer.json +++ b/shared/src/generated/resources/assets/forbiddensmoothies/blockstates/printer.json @@ -1,19 +1,34 @@ { "variants": { - "facing=east": { + "facing=east,ugly=false": { "model": "forbiddensmoothies:block/printer", "y": 90 }, - "facing=north": { + "facing=east,ugly=true": { + "model": "forbiddensmoothies:block/printer_ugly", + "y": 90 + }, + "facing=north,ugly=false": { "model": "forbiddensmoothies:block/printer" }, - "facing=south": { + "facing=north,ugly=true": { + "model": "forbiddensmoothies:block/printer_ugly" + }, + "facing=south,ugly=false": { "model": "forbiddensmoothies:block/printer", "y": 180 }, - "facing=west": { + "facing=south,ugly=true": { + "model": "forbiddensmoothies:block/printer_ugly", + "y": 180 + }, + "facing=west,ugly=false": { "model": "forbiddensmoothies:block/printer", "y": 270 + }, + "facing=west,ugly=true": { + "model": "forbiddensmoothies:block/printer_ugly", + "y": 270 } } } \ No newline at end of file diff --git a/shared/src/generated/resources/assets/forbiddensmoothies/models/item/ugly_steel_plating.json b/shared/src/generated/resources/assets/forbiddensmoothies/models/item/ugly_steel_plating.json new file mode 100644 index 0000000..7274c35 --- /dev/null +++ b/shared/src/generated/resources/assets/forbiddensmoothies/models/item/ugly_steel_plating.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "forbiddensmoothies:item/ugly_steel_plating" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/blender.json b/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/blender.json index d46c1f4..e94b8bd 100644 --- a/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/blender.json +++ b/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/blender.json @@ -15,6 +15,25 @@ } ], "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "forbiddensmoothies:blender", + "condition": "minecraft:block_state_property", + "properties": { + "ugly": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "forbiddensmoothies:ugly_steel_plating" + } + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/printer.json b/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/printer.json index 77d40aa..18c0e11 100644 --- a/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/printer.json +++ b/shared/src/generated/resources/data/forbiddensmoothies/loot_tables/blocks/printer.json @@ -15,6 +15,25 @@ } ], "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "forbiddensmoothies:printer", + "condition": "minecraft:block_state_property", + "properties": { + "ugly": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "forbiddensmoothies:ugly_steel_plating" + } + ], + "rolls": 1.0 } ] } \ No newline at end of file diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/BlenderBlock.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/BlenderBlock.java index 7dcf815..2b2b777 100644 --- a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/BlenderBlock.java +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/BlenderBlock.java @@ -5,6 +5,7 @@ import net.blay09.mods.balm.api.container.BalmContainerProvider; import net.blay09.mods.forbiddensmoothies.block.entity.BlenderBlockEntity; import net.blay09.mods.forbiddensmoothies.block.entity.ModBlockEntities; +import net.blay09.mods.forbiddensmoothies.item.ModItems; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -24,6 +25,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; @@ -34,6 +36,7 @@ public class BlenderBlock extends BaseEntityBlock { private static final VoxelShape SHAPE = box(3, 0, 3, 13, 16, 13); private static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + private static final BooleanProperty UGLY = CustomBlockStateProperties.UGLY; public BlenderBlock() { super(BlockBehaviour.Properties.of().sound(SoundType.METAL).strength(2.5f)); @@ -42,10 +45,15 @@ public BlenderBlock() { @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); + builder.add(UGLY); } @Override public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { + if (player.getItemInHand(hand).is(ModItems.uglySteelPlating)) { + return InteractionResult.PASS; + } + final var blockEntity = level.getBlockEntity(pos); if (!level.isClientSide && blockEntity instanceof BlenderBlockEntity blender) { if (player.getAbilities().instabuild && player.getItemInHand(InteractionHand.MAIN_HAND).is(Items.BAMBOO)) { @@ -76,7 +84,7 @@ public RenderShape getRenderShape(BlockState state) { @Override public BlockState getStateForPlacement(BlockPlaceContext context) { - return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); + return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(UGLY, false); } @Override diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/CustomBlockStateProperties.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/CustomBlockStateProperties.java new file mode 100644 index 0000000..592629e --- /dev/null +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/CustomBlockStateProperties.java @@ -0,0 +1,7 @@ +package net.blay09.mods.forbiddensmoothies.block; + +import net.minecraft.world.level.block.state.properties.BooleanProperty; + +public class CustomBlockStateProperties { + public static final BooleanProperty UGLY = BooleanProperty.create("ugly"); +} diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/PrinterBlock.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/PrinterBlock.java index 218914d..dd6fff7 100644 --- a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/PrinterBlock.java +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/PrinterBlock.java @@ -4,6 +4,7 @@ import net.blay09.mods.balm.api.container.BalmContainerProvider; import net.blay09.mods.forbiddensmoothies.block.entity.ModBlockEntities; import net.blay09.mods.forbiddensmoothies.block.entity.PrinterBlockEntity; +import net.blay09.mods.forbiddensmoothies.item.ModItems; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -22,6 +23,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; @@ -29,6 +31,7 @@ public class PrinterBlock extends BaseEntityBlock { private static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + private static final BooleanProperty UGLY = CustomBlockStateProperties.UGLY; public PrinterBlock() { super(BlockBehaviour.Properties.of().sound(SoundType.METAL).strength(2.5f)); @@ -37,10 +40,15 @@ public PrinterBlock() { @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); + builder.add(UGLY); } @Override public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { + if (player.getItemInHand(hand).is(ModItems.uglySteelPlating)) { + return InteractionResult.PASS; + } + final var blockEntity = level.getBlockEntity(pos); if (!level.isClientSide && blockEntity instanceof PrinterBlockEntity printer) { if (player.getAbilities().instabuild && player.getItemInHand(InteractionHand.MAIN_HAND).is(Items.BAMBOO)) { diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/entity/BlenderBlockEntity.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/entity/BlenderBlockEntity.java index 83445dc..a1cfc08 100644 --- a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/entity/BlenderBlockEntity.java +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/block/entity/BlenderBlockEntity.java @@ -161,6 +161,7 @@ public void load(CompoundTag tag) { progress = tag.getInt("Progress"); maxProgress = tag.getInt("MaxProgress"); lockedInputs = tag.getBoolean("LockedInputs"); + energyCostPerTick = tag.getInt("EnergyCostPerTick"); } protected void saveAdditional(CompoundTag tag) { @@ -176,8 +177,7 @@ protected void saveAdditional(CompoundTag tag) { protected void writeUpdateTag(CompoundTag tag) { super.writeUpdateTag(tag); tag.put("Items", container.serialize()); - tag.putInt("Progress", this.progress); - tag.putInt("MaxProgress", this.maxProgress); + tag.putInt("EnergyCostPerTick", energyCostPerTick); } @Override @@ -191,7 +191,7 @@ public Container getContainer(Direction side) { } public void serverTick() { - if (ticksSinceLastSync >= 20 && dirtyForSync) { + if (ticksSinceLastSync >= 10 && dirtyForSync) { sync(); dirtyForSync = false; ticksSinceLastSync = 0; @@ -203,7 +203,11 @@ public void serverTick() { final var recipe = selectRecipe(randomSource).orElse(null); maxProgress = getTotalProcessingTicks(); + final var lastEnergyCostPerTick = energyCostPerTick; energyCostPerTick = recipe != null ? determineEnergyCostPerTick() : 0; + if (lastEnergyCostPerTick != energyCostPerTick) { + dirtyForSync = true; + } if (recipe != null && canFitRecipeResults(recipe) && energyStorage.drain(energyCostPerTick, true) >= energyCostPerTick) { progress++; energyStorage.drain(energyCostPerTick, false); @@ -290,7 +294,9 @@ public void setChanged() { } public float animate(float partialTicks) { - animationTicks += partialTicks; + if (energyCostPerTick > 0) { + animationTicks += partialTicks; + } return animationTicks; } } diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/client/render/BlenderRenderer.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/client/render/BlenderRenderer.java index b38cc5f..1e2fd34 100644 --- a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/client/render/BlenderRenderer.java +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/client/render/BlenderRenderer.java @@ -1,6 +1,7 @@ package net.blay09.mods.forbiddensmoothies.client.render; import com.mojang.blaze3d.vertex.PoseStack; +import net.blay09.mods.forbiddensmoothies.block.CustomBlockStateProperties; import net.blay09.mods.forbiddensmoothies.block.entity.BlenderBlockEntity; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; @@ -15,6 +16,11 @@ public BlenderRenderer(BlockEntityRendererProvider.Context context) { @Override public void render(BlenderBlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlayIn) { + final var state = blockEntity.getBlockState(); + if (state.hasProperty(CustomBlockStateProperties.UGLY) && state.getValue(CustomBlockStateProperties.UGLY)) { + return; + } + final var inputContainer = blockEntity.getInputContainer(); poseStack.pushPose(); final var itemScale = 0.2f; @@ -30,7 +36,7 @@ public void render(BlenderBlockEntity blockEntity, float partialTicks, PoseStack final var sinah = Math.sin(animationTime * speedH) * offsetH; for (int i = 0; i < inputContainer.getContainerSize(); i++) { poseStack.pushPose(); - poseStack.translate(i * 0.2f - 0.5f, i * 0.2f - 0.5f, 0f); + poseStack.translate(i * 0.1f - 0.5f, i * 0.15f - 0.5f, i * 0.1f - 0.5f); double sinav = Math.sin(i * animationTime * speedV) * offsetV; if (i % 2 == 0) { poseStack.translate(cosah, sinav, sinah); diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/ModItems.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/ModItems.java index 138b12e..85ac733 100644 --- a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/ModItems.java +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/ModItems.java @@ -6,14 +6,18 @@ import net.blay09.mods.forbiddensmoothies.block.ModBlocks; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; public class ModItems { + public static Item uglySteelPlating; public static DeferredObject creativeModeTab; public static void initialize(BalmItems items) { creativeModeTab = items.registerCreativeModeTab(id(ForbiddenSmoothies.MOD_ID), () -> new ItemStack(ModBlocks.printer)); + + items.registerItem(() -> uglySteelPlating = new UglySteelPlatingItem(items.itemProperties()), id("ugly_steel_plating")); } private static ResourceLocation id(String name) { diff --git a/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/UglySteelPlatingItem.java b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/UglySteelPlatingItem.java new file mode 100644 index 0000000..f23b19f --- /dev/null +++ b/shared/src/main/java/net/blay09/mods/forbiddensmoothies/item/UglySteelPlatingItem.java @@ -0,0 +1,27 @@ +package net.blay09.mods.forbiddensmoothies.item; + +import net.blay09.mods.forbiddensmoothies.block.CustomBlockStateProperties; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.context.UseOnContext; + +public class UglySteelPlatingItem extends Item { + public UglySteelPlatingItem(Properties properties) { + super(properties); + } + + @Override + public InteractionResult useOn(UseOnContext context) { + final var level = context.getLevel(); + final var pos = context.getClickedPos(); + final var state = level.getBlockState(pos); + if (state.hasProperty(CustomBlockStateProperties.UGLY)) { + level.setBlockAndUpdate(pos, state.setValue(CustomBlockStateProperties.UGLY, true)); + if (!context.getPlayer().getAbilities().instabuild) { + context.getItemInHand().shrink(1); + } + return InteractionResult.SUCCESS; + } + return super.useOn(context); + } +} diff --git a/shared/src/main/resources/assets/forbiddensmoothies/lang/en_us.json b/shared/src/main/resources/assets/forbiddensmoothies/lang/en_us.json index 7b3544f..2244b5f 100644 --- a/shared/src/main/resources/assets/forbiddensmoothies/lang/en_us.json +++ b/shared/src/main/resources/assets/forbiddensmoothies/lang/en_us.json @@ -1,6 +1,7 @@ { "block.forbiddensmoothies.blender": "Blender", "block.forbiddensmoothies.printer": "Printer", + "item.forbiddensmoothies.ugly_steel_plating": "Ugly Steel Plating", "container.forbiddensmoothies.blender": "Blender", "container.forbiddensmoothies.printer": "Printer", "itemGroup.forbiddensmoothies.forbiddensmoothies": "Forbidden Smoothies", @@ -9,5 +10,6 @@ "tooltip.forbiddensmoothies.unlockInputs": "Unlock Input Slots", "tooltip.forbiddensmoothies.energyStored": "%d FE", "tooltip.forbiddensmoothies.energyConsumed": "Consuming %d FE/t", + "tooltip.forbiddensmoothies.ugly_steel_plating": "Apply to a Blender or Printer to make it ugly.", "config.forbiddensmoothies": "Forbidden Smoothies" } diff --git a/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender.json b/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender.json index 5e81b32..76f2787 100644 --- a/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender.json +++ b/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender.json @@ -5,7 +5,7 @@ "textures": { "0": "forbiddensmoothies:block/blender_glass", "1": "forbiddensmoothies:block/blender_frame", - "particle": "forbiddensmoothies:block/printer_glass" + "particle": "forbiddensmoothies:block/blender_frame" }, "elements": [ { diff --git a/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender_ugly.json b/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender_ugly.json new file mode 100644 index 0000000..3b503ee --- /dev/null +++ b/shared/src/main/resources/assets/forbiddensmoothies/models/block/blender_ugly.json @@ -0,0 +1,6 @@ +{ + "parent": "forbiddensmoothies:block/blender", + "textures": { + "0": "forbiddensmoothies:block/blender_ugly" + } +} \ No newline at end of file diff --git a/shared/src/main/resources/assets/forbiddensmoothies/models/block/printer_ugly.json b/shared/src/main/resources/assets/forbiddensmoothies/models/block/printer_ugly.json new file mode 100644 index 0000000..1b036fa --- /dev/null +++ b/shared/src/main/resources/assets/forbiddensmoothies/models/block/printer_ugly.json @@ -0,0 +1,6 @@ +{ + "parent": "forbiddensmoothies:block/printer", + "textures": { + "0": "forbiddensmoothies:block/printer_ugly" + } +} \ No newline at end of file diff --git a/shared/src/main/resources/assets/forbiddensmoothies/textures/block/blender_ugly.png b/shared/src/main/resources/assets/forbiddensmoothies/textures/block/blender_ugly.png new file mode 100644 index 0000000000000000000000000000000000000000..164f98892127f01fb803c08e5266004b7ccb2c0a GIT binary patch literal 5522 zcmeHKX;c%*77n0*h>8n{!axkNo29dmMS@5Os{sar;2A}e?heF|#dIJngUB|Dpoj~g zB91z!<2EWFD1!JzM!_8fcNumOMP(F4-tamBxAW$Y=e_x7aysd*y7#+vzxwJ{S7uOv z_avj)Mi>lclCO_vF#2zzxeWEuU+aMp0R}T}Ljpfs6)aF=6-v2C91UYt@d_9V$B9K4 zOx(R^i_n7y)U_+0^m6!G>bj}qYsyvgh+D_Q#l$Nn6*l)su#=ri$ zd3AY3LDQ_mZWTQbQX0H0n1X2=pVoJ8nVjg>-EhJ#P+2n59CzNKMbhCY-vkB>umkK% z|IFX>%u%p^(8DjJXm@A)?2Z>Jqi`l?T&-hd1wWua1x3 z|5}ka929WI_~`h%tKZ&49PSTnIlKRvu&XEK`6EeBC2N;f%xW^~EL=#;nO9V4 zDNAOg9hy{-J-=Nm6^{Bm?%x9u%L1zd^n9i+b*|a8 zCgnn|0~7n|N|9lvG1ftcmDOpi@3YO>{iNwCtieN_$9LMF@ZnDX?2ynSQ@JGxis`l~ z^CYIP+okT4Y)#7!^)^Xv9K4)qv8%gK-5wVZarSlZu0c0*>m;LT(KlLCr_8C{g!4ZC z^61p0*_>>^mcct-czpiCImK6&oV>bY*&Aj@l+wvzw=l~r?8gbVdHmCU+_bQ;q)D{q zrh|L7?vUPFI)E>|6YTwK%#%|R^~0T334P)c7jaT$avE*Nk(Za7g8tk|^Ql^H7iDSB zV(5X<6Velp>(>R{Nh`70ROVV>QTRt<`mrE=pYJ;Ov$Inc-d|VN*d-%JZn~J9L2tis z*I5d{r$yB@{AUsuMep4JKVt-O%i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3A(_*(qsH(e3t4%qNz5jVze;;9Y|HS}`qLP&>b!#z+aZL6nmj zDeH~v?vG65YAot&yd1BSSe+YcgGw$H(|^4}`>5R+>X<0eW^1;d>wG!+0Ivw0~Vms|v_3Db-Y=jeodf<9a0KyVZ@ bShdNjBYS?r;?g2uS`kb)AI5Q)u;l*$Z^nU% literal 0 HcmV?d00001 diff --git a/shared/src/main/resources/assets/forbiddensmoothies/textures/item/ugly_steel_plating.png b/shared/src/main/resources/assets/forbiddensmoothies/textures/item/ugly_steel_plating.png new file mode 100644 index 0000000000000000000000000000000000000000..62c1560186ff1b6aeea21a0aa88f20da4aba7dc3 GIT binary patch literal 581 zcmV-L0=oT)P)QESjpTv)IViKwg(V|5}XjOEj8-KbxS9Kv&Az-PtAc_=`LZimS)7W#@ z1>15Lo#ikL^YYHXU%_=<-D0$fXt&$gwvFRB zIF5sq5~UPxZ*P>#WzOd_sZ@&5Xr$lY-;E@Ilu{RqMXJ>*>2w;`b-B8_LI{D@8l@Eb z{hlBQkW!LJBoIOXU;;!@Wca?%a=Aonjg%7GwlPhUAP5MBMrmINtB~+}zwSolfyQkKJx({LdWH#bQz4-QDSIHmkp@{cn)2>uSLIv(^3s3MtdQ TFdLUp00000NkvXXu0mjfh|CbZ literal 0 HcmV?d00001