From e943734a99beb827e678615f976bf37c770b265b Mon Sep 17 00:00:00 2001 From: cech12 Date: Sun, 7 Jul 2024 09:05:45 +0200 Subject: [PATCH] - reflectors can now be placed in the Solar Cooker GUI and are rendered as additional lids - default reflector speed factor was raised to 0.5 - default recipe type of the Solar Cooker was changed to "smelting" - reflector blocks were removed --- CHANGELOG.md | 10 +- .../java/de/cech12/solarcooker/Constants.java | 1 - .../java/de/cech12/solarcooker/ModTags.java | 10 + .../block/AbstractSolarCookerBlock.java | 6 +- .../solarcooker/block/ReflectorBlock.java | 184 ------------------ .../blockentity/SolarCookerBlockEntity.java | 81 ++++---- .../SolarCookerBlockEntityRenderer.java | 70 +++++-- .../inventory/SolarCookerContainer.java | 7 +- .../inventory/SolarCookerReflectorSlot.java | 26 +++ .../solarcooker/item/ReflectorItem.java | 23 +++ .../platform/services/IConfigHelper.java | 8 +- .../assets/solarcooker/lang/de_de.json | 6 +- .../assets/solarcooker/lang/en_us.json | 12 +- .../assets/solarcooker/lang/pt_br.json | 7 +- .../assets/solarcooker/lang/ru_ru.json | 5 +- .../assets/solarcooker/lang/uk_ua.json | 5 +- .../assets/solarcooker/lang/zh_cn.json | 7 +- .../solarcooker/models/block/reflector.json | 64 ------ .../solarcooker/models/block/reflector_2.json | 117 ----------- .../solarcooker/models/block/reflector_l.json | 88 --------- .../solarcooker/models/block/reflector_o.json | 109 ----------- .../solarcooker/models/block/reflector_u.json | 113 ----------- .../models/block/solar_cooker.json | 2 +- .../solarcooker/models/item/reflector.json | 21 +- .../solarcooker/models/item/solar_cooker.json | 2 +- .../textures/block/reflector_back.png | Bin 320 -> 0 bytes .../textures/block/reflector_front.png | Bin 280 -> 0 bytes .../textures/block/reflector_side.png | Bin 334 -> 0 bytes .../textures/entity/solar_cooker.png | Bin 1121 -> 1263 bytes .../entity/solar_cooker_reflector.png | Bin 0 -> 419 bytes .../textures/gui/container/solar_cooker.png | Bin 1425 -> 1585 bytes .../solarcooker/textures/item/reflector.png | Bin 0 -> 417 bytes .../minecraft/tags/block/mineable/axe.json | 3 +- .../loot_table/blocks/reflector.json | 25 --- .../tags/item/solar_cooker_reflector.json | 6 + .../de/cech12/solarcooker/init/ModBlocks.java | 3 - .../de/cech12/solarcooker/init/ModItems.java | 9 +- .../recipes/decorations/reflector.json | 6 +- .../data/solarcooker/recipe/reflector.json | 17 +- .../data/solarcooker/recipe/solar_cooker.json | 10 +- .../de/cech12/solarcooker/init/ModBlocks.java | 4 +- .../de/cech12/solarcooker/init/ModItems.java | 13 +- .../recipes/decorations/reflector.json | 32 +++ .../data/solarcooker/recipe/reflector.json | 17 +- .../data/solarcooker/recipe/solar_cooker.json | 10 +- .../de/cech12/solarcooker/ReflectorTests.java | 65 ------- .../structures/reflector/reflectors.nbt | Bin 291 -> 0 bytes .../structures/reflectortests.north.nbt | Bin 145 -> 0 bytes .../structures/reflectortests.north_east.nbt | Bin 147 -> 0 bytes .../de/cech12/solarcooker/init/ModBlocks.java | 4 +- .../de/cech12/solarcooker/init/ModItems.java | 13 +- .../recipes/decorations/reflector.json | 32 +++ .../data/solarcooker/recipe/reflector.json | 17 +- .../data/solarcooker/recipe/solar_cooker.json | 10 +- 54 files changed, 335 insertions(+), 945 deletions(-) delete mode 100644 common/src/main/java/de/cech12/solarcooker/block/ReflectorBlock.java create mode 100644 common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerReflectorSlot.java create mode 100644 common/src/main/java/de/cech12/solarcooker/item/ReflectorItem.java delete mode 100644 common/src/main/resources/assets/solarcooker/models/block/reflector.json delete mode 100644 common/src/main/resources/assets/solarcooker/models/block/reflector_2.json delete mode 100644 common/src/main/resources/assets/solarcooker/models/block/reflector_l.json delete mode 100644 common/src/main/resources/assets/solarcooker/models/block/reflector_o.json delete mode 100644 common/src/main/resources/assets/solarcooker/models/block/reflector_u.json delete mode 100644 common/src/main/resources/assets/solarcooker/textures/block/reflector_back.png delete mode 100644 common/src/main/resources/assets/solarcooker/textures/block/reflector_front.png delete mode 100644 common/src/main/resources/assets/solarcooker/textures/block/reflector_side.png create mode 100644 common/src/main/resources/assets/solarcooker/textures/entity/solar_cooker_reflector.png create mode 100644 common/src/main/resources/assets/solarcooker/textures/item/reflector.png delete mode 100644 common/src/main/resources/data/solarcooker/loot_table/blocks/reflector.json create mode 100644 common/src/main/resources/data/solarcooker/tags/item/solar_cooker_reflector.json rename {common => fabric}/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json (84%) create mode 100644 forge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json delete mode 100644 forge/src/test/java/de/cech12/solarcooker/ReflectorTests.java delete mode 100644 forge/src/test/resources/data/solarcooker/structures/reflector/reflectors.nbt delete mode 100644 forge/src/test/resources/data/solarcooker/structures/reflectortests.north.nbt delete mode 100644 forge/src/test/resources/data/solarcooker/structures/reflectortests.north_east.nbt create mode 100644 neoforge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 911dd53..6747db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,14 +3,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/). -## [1.21-4.0.0.0] - 2024-06-30 +## [1.21-4.0.0.0] - 2024-07-07 ### Changed - updated to Minecraft 1.21 (Fabric 0.100.3+1.21, Neoforge 21.0.42-beta, Forge 51.0.18) - updated Cloth Config support (15.0.127) (Fabric/Quilt) - updated ModMenu support (11.0.1) (Fabric/Quilt) -- updated JEI support (19.0.0.11) (Forge & NeoForge) +- updated JEI support (19.0.0.11) (all loaders) - updated REI support (16.0.729) (Fabric/Quilt & NeoForge) - updated The One Probe support (1.21_neo-12.0.0) (NeoForge) +- reflectors can now be placed in the Solar Cooker GUI and are rendered as additional lids +- default reflector speed factor was raised to 0.5 (former value was 0.25) (configurable) +- default recipe type of the Solar Cooker was changed to "smelting" (former value was "smoking") (configurable) + +### Removed +- reflector blocks were removed (they will disappear when you update your world from an older version) ## [1.20.6-3.2.0.0] - 2024-06-30 ### Changed diff --git a/common/src/main/java/de/cech12/solarcooker/Constants.java b/common/src/main/java/de/cech12/solarcooker/Constants.java index 8194007..c33d4a0 100644 --- a/common/src/main/java/de/cech12/solarcooker/Constants.java +++ b/common/src/main/java/de/cech12/solarcooker/Constants.java @@ -35,7 +35,6 @@ public class Constants { public static final String SOLAR_COOKER_MENU_NAME = "solarcooker"; public static Supplier SOLAR_COOKER_BLOCK; - public static Supplier REFLECTOR_BLOCK; public static Supplier SHINING_DIAMOND_BLOCK_BLOCK; public static Supplier> SOLAR_COOKER_ENTITY_TYPE; diff --git a/common/src/main/java/de/cech12/solarcooker/ModTags.java b/common/src/main/java/de/cech12/solarcooker/ModTags.java index 3a5048e..9502bbf 100644 --- a/common/src/main/java/de/cech12/solarcooker/ModTags.java +++ b/common/src/main/java/de/cech12/solarcooker/ModTags.java @@ -2,6 +2,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import javax.annotation.Nonnull; @@ -16,4 +17,13 @@ private static TagKey tag(@Nonnull String name) { return TagKey.create(Registries.BLOCK, Constants.id(name)); } } + + public static class Items { + + public static final TagKey SOLAR_COOKER_REFLECTOR = tag("solar_cooker_reflector"); + + private static TagKey tag(@Nonnull String name) { + return TagKey.create(Registries.ITEM, Constants.id(name)); + } + } } diff --git a/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java b/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java index 846bdba..54486f6 100644 --- a/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java +++ b/common/src/main/java/de/cech12/solarcooker/block/AbstractSolarCookerBlock.java @@ -34,12 +34,14 @@ public abstract class AbstractSolarCookerBlock extends BaseEntityBlock { public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty SUNLIT = BlockStateProperties.LIT; public static final BooleanProperty BURNING = BlockStateProperties.ENABLED; + public static final BooleanProperty LEFT_REFLECTOR = BooleanProperty.create("left_reflector"); + public static final BooleanProperty RIGHT_REFLECTOR = BooleanProperty.create("right_reflector"); protected static final VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); protected AbstractSolarCookerBlock(BlockBehaviour.Properties properties) { super(properties); - this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(SUNLIT, false).setValue(BURNING, false)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(SUNLIT, false).setValue(BURNING, false).setValue(LEFT_REFLECTOR, false).setValue(RIGHT_REFLECTOR, false)); } @Override @@ -126,6 +128,6 @@ public BlockState mirror(BlockState state, Mirror mirrorIn) { } protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(FACING, SUNLIT, BURNING); + builder.add(FACING, SUNLIT, BURNING, LEFT_REFLECTOR, RIGHT_REFLECTOR); } } diff --git a/common/src/main/java/de/cech12/solarcooker/block/ReflectorBlock.java b/common/src/main/java/de/cech12/solarcooker/block/ReflectorBlock.java deleted file mode 100644 index 326c686..0000000 --- a/common/src/main/java/de/cech12/solarcooker/block/ReflectorBlock.java +++ /dev/null @@ -1,184 +0,0 @@ -package de.cech12.solarcooker.block; - -import de.cech12.solarcooker.Constants; -import net.minecraft.ChatFormatting; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Rotation; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.IntegerProperty; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; - -import javax.annotation.Nonnull; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.IntStream; - -public class ReflectorBlock extends Block { - public static final IntegerProperty TYPE = IntegerProperty.create("type", 1, 15); - - protected static final List TYPES_WITH_ONE_REFLECTOR = Arrays.asList(1, 2, 4, 8); - protected static final List TYPES_WITH_TWO_REFLECTORS = Arrays.asList(3, 5, 6, 9, 10, 12); - protected static final List TYPES_WITH_THREE_REFLECTORS = Arrays.asList(7, 11, 13, 14); - protected static final List TYPES_WITH_FOUR_REFLECTORS = Collections.singletonList(15); - - protected static final VoxelShape SHAPE_NORTH_WEST = Block.box(0.0D, 0.0D, 0.0D, 5.0D, 16.0D, 5.0D); - protected static final VoxelShape SHAPE_NORTH = Block.box(5.0D, 0.0D, 0.0D, 11.0D, 16.0D, 5.0D); - protected static final VoxelShape SHAPE_NORTH_EAST = Block.box(11.0D, 0.0D, 0.0D, 16.0D, 16.0D, 5.0D); - protected static final VoxelShape SHAPE_EAST = Block.box(11.0D, 0.0D, 5.0D, 16.0D, 16.0D, 11.0D); - protected static final VoxelShape SHAPE_SOUTH_EAST = Block.box(11.0D, 0.0D, 11.0D, 16.0D, 16.0D, 16.0D); - protected static final VoxelShape SHAPE_SOUTH = Block.box(5.0D, 0.0D, 11.0D, 11.0D, 16.0D, 16.0D); - protected static final VoxelShape SHAPE_SOUTH_WEST = Block.box(0.0D, 0.0D, 11.0D, 5.0D, 16.0D, 16.0D); - protected static final VoxelShape SHAPE_WEST = Block.box(0.0D, 0.0D, 5.0D, 5.0D, 16.0D, 11.0D); - protected static final VoxelShape[] SHAPES = makeShapes(); - - private static VoxelShape[] makeShapes() { - return IntStream.range(0, 16).mapToObj((type) -> { - Set shapes = new HashSet<>(); - if ((type | 8) == type) { - shapes.add(SHAPE_NORTH_WEST); - shapes.add(SHAPE_NORTH); - shapes.add(SHAPE_NORTH_EAST); - } - if ((type | 4) == type) { - shapes.add(SHAPE_NORTH_EAST); - shapes.add(SHAPE_EAST); - shapes.add(SHAPE_SOUTH_EAST); - } - if ((type | 2) == type) { - shapes.add(SHAPE_SOUTH_EAST); - shapes.add(SHAPE_SOUTH); - shapes.add(SHAPE_SOUTH_WEST); - } - if ((type | 1) == type) { - shapes.add(SHAPE_SOUTH_WEST); - shapes.add(SHAPE_WEST); - shapes.add(SHAPE_NORTH_WEST); - } - VoxelShape voxelshape = Block.box(0, 0, 0, 0, 0, 0); - for (VoxelShape shape : shapes) { - voxelshape = Shapes.or(voxelshape, shape); - } - return voxelshape; - }).toArray(VoxelShape[]::new); - } - - public static int getType(Direction direction) { - return switch (direction) { - case EAST -> 4; - case SOUTH -> 2; - case WEST -> 1; - default -> 8; //NORTH - }; - } - - public static boolean isFacingTo(BlockState blockstate, Direction direction) { - if (direction != Direction.UP && direction != Direction.DOWN) { - int type = blockstate.getValue(TYPE); - return (type | getType(direction)) == type; - } - return false; - } - - private static int getCount(int type) { - if (TYPES_WITH_ONE_REFLECTOR.contains(type)) { - return 1; - } - if (TYPES_WITH_TWO_REFLECTORS.contains(type)) { - return 2; - } - if (TYPES_WITH_THREE_REFLECTORS.contains(type)) { - return 3; - } - if (TYPES_WITH_FOUR_REFLECTORS.contains(type)) { - return 4; - } - return 1; - } - - public ReflectorBlock(Properties properties) { - super(properties); - this.registerDefaultState(this.defaultBlockState().setValue(TYPE, getType(Direction.NORTH))); - } - - @Override - @Nonnull - public List getDrops(@Nonnull BlockState state, @Nonnull LootParams.Builder context) { - List drops = super.getDrops(state, context); - int count = getCount(state.getValue(TYPE)); - if (!drops.isEmpty() && count > 1) { - //set the count of the dropped reflector blocks - ItemStack stack = drops.get(0); - if (stack.getItem().equals(Constants.REFLECTOR_ITEM.get())) { - stack.setCount(count); - } - } - return drops; - } - - @Override - public void appendHoverText(@Nonnull ItemStack stack, @Nonnull Item.TooltipContext context, @Nonnull List tooltip, @Nonnull TooltipFlag flag) { - super.appendHoverText(stack, context, tooltip, flag); - tooltip.add(Component.translatable("item.solarcooker.reflector.description").withStyle(ChatFormatting.BLUE)); - } - - @Override - @Nonnull - public VoxelShape getShape(@Nonnull BlockState state, @Nonnull BlockGetter worldIn, @Nonnull BlockPos pos, @Nonnull CollisionContext context) { - return SHAPES[state.getValue(TYPE)]; - } - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(TYPE); - } - - @Override - public BlockState getStateForPlacement(BlockPlaceContext context) { - BlockState blockstate = context.getLevel().getBlockState(context.getClickedPos()); - Direction direction = context.getHorizontalDirection().getOpposite(); - if (blockstate.is(this)) { - return blockstate.setValue(TYPE, blockstate.getValue(TYPE) | getType(direction)); - } else { - return this.defaultBlockState().setValue(TYPE, getType(direction)); - } - } - - @Override - public boolean canBeReplaced(@Nonnull BlockState state, BlockPlaceContext context) { - return context.getItemInHand().getItem() == this.asItem() && !isFacingTo(state, context.getHorizontalDirection().getOpposite()) || super.canBeReplaced(state, context); - } - - //@Override //overrides a Forge & Neoforge method - public BlockState rotate(BlockState state, LevelAccessor world, BlockPos pos, Rotation direction) { - int bits; - if (direction == Rotation.CLOCKWISE_90) { - bits = 1; - } else if (direction == Rotation.CLOCKWISE_180) { - bits = 2; - } else if (direction == Rotation.COUNTERCLOCKWISE_90) { - bits = 3; - } else { - return state; - } - int type = state.getValue(TYPE); - int rotated = ((type >> bits) | type << (4 - bits)) & 0xF; - return state.setValue(TYPE, rotated); - } - -} diff --git a/common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java b/common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java index 91f9da5..489168f 100644 --- a/common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java +++ b/common/src/main/java/de/cech12/solarcooker/blockentity/SolarCookerBlockEntity.java @@ -3,8 +3,6 @@ import com.google.common.collect.Lists; import de.cech12.solarcooker.Constants; import de.cech12.solarcooker.ModTags; -import de.cech12.solarcooker.block.AbstractSolarCookerBlock; -import de.cech12.solarcooker.block.ReflectorBlock; import de.cech12.solarcooker.block.SolarCookerBlock; import de.cech12.solarcooker.inventory.SolarCookerContainer; import de.cech12.solarcooker.platform.Services; @@ -57,13 +55,16 @@ public class SolarCookerBlockEntity extends BaseContainerBlockEntity implements public static final int CONTAINER_COOK_TIME = 1; public static final int CONTAINER_COOK_TIME_TOTAL = 2; - private static final int[] SLOTS = new int[]{0, 1}; - private static final int[] SLOTS_UP = new int[]{}; + public static final int INPUT = 0; + public static final int OUTPUT = 1; + public static final int REFLECTOR_LEFT = 2; + public static final int REFLECTOR_RIGHT = 3; - protected static final int INPUT = 0; - protected static final int OUTPUT = 1; + private static final int[] SLOTS = new int[]{INPUT, OUTPUT}; + private static final int[] SLOTS_UP = new int[]{}; + private static final int[] SLOTS_REFLECTORS = new int[]{REFLECTOR_LEFT, REFLECTOR_RIGHT}; - protected NonNullList items = NonNullList.withSize(2, ItemStack.EMPTY); + protected NonNullList items = NonNullList.withSize(4, ItemStack.EMPTY); protected int cookTime; protected int cookTimeTotal; @@ -73,8 +74,9 @@ public class SolarCookerBlockEntity extends BaseContainerBlockEntity implements protected float prevLidAngle; /** The number of players currently using this cooker */ protected int numPlayersUsing; - /** The number of reflectors next to the cooker */ - protected int reflectorCount = 0; + + protected boolean reflectorLeft; + protected boolean reflectorRight; protected final RecipeType specificRecipeType; private final Object2IntOpenHashMap usedRecipes = new Object2IntOpenHashMap<>(); @@ -210,6 +212,7 @@ public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, H public static void tick(Level level, BlockPos pos, BlockState state, SolarCookerBlockEntity entity) { if (level != null) { boolean dirty = false; + entity.updateReflectorStates(); entity.calculateLidAngle(); boolean isSunlit = entity.isSunlit(); if (isSunlit && !entity.items.get(INPUT).isEmpty()) { @@ -233,12 +236,16 @@ public static void tick(Level level, BlockPos pos, BlockState state, SolarCooker boolean isBurning = entity.cookTime > 0; if (!level.isClientSide && - (entity.getBlockState().getValue(SolarCookerBlock.BURNING) != isBurning - || entity.getBlockState().getValue(SolarCookerBlock.SUNLIT) != isSunlit)) { + (state.getValue(SolarCookerBlock.BURNING) != isBurning + || state.getValue(SolarCookerBlock.SUNLIT) != isSunlit + || state.getValue(SolarCookerBlock.LEFT_REFLECTOR) != entity.reflectorLeft + || state.getValue(SolarCookerBlock.RIGHT_REFLECTOR) != entity.reflectorRight)) { dirty = true; - entity.level.setBlock(entity.worldPosition, entity.level.getBlockState(entity.worldPosition) + level.setBlock(entity.worldPosition, state .setValue(SolarCookerBlock.SUNLIT, isSunlit) - .setValue(SolarCookerBlock.BURNING, isBurning), 3); + .setValue(SolarCookerBlock.BURNING, isBurning) + .setValue(SolarCookerBlock.LEFT_REFLECTOR, entity.reflectorLeft) + .setValue(SolarCookerBlock.RIGHT_REFLECTOR, entity.reflectorRight), 3); } if (dirty) { entity.setChanged(); @@ -367,8 +374,8 @@ protected int getRecipeCookTime() { if (rec == null) { return 200; } - this.checkForReflectors(); - double reflectorFactor = (this.reflectorCount > 0) ? 1 - ((1 - Services.CONFIG.getMaxReflectorTimeFactor()) / 4.0D) * this.reflectorCount : 1; + int reflectorCount = this.getReflectorCount(); + double reflectorFactor = (reflectorCount > 0) ? 1D - ((1D - Services.CONFIG.getMaxReflectorTimeFactor()) / (double) SLOTS_REFLECTORS.length) * (double) reflectorCount : 1D; if (this.specificRecipeType.getClass().isInstance(rec.value().getType())) { return (int) (rec.value().getCookingTime() * reflectorFactor); } @@ -402,33 +409,39 @@ protected RecipeHolder getRecipe() { } } - private void checkForReflectors() { - this.reflectorCount = 0; - if (this.level != null) { - BlockState state = this.level.getBlockState(this.worldPosition); - if (state.getBlock() instanceof AbstractSolarCookerBlock) { - Direction facing = state.getValue(AbstractSolarCookerBlock.FACING); - this.reflectorCount += countReflectorsOnSide(facing.getClockWise()); - this.reflectorCount += countReflectorsOnSide(facing.getCounterClockWise()); - } - } + private boolean slotContainsReflector(int slot) { + return this.getItem(slot).is(ModTags.Items.SOLAR_COOKER_REFLECTOR); } - private int countReflectorsOnSide(Direction direction) { + private int getReflectorCount() { int count = 0; - if (this.level != null) { - BlockPos blockPos = this.worldPosition.relative(direction); - for (BlockPos position : new BlockPos[] {blockPos, blockPos.above()}) { - BlockState state = this.level.getBlockState(position); - if (state.getBlock() instanceof ReflectorBlock - && ReflectorBlock.isFacingTo(state, direction.getOpposite())) { - count++; - } + for (int slot : SLOTS_REFLECTORS) { + if (this.slotContainsReflector(slot)) { + count++; } } return count; } + private void updateReflectorStates() { + boolean slotValue = slotContainsReflector(REFLECTOR_LEFT); + if (this.reflectorLeft != slotValue) { + this.reflectorLeft = slotValue; + } + slotValue = slotContainsReflector(REFLECTOR_RIGHT); + if (this.reflectorRight != slotValue) { + this.reflectorRight = slotValue; + } + } + + public boolean hasLeftReflector() { + return this.reflectorLeft; + } + + public boolean hasRightReflector() { + return this.reflectorRight; + } + @Override @Nonnull public int[] getSlotsForFace(@Nonnull Direction side) { diff --git a/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java b/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java index c338355..4349199 100644 --- a/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java +++ b/common/src/main/java/de/cech12/solarcooker/client/SolarCookerBlockEntityRenderer.java @@ -32,13 +32,18 @@ public class SolarCookerBlockEntityRenderer implements BlockEntityRenderer { public static final ResourceLocation TEXTURE = Constants.id("textures/entity/solar_cooker.png"); + public static final ResourceLocation TEXTURE_REFLECTOR = Constants.id("textures/entity/solar_cooker_reflector.png"); private static final LayerDefinition innerCube = createInnerLayerDefinition(); + private static final LayerDefinition reflectorLeftCube = createReflectorLayerDefinition(true); + private static final LayerDefinition reflectorRightCube = createReflectorLayerDefinition(false); private final ModelPart lid; private final ModelPart bottom; private final ModelPart inner; private final ModelPart lock; + private final ModelPart reflectorLeft; + private final ModelPart reflectorRight; private static LayerDefinition createInnerLayerDefinition() { MeshDefinition meshdefinition = new MeshDefinition(); @@ -47,12 +52,23 @@ private static LayerDefinition createInnerLayerDefinition() { return LayerDefinition.create(meshdefinition, 64, 64); } + private static LayerDefinition createReflectorLayerDefinition(boolean left) { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + float offset = left ? 0F : 13.998F; + float rotation = left ? 0F : (float) Math.PI; + partdefinition.addOrReplaceChild("reflector", CubeListBuilder.create().texOffs(0, 0).addBox(0, 0, 0, 6.999F, 1.0F, 13.998F), PartPose.offsetAndRotation(1.001F + offset, 10.001F, 1.001F + offset, 0, rotation, 0)); + return LayerDefinition.create(meshdefinition, 42, 15); + } + public SolarCookerBlockEntityRenderer(BlockEntityRendererProvider.Context rendererProvider) { ModelPart modelpart = rendererProvider.bakeLayer(ModelLayers.CHEST); this.bottom = modelpart.getChild("bottom"); this.lid = modelpart.getChild("lid"); this.lock = modelpart.getChild("lock"); this.inner = innerCube.bakeRoot().getChild("inner"); + this.reflectorLeft = reflectorLeftCube.bakeRoot().getChild("reflector"); + this.reflectorRight = reflectorRightCube.bakeRoot().getChild("reflector"); } @Override @@ -62,24 +78,28 @@ public void render(SolarCookerBlockEntity blockEntity, float partialTicks, @Nonn BlockState blockstate = isInWorld ? blockEntity.getBlockState() : Constants.SOLAR_COOKER_BLOCK.get().defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockstate.getBlock(); if (block instanceof AbstractSolarCookerBlock) { - //AbstractSolarCookerBlock abstractBlock = (AbstractSolarCookerBlock)block; matrixStackIn.pushPose(); float f = blockstate.getValue(AbstractSolarCookerBlock.FACING).toYRot(); matrixStackIn.translate(0.5D, 0.5D, 0.5D); matrixStackIn.mulPose(Axis.YP.rotationDegrees(-f)); matrixStackIn.translate(-0.5D, -0.5D, -0.5D); - VertexConsumer ivertexbuilder = bufferIn.getBuffer(RenderType.entityTranslucent(TEXTURE)); + VertexConsumer vertexConsumer = bufferIn.getBuffer(RenderType.entityTranslucent(TEXTURE)); float lidAngle = blockEntity.getOpenNess(partialTicks); - this.renderModels(matrixStackIn, ivertexbuilder, this.lid, this.lock, this.bottom, this.inner, lidAngle, combinedLightIn, combinedOverlayIn); - - //render item - if (isInWorld) { - ItemStack stack = blockEntity.getItem(0); - if (!stack.isEmpty()) { - matrixStackIn.pushPose(); - matrixStackIn.translate(0.5, 0.4, 0.5); - Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, world, 0); - matrixStackIn.popPose(); + this.renderModels(matrixStackIn, vertexConsumer, lidAngle, combinedLightIn, combinedOverlayIn); + if (lidAngle > 0) { + if (blockEntity.hasLeftReflector() || blockEntity.hasRightReflector()) { + vertexConsumer = bufferIn.getBuffer(RenderType.entityTranslucent(TEXTURE_REFLECTOR)); + this.renderReflectors(matrixStackIn, vertexConsumer, blockEntity.hasLeftReflector(), blockEntity.hasRightReflector(), lidAngle, combinedLightIn, combinedOverlayIn); + } + //render item + if (isInWorld) { + ItemStack stack = blockEntity.getItem(0); + if (!stack.isEmpty()) { + matrixStackIn.pushPose(); + matrixStackIn.translate(0.5, 0.4, 0.5); + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn, world, 0); + matrixStackIn.popPose(); + } } } @@ -87,12 +107,24 @@ public void render(SolarCookerBlockEntity blockEntity, float partialTicks, @Nonn } } - private void renderModels(PoseStack matrixStackIn, VertexConsumer bufferIn, ModelPart chestLid, ModelPart chestLatch, ModelPart chestBottom, ModelPart chestInner, float lidAngle, int combinedLightIn, int combinedOverlayIn) { - chestLid.xRot = -(lidAngle * ((float)Math.PI / 2F)); - chestLatch.xRot = chestLid.xRot; - chestLid.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); - chestLatch.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); - chestBottom.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); - chestInner.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + private void renderModels(PoseStack matrixStackIn, VertexConsumer bufferIn, float lidAngle, int combinedLightIn, int combinedOverlayIn) { + this.lid.xRot = -(lidAngle * ((float)Math.PI / 2F)); + this.lock.xRot = this.lid.xRot; + this.lid.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + this.lock.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + this.bottom.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + this.inner.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + } + + private void renderReflectors(PoseStack matrixStackIn, VertexConsumer bufferIn, boolean hasLeftReflector, boolean hasRightReflector, float lidAngle, int combinedLightIn, int combinedOverlayIn) { + float angle = (lidAngle * ((float)Math.PI / 1.8F)); + if (hasLeftReflector) { + this.reflectorLeft.zRot = angle; + this.reflectorLeft.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + } + if (hasRightReflector) { + this.reflectorRight.zRot = -angle; + this.reflectorRight.render(matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn); + } } } diff --git a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java index 91ed1db..8b05114 100644 --- a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java +++ b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerContainer.java @@ -29,7 +29,7 @@ public SolarCookerContainer(RecipeType specific Inventory playerInventoryIn, Container cooker, ContainerData data) { super(Constants.SOLAR_COOKER_MENU_TYPE.get(), id); this.specificRecipeType = specificRecipeTypeIn; - AbstractContainerMenu.checkContainerSize(cooker, 2); + AbstractContainerMenu.checkContainerSize(cooker, 4); this.cooker = cooker; this.data = data; cooker.startOpen(playerInventoryIn.player); @@ -38,6 +38,9 @@ public SolarCookerContainer(RecipeType specific //add cooker inventory slots this.addSlot(new Slot(cooker, 0, 56, 17)); this.addSlot(new SolarCookerResultSlot(playerInventoryIn.player, cooker, 1, 116, 35)); + //add reflector slots + this.addSlot(new SolarCookerReflectorSlot(cooker, 2, 153, 7)); + this.addSlot(new SolarCookerReflectorSlot(cooker, 3, 153, 25)); //add player inventory for(int playerInvRow = 0; playerInvRow < 3; ++playerInvRow) { @@ -53,7 +56,7 @@ public SolarCookerContainer(RecipeType specific } public SolarCookerContainer(RecipeType specificRecipeTypeIn, int id, Inventory playerInventoryIn) { - this(specificRecipeTypeIn, id, playerInventoryIn, new SimpleContainer(2), new SimpleContainerData(3)); + this(specificRecipeTypeIn, id, playerInventoryIn, new SimpleContainer(4), new SimpleContainerData(3)); } @Override diff --git a/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerReflectorSlot.java b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerReflectorSlot.java new file mode 100644 index 0000000..1ba8ca5 --- /dev/null +++ b/common/src/main/java/de/cech12/solarcooker/inventory/SolarCookerReflectorSlot.java @@ -0,0 +1,26 @@ +package de.cech12.solarcooker.inventory; + +import de.cech12.solarcooker.ModTags; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; + +import javax.annotation.Nonnull; + +public class SolarCookerReflectorSlot extends Slot { + + public SolarCookerReflectorSlot(Container inventoryIn, int slotIndex, int xPosition, int yPosition) { + super(inventoryIn, slotIndex, xPosition, yPosition); + } + + @Override + public boolean mayPlace(@Nonnull ItemStack stack) { + return stack.is(ModTags.Items.SOLAR_COOKER_REFLECTOR); + } + + @Override + public int getMaxStackSize() { + return 1; + } + +} diff --git a/common/src/main/java/de/cech12/solarcooker/item/ReflectorItem.java b/common/src/main/java/de/cech12/solarcooker/item/ReflectorItem.java new file mode 100644 index 0000000..570198e --- /dev/null +++ b/common/src/main/java/de/cech12/solarcooker/item/ReflectorItem.java @@ -0,0 +1,23 @@ +package de.cech12.solarcooker.item; + +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; + +import javax.annotation.Nonnull; +import java.util.List; + +public class ReflectorItem extends Item { + + public ReflectorItem(Properties properties) { + super(properties); + } + + @Override + public void appendHoverText(@Nonnull ItemStack stack, @Nonnull TooltipContext context, @Nonnull List tooltip, @Nonnull TooltipFlag flag) { + super.appendHoverText(stack, context, tooltip, flag); + tooltip.add(Component.translatable("item.solarcooker.reflector.description").withStyle(ChatFormatting.BLUE)); + } +} diff --git a/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java b/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java index 6a9e526..9e782ac 100644 --- a/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java +++ b/common/src/main/java/de/cech12/solarcooker/platform/services/IConfigHelper.java @@ -15,9 +15,9 @@ public interface IConfigHelper { String VANILLA_RECIPES_ENABLED_DESCRIPTION = "If enabled, the vanilla blasting, smelting, or smoking recipes are used by the solar cooker."; /** Default value of the vanilla recipe type option */ - RecipeType VANILLA_RECIPE_TYPE_DEFAULT = RecipeType.SMOKING; + RecipeType VANILLA_RECIPE_TYPE_DEFAULT = RecipeType.SMELTING; /** Config description of the vanilla recipe type option */ - String VANILLA_RECIPE_TYPE_DESCRIPTION = "Defines which vanilla recipes the solar cooker can use. Possible values: \"smoking\" (default), \"smelting\", \"blasting\", \"campfire_cooking\""; + String VANILLA_RECIPE_TYPE_DESCRIPTION = "Defines which vanilla recipes the solar cooker can use. Possible values: \"smelting\" (default),\"smoking\", \"blasting\", \"campfire_cooking\""; /** Default value of the cook time factor option */ double COOK_TIME_FACTOR_DEFAULT = 4D; @@ -29,9 +29,9 @@ public interface IConfigHelper { double COOK_TIME_FACTOR_MAX = 100D; /** Default value of the max reflector time factor option */ - double MAX_REFLECTOR_TIME_FACTOR_DEFAULT = 0.25D; + double MAX_REFLECTOR_TIME_FACTOR_DEFAULT = 0.5D; /** Config description of the max reflector time factor option */ - String MAX_REFLECTOR_TIME_FACTOR_DESCRIPTION = "Speed factor when all 4 reflectors are placed next to the solar cooker. (i. e. 0.5 - half the time, 1.0 same time)"; + String MAX_REFLECTOR_TIME_FACTOR_DESCRIPTION = "Speed factor when all reflector slots are filled in the solar cooker. (i. e. 0.5 - half the time, 1.0 same time)"; /** Minimal value of the max reflector time factor option */ double MAX_REFLECTOR_TIME_FACTOR_MIN = 0D; /** Maximal value of the max reflector time factor option */ diff --git a/common/src/main/resources/assets/solarcooker/lang/de_de.json b/common/src/main/resources/assets/solarcooker/lang/de_de.json index a43e075..e7e8229 100644 --- a/common/src/main/resources/assets/solarcooker/lang/de_de.json +++ b/common/src/main/resources/assets/solarcooker/lang/de_de.json @@ -1,8 +1,8 @@ { "block.solarcooker.solar_cooker": "Solarkocher", - "block.solarcooker.reflector": "Reflektor", "block.solarcooker.shining_diamond_block": "Strahlender Diamantblock", - "item.solarcooker.reflector.description": "Links und rechts neben einem Solarkocher können bis zu vier Reflektoren platziert werden, um den Lichteinfall zu verbessern und die Kochzeit zu reduzieren.", - "item.solarcooker.shining_diamond_block.description": "Shine bright! Kann über einem Solarkocher platziert werden, um ihn unabhängig von der Sonne zu nutzen.", + "item.solarcooker.reflector": "Reflektor", + "item.solarcooker.reflector.description": "Bis zu zwei Reflektoren können im Solarkocher platziert werden, um den Lichteinfall zu verbessern und die Kochzeit zu reduzieren.", + "item.solarcooker.shining_diamond_block.description": "Shine bright! Kann über einem Solarkocher platziert werden, um ihn unabhängig von der Sonne zu nutzen." } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/en_us.json b/common/src/main/resources/assets/solarcooker/lang/en_us.json index 1cfd8e1..a63ef26 100644 --- a/common/src/main/resources/assets/solarcooker/lang/en_us.json +++ b/common/src/main/resources/assets/solarcooker/lang/en_us.json @@ -1,9 +1,9 @@ { "block.solarcooker.solar_cooker": "Solar Cooker", - "block.solarcooker.reflector": "Reflector", "block.solarcooker.shining_diamond_block": "Shining Block of Diamond", - "item.solarcooker.reflector.description": "Up to four Reflectors can be placed to the left and right side of a Solar Cooker to improve the incidence of light and reduce cooking time.", + "item.solarcooker.reflector": "Reflector", + "item.solarcooker.reflector.description": "Up to two Reflectors can be placed into a Solar Cooker to improve the incidence of light and reduce cooking time.", "item.solarcooker.shining_diamond_block.description": "Shine bright! Can be placed above a Solar Cooker to use it independently of the sun.", "text.autoconfig.solarcooker.title": "Solar Cooker Settings", @@ -18,7 +18,7 @@ "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[0]": "§6§lVanilla Recipe Type", "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[1]": "Defines which vanilla recipes the solar cooker can use.", "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[2]": "§7§oPossible values: smoking, smelting, blasting, campfire_cooking", - "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smoking", + "text.autoconfig.solarcooker.option.VANILLA_RECIPE_TYPE.@Tooltip[3]": "§7§oDefault: smelting", "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR": "Cook time factor", "text.autoconfig.solarcooker.option.COOK_TIME_FACTOR.@Tooltip[0]": "§6§lCook time factor", @@ -29,10 +29,10 @@ "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR": "Max Reflector time factor", "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[0]": "§6§lMax Reflector time factor", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when all 4 reflectors are placed", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "next to the solar cooker. (percent)", + "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[1]": "Speed factor when reflector slots are filled", + "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[2]": "in the solar cooker. (percent)", "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[3]": "§7§o50 - half the time, 100 same time", - "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 25", + "text.autoconfig.solarcooker.option.MAX_REFLECTOR_TIME_FACTOR.@Tooltip[4]": "§7§oDefault: 50", "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST": "Recipe blocked list", "text.autoconfig.solarcooker.option.RECIPE_BLOCKED_LIST.@Tooltip[0]": "§6§lRecipe blocked list", diff --git a/common/src/main/resources/assets/solarcooker/lang/pt_br.json b/common/src/main/resources/assets/solarcooker/lang/pt_br.json index e0f9228..fd8e4a1 100644 --- a/common/src/main/resources/assets/solarcooker/lang/pt_br.json +++ b/common/src/main/resources/assets/solarcooker/lang/pt_br.json @@ -1,8 +1,7 @@ { "block.solarcooker.solar_cooker": "Fogão Solar", - "block.solarcooker.reflector": "Refletor", "block.solarcooker.shining_diamond_block": "Bloco brilhante de diamante", - - "item.solarcooker.reflector.description": "Até quatro Refletores podem ser colocados à esquerda e à direita de um Fogão Solar para melhorar a incidência de luz e reduzir o tempo de cozimento.", - "item.solarcooker.shining_diamond_block.description": "Brilhar! Pode ser colocado por cima de um Fogão Solar para o utilizar independentemente do sol.", + + "item.solarcooker.reflector": "Refletor", + "item.solarcooker.shining_diamond_block.description": "Brilhar! Pode ser colocado por cima de um Fogão Solar para o utilizar independentemente do sol." } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/ru_ru.json b/common/src/main/resources/assets/solarcooker/lang/ru_ru.json index 2d7892e..08008ae 100644 --- a/common/src/main/resources/assets/solarcooker/lang/ru_ru.json +++ b/common/src/main/resources/assets/solarcooker/lang/ru_ru.json @@ -1,8 +1,7 @@ { "block.solarcooker.solar_cooker": "Солнечная плита", - "block.solarcooker.reflector": "Светоотражатель", "block.solarcooker.shining_diamond_block": "Сияющий алмазный блок", - "item.solarcooker.reflector.description": "Для увеличения падения света и сокращения времени готовки, по левому и правому бокам солнечной плиты можно установить до четырёх светоотражателей.", - "item.solarcooker.shining_diamond_block.description": "Блестит ярко! Может быть поставлен над солнечной плитой для её использования независимо от солнца.", + "item.solarcooker.reflector": "Светоотражатель", + "item.solarcooker.shining_diamond_block.description": "Блестит ярко! Может быть поставлен над солнечной плитой для её использования независимо от солнца." } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/uk_ua.json b/common/src/main/resources/assets/solarcooker/lang/uk_ua.json index 609bb2d..6adbbb2 100644 --- a/common/src/main/resources/assets/solarcooker/lang/uk_ua.json +++ b/common/src/main/resources/assets/solarcooker/lang/uk_ua.json @@ -1,8 +1,7 @@ { "block.solarcooker.solar_cooker": "Сонячна плита", - "block.solarcooker.reflector": "Світловідбивач", "block.solarcooker.shining_diamond_block": "Сяючий алмазний блок", - "item.solarcooker.reflector.description": "Заради збільшення падіння світла та скорочення часу приготування, по лівому та правому боках сонячної плити можна встановити до чотирьох світловідбивачів.", - "item.solarcooker.shining_diamond_block.description": "Блищить яскраво! Може бути встановлений над сонячною плитою заради її використання незалежно від сонця.", + "item.solarcooker.reflector": "Світловідбивач", + "item.solarcooker.shining_diamond_block.description": "Блищить яскраво! Може бути встановлений над сонячною плитою заради її використання незалежно від сонця." } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/lang/zh_cn.json b/common/src/main/resources/assets/solarcooker/lang/zh_cn.json index 6df06c8..36850fd 100644 --- a/common/src/main/resources/assets/solarcooker/lang/zh_cn.json +++ b/common/src/main/resources/assets/solarcooker/lang/zh_cn.json @@ -1,8 +1,7 @@ { "block.solarcooker.solar_cooker": " 太阳灶", - "block.solarcooker.reflector": "反光板", "block.solarcooker.shining_diamond_block": "闪耀的钻石块", - - "item.solarcooker.reflector.description": "在太阳灶的左右两侧最多可以放置四个反射板来改善光线的入射以及减少烹饪时间。", - "item.solarcooker.shining_diamond_block.description": "闪闪放光芒!可以放置在一个太阳灶上方,独立于太阳使用。", + + "item.solarcooker.reflector": "反光板", + "item.solarcooker.shining_diamond_block.description": "闪闪放光芒!可以放置在一个太阳灶上方,独立于太阳使用。" } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/models/block/reflector.json b/common/src/main/resources/assets/solarcooker/models/block/reflector.json deleted file mode 100644 index 7cd5a51..0000000 --- a/common/src/main/resources/assets/solarcooker/models/block/reflector.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "parent": "minecraft:block/block", - "textures": { - "bottom": "solarcooker:block/reflector_back", - "top": "solarcooker:block/reflector_front", - "side": "solarcooker:block/reflector_side", - "particle": "solarcooker:block/reflector_back" - }, - "elements": [ - { - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 5 - ], - "faces": { - "down": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 90 - }, - "up": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 270 - }, - "north": { - "texture": "#top" - }, - "south": { - "texture": "#bottom" - }, - "west": { - "texture": "#side" - }, - "east": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 180 - } - } - } - ] -} diff --git a/common/src/main/resources/assets/solarcooker/models/block/reflector_2.json b/common/src/main/resources/assets/solarcooker/models/block/reflector_2.json deleted file mode 100644 index ee9135b..0000000 --- a/common/src/main/resources/assets/solarcooker/models/block/reflector_2.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "parent": "minecraft:block/block", - "textures": { - "bottom": "solarcooker:block/reflector_back", - "top": "solarcooker:block/reflector_front", - "side": "solarcooker:block/reflector_side", - "particle": "solarcooker:block/reflector_back" - }, - "elements": [ - { - "from": [ - 0, - 0, - 0 - ], - "to": [ - 16, - 16, - 5 - ], - "faces": { - "down": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 90 - }, - "up": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 270 - }, - "north": { - "texture": "#top" - }, - "south": { - "texture": "#bottom" - }, - "west": { - "texture": "#side" - }, - "east": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 180 - } - } - }, - { - "from": [ - 0, - 0, - 11 - ], - "to": [ - 16, - 16, - 16 - ], - "faces": { - "down": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 270 - }, - "up": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 90 - }, - "north": { - "texture": "#bottom" - }, - "south": { - "texture": "#top" - }, - "west": { - "texture": "#side", - "uv": [ - 0.0, - 0.0, - 5.0, - 16.0 - ], - "rotation": 180 - }, - "east": { - "texture": "#side" - } - } - } - ] -} diff --git a/common/src/main/resources/assets/solarcooker/models/block/reflector_l.json b/common/src/main/resources/assets/solarcooker/models/block/reflector_l.json deleted file mode 100644 index 8cf43d4..0000000 --- a/common/src/main/resources/assets/solarcooker/models/block/reflector_l.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "parent": "minecraft:block/block", - "textures": { - "bottom": "solarcooker:block/reflector_back", - "top": "solarcooker:block/reflector_front", - "side": "solarcooker:block/reflector_side", - "particle": "solarcooker:block/reflector_back" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [11, 16, 5], - "faces": { - "down": { - "texture": "#side", - "uv": [0.0, 0.0, 5.0, 11.0], - "rotation": 270 - }, - "up": { - "texture": "#side", - "uv": [0.0, 5.0, 5.0, 16.0], - "rotation": 90 - }, - "north": { - "texture": "#top" - }, - "south": { - "texture": "#bottom" - }, - "west": { - "texture": "#side" - } - } - }, - { - "from": [11, 0, 0], - "to": [16, 16, 11], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0], - "rotation": 180 - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0], - "rotation": 180 - }, - "north": { - "texture": "#top" - }, - "west": { - "texture": "#bottom" - }, - "east": { - "texture": "#top" - } - } - }, - { - "from": [11, 0, 11], - "to": [16, 16, 16], - "faces": { - "down": { - "texture": "#side", - "uv": [0.0, 11.0, 5.0, 16.0], - "rotation": 180 - }, - "up": { - "texture": "#side", - "uv": [0.0, 0.0, 5.0, 5.0], - "rotation": 180 - }, - "south": { - "texture": "#side", - "uv": [0.0, 0.0, 5.0, 16.0], - "rotation": 180 - }, - "west": { - "texture": "#bottom" - }, - "east": { - "texture": "#top" - } - } - } - ] -} diff --git a/common/src/main/resources/assets/solarcooker/models/block/reflector_o.json b/common/src/main/resources/assets/solarcooker/models/block/reflector_o.json deleted file mode 100644 index 4f38ae8..0000000 --- a/common/src/main/resources/assets/solarcooker/models/block/reflector_o.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "parent": "minecraft:block/block", - "textures": { - "bottom": "solarcooker:block/reflector_back", - "top": "solarcooker:block/reflector_front", - "side": "solarcooker:block/reflector_side", - "particle": "solarcooker:block/reflector_back" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [11, 16, 5], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0], - "rotation": 270 - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0], - "rotation": 90 - }, - "north": { - "texture": "#top" - }, - "south": { - "texture": "#bottom" - }, - "west": { - "texture": "#top" - } - } - }, - { - "from": [11, 0, 0], - "to": [16, 16, 11], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0], - "rotation": 180 - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0], - "rotation": 180 - }, - "north": { - "texture": "#top" - }, - "west": { - "texture": "#bottom" - }, - "east": { - "texture": "#top" - } - } - }, - { - "from": [5, 0, 11], - "to": [16, 16, 16], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0], - "rotation": 90 - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0], - "rotation": 270 - }, - "north": { - "texture": "#bottom" - }, - "south": { - "texture": "#top" - }, - "east": { - "texture": "#top" - } - } - }, - { - "from": [0, 0, 5], - "to": [5, 16, 16], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0] - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0] - }, - "south": { - "texture": "#top" - }, - "west": { - "texture": "#top" - }, - "east": { - "texture": "#bottom" - } - } - } - ] -} diff --git a/common/src/main/resources/assets/solarcooker/models/block/reflector_u.json b/common/src/main/resources/assets/solarcooker/models/block/reflector_u.json deleted file mode 100644 index b7eb283..0000000 --- a/common/src/main/resources/assets/solarcooker/models/block/reflector_u.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "parent": "minecraft:block/block", - "textures": { - "bottom": "solarcooker:block/reflector_back", - "top": "solarcooker:block/reflector_front", - "side": "solarcooker:block/reflector_side", - "particle": "solarcooker:block/reflector_back" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [11, 16, 5], - "faces": { - "down": { - "texture": "#side", - "uv": [0.0, 0.0, 5.0, 11.0], - "rotation": 270 - }, - "up": { - "texture": "#side", - "uv": [0.0, 5.0, 5.0, 16.0], - "rotation": 90 - }, - "north": { - "texture": "#top" - }, - "south": { - "texture": "#bottom" - }, - "west": { - "texture": "#side" - } - } - }, - { - "from": [11, 0, 0], - "to": [16, 16, 11], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0], - "rotation": 180 - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0], - "rotation": 180 - }, - "north": { - "texture": "#top" - }, - "west": { - "texture": "#bottom" - }, - "east": { - "texture": "#top" - } - } - }, - { - "from": [5, 0, 11], - "to": [16, 16, 16], - "faces": { - "down": { - "texture": "#side", - "uv": [5.0, 0.0, 10.0, 11.0], - "rotation": 90 - }, - "up": { - "texture": "#side", - "uv": [5.0, 5.0, 10.0, 16.0], - "rotation": 270 - }, - "north": { - "texture": "#bottom" - }, - "south": { - "texture": "#top" - }, - "east": { - "texture": "#top" - } - } - }, - { - "from": [0, 0, 11], - "to": [5, 16, 16], - "faces": { - "down": { - "texture": "#side", - "uv": [0.0, 11.0, 5.0, 16.0], - "rotation": 90 - }, - "up": { - "texture": "#side", - "uv": [0.0, 0.0, 5.0, 5.0], - "rotation": 270 - }, - "north": { - "texture": "#bottom" - }, - "south": { - "texture": "#top" - }, - "west": { - "texture": "#side", - "uv": [0.0, 0.0, 5.0, 16.0], - "rotation": 180 - } - } - } - ] -} diff --git a/common/src/main/resources/assets/solarcooker/models/block/solar_cooker.json b/common/src/main/resources/assets/solarcooker/models/block/solar_cooker.json index a848717..3f153f3 100644 --- a/common/src/main/resources/assets/solarcooker/models/block/solar_cooker.json +++ b/common/src/main/resources/assets/solarcooker/models/block/solar_cooker.json @@ -1,5 +1,5 @@ { "textures": { - "particle": "solarcooker:block/reflector_back" + "particle": "minecraft:block/oak_planks" } } diff --git a/common/src/main/resources/assets/solarcooker/models/item/reflector.json b/common/src/main/resources/assets/solarcooker/models/item/reflector.json index db0c19e..00f784f 100644 --- a/common/src/main/resources/assets/solarcooker/models/item/reflector.json +++ b/common/src/main/resources/assets/solarcooker/models/item/reflector.json @@ -1,23 +1,6 @@ { - "parent": "solarcooker:block/reflector", + "parent": "item/generated", "textures": { - "particle": "solarcooker:block/reflector_back" - }, - "display": { - "gui": { - "rotation": [ 30, 225, 0 ], - "translation": [ -2.5, 1, 0], - "scale":[ 0.625, 0.625, 0.625 ] - }, - "thirdperson_righthand": { - "rotation": [ 75, 135, 0 ], - "translation": [ 0, 2.5, 0], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "firstperson_righthand": { - "rotation": [ 0, 135, 0 ], - "translation": [ 0, 0, 0], - "scale": [ 0.4, 0.4, 0.4 ] - } + "layer0": "solarcooker:item/reflector" } } \ No newline at end of file diff --git a/common/src/main/resources/assets/solarcooker/models/item/solar_cooker.json b/common/src/main/resources/assets/solarcooker/models/item/solar_cooker.json index 379bec3..d496b43 100644 --- a/common/src/main/resources/assets/solarcooker/models/item/solar_cooker.json +++ b/common/src/main/resources/assets/solarcooker/models/item/solar_cooker.json @@ -1,7 +1,7 @@ { "parent": "builtin/entity", "textures": { - "particle": "solarcooker:block/reflector_back" + "particle": "minecraft:block/oak_planks" }, "display": { "gui": { diff --git a/common/src/main/resources/assets/solarcooker/textures/block/reflector_back.png b/common/src/main/resources/assets/solarcooker/textures/block/reflector_back.png deleted file mode 100644 index 4888255200e71ab3f6a9ad40e6bf005b5b818a3d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 320 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}Z0G|-o?(XjC)2GjvF=NVNA=R_})UIv4GktxS#^oEv zpDp+-&eaM?b9I#19_sS?^-l0ZiKc-}BMUp@^+kpEI?@jK8(d(W*tW!a*A#`W0_9{= z=UqR1CMEv2lrvqtP(Sf*{1;V*uJ+8LS)Qj;#A1&|iyoGE^q#+KGpCr@7Zx?3+Za4u L{an^LB{Ts5Yk6~? diff --git a/common/src/main/resources/assets/solarcooker/textures/block/reflector_front.png b/common/src/main/resources/assets/solarcooker/textures/block/reflector_front.png deleted file mode 100644 index 82208508ea1a548dc574f3b93c5121e59556fb89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 280 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPF!-S6|(AU$9GSxsiv{61Aq1wQ+l^`2)lQ*fdzLo3=je@?PPUu_9ZBA+gp$ V@R;4xSwQ<4JYD@<);T3K0RRPoaHjwO diff --git a/common/src/main/resources/assets/solarcooker/textures/block/reflector_side.png b/common/src/main/resources/assets/solarcooker/textures/block/reflector_side.png deleted file mode 100644 index 396bc4d95b079178f93ca529c67fb46113b80e70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 334 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}}0G|-oY15{4c6N4mclY%4G&D3UTefV~s#Uu>Y_`_u&MUE)TduvS!E{5V z;etZL88c?|E!XXvy4Srg7mK6 z-g`xBQ;le5g+XjJQx5~P(3N?~>1rmk4}WIPNnpx4Y-q!{JgH7tq3iKe&lh*za;}*B zyprk1wCI3Q%H<{7%*Jhv-7(8A5T-G@y GGywp*n1-_e diff --git a/common/src/main/resources/assets/solarcooker/textures/entity/solar_cooker.png b/common/src/main/resources/assets/solarcooker/textures/entity/solar_cooker.png index 9d6b6aeb03e3c25da64e766bcea0f5e1f7625a34..8e1a448aa6890961476fcaf06949934e4cad234c 100644 GIT binary patch delta 1020 zcmVH7Bye-{fiAF)GiCUs6Qpbarascl& zxDOh5axhp0ltHR_ou)A(jpt4Xt)3&Wky0uZ(u=U|GHd~MSc6L`LxNQFCU!QHK6XoJ z*hUE@)il_oX-#L2k6aw@&$7ea;iG0!E~4v2B!a0qFO+|)`?KufaCp!R0%5StD()8D z@%i3nnU{U~+_13qK<*j4FZ9~&_TyQoAb?~7<3}0*&>do80W)Fgw6aoOf$k7f*Dw>JUJgiL*%RmvF=>Y|PM|x)loi6NC$Ng5 zWpv@@pfi8O#0+La5JSb03)*3%Kt5F4t(ZY%jP$zBfFc}`)GQx5DZI3bwR2o7|I zm|cZguMg&B9M3&{(4fhI9fF$!Syy=x_gmQ>Vi<6GM7tq`GGzhRgYhFRRB4qJi3q+< zzfBn%eT`?Kin&r@u$d<*4j_*$izS0B4C5-#DTIGbqGu5$o*H03p3$wl31M2|@Nom) z+l;2*0HfO$C6NTSDK`xZ(*f9zXOx4ruEI8^)5FJ?8+bRKQ5DwIY$TBAqnB~_)8rk^ z*n=WZE`sUzvMlSmruVYEw^{9DKkn{+YNl_T+{&Bd@%ZcU@sXC_$NgFM^z`&cGjkeW zeQ$q6M_R4?*8qk=v`51dFz03k!yr5Yc($Q?2n>VpJfSoZ8yEq^P1QpJ2tFJ3 z8<gVZVWSQq|v%0QUEwLuf!8h1UqdwPAk`0T-{SUh6D7-nU_Y4{sEL qb`&4l5F8u!_h2>B>+rt?PN#oeUp#`>9#?Vz0000EkK^?A8OjJbx0086TpH z_DMuRR9HvFSBrMqFboag&YfW)&#sUVS{Ax?@3F31{{P1&ITvatP&CFlyT`;_9ZS{A zA`P0sa4>AP7^w@zi||TmpW#Rc!R6&^T40SCGbWSCn=lNGnMP3@^Gf2W!I6Is$iR>m zSYt?U2V>$i&C-mK$A=7DUA?6R)~M?iv)ODuSE?u%i$%#;6beT=2!@n`;Q$OFa17*u zHc3t{@ZZn#Nm9|B<0}_M^-;FITfesq`b{v}-51K${ZaO?UO!j{{U*3cOYVOb+wocLvUD%| z@UdmkZvtI2R-fpzTGes}{caUb7-`r6e~6heT8bg-M1P2x5MqMRfIr04HN=FOu$8?b zX2uW`LRk*{A*S6Bgh}*2n%(3RnQ z4*?git=`sIcDybx!}%W06oPdWU$!B1WH{f0(@3Y`e;a6;KmFHnZ#ph+L;wH)07*qo IM6N<$g6T_hXnY9xOR7UPoF-0#*7)$rcIkNWy;K%GwCd0v$LV0VcD`}K!dxY zgPMSpOi7Sm@PFKZL44Dr>p*p!1s;*b3=DjSL74G){)!Z!;08|@#}JL+)`>TT4k_@s zdM0;G-Ih~!`2T-@<|nT15ACKrEK)003tiu@A;G{F!cf3GCFoP@r4{cNtId*2o9E$m zQobZ|?dMz(F0O>I=QbXiKP^Q&FB)u*-MHw*^#@iON3Et_d~jRCjgmx%sBA?|FB#bn~|7Q2|RbAIjervk;j0!baoyl%Pd=M;e=t n$a{R9wk~KXOHDxS@z=Z|Y=%?W;vQ%N-Ok|Y>gTe~DWM4f8{WRU literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/solarcooker/textures/gui/container/solar_cooker.png b/common/src/main/resources/assets/solarcooker/textures/gui/container/solar_cooker.png index e2f40d781473503cf57227a1042b90c6088f59ce..84c98b4d8eab006b3e64f591fc3cee1015117729 100644 GIT binary patch literal 1585 zcmd5+`!|$%9R9wqnbq7x?#sz_4KXEMOl`}!3^T=;6=6u@Qb=pXrXli1p+%;tTv7~Y zHDwVYoRl}Uv${!H8*P|HH`j5t&bZ8)eeFs6FYM<$-}AXW&vQOMeNS^ao)qGjL;wJV z&2skz0K!TLtWv{LY)zowa+m1q=?dz)jo)JpF3QE*1%QSEk}?dB_3OA^eoQP&rP6*c zrV5LjAU8MH-``)QGI4ZtjEIOxNlA&0j_##dW3=)o1JALf@q;gC_cHl&04DmX3)>Ll zSwV>yp>z2`y4E`p0Psm{cNafF=v3+Hq*8lLCati?>WwPB#o~QKgnkn}BUxd*=?3fC z5VI!6Bu&+-kv3fVkj&b(-8}h2!NT?&s5ek;y0^&&7h;qC-P+q5^G_wN}+u3-~%mF3MM)PxgDQ?;fpUr!68A+U??g~ zw?bJ(hWacmmsvPusSWvRRCf05<|>kWet4CEN5KvWK^OU>kx(LH-(~l_O{ao;o@Ko_ zQvB#et)>f(bg0YOnXu4oF>N-Gu|s0RLyJ|nfg-@-X$(;x$ya$Idr$p4&SN75?IUGy zVY@CjR$rdz4ACmRSrT1&BYJ(IZPct@IuzYbC+s}V%tl3K9S5NGDjHr!d?%oxZ#yL5 z5N|qXABnMaizsjD{2oW1-(UeGA7~R2HkIF{TG%7NC3F5d49(3_CY)!Y5LsEyO?cfR zDO_EI^KAzz_f}1QW583%ULJ|HhIJJgG-_76q>E5T+CWhnPbosU93o?>k1RN&93s=Z z-Y^HYL0uhm!XA$dNADL~@;8s!ig2P}wEIC?`8QC+QVB9{qsOxClu^Z}PflNtZc5(iGT53*Ym-ny%vL${N?HmXR_IH3(+F`?V>iz+!84$&>fJhUn(^N1@9 zRfT+!R`aaW$;tRmU?u*1qQ%K~>NxRKjz0HsZ9O?9EKJ{s;_U-NqK>@miV`r~kZI{g zvMhl_FQZhy{2F$bWMDVh7<9oExwrqQDckf}Hd@~w)o9KG(#v@{hMG9M=}gwoL_wl* zCV>h~%Zt?ecI(AiqWjDB)Z6;V=q=)(bL4)fF^Wum$XA5?&Wayy${!_$TeBF80aoB; zIO9&`G4qsnOZ3OK{OS>e3bO9mi>pt;+&)+6>cI-& s*USagJZs=j(?P2B{zvO?*NbOV5O|c3TQ+%6fPKq=&E&Y(x$-mq0ps0@-T(jq literal 1425 zcmd5+3sX}^7~LB#CLsY78A_B2wU-9QKtR+$)pCQRgi$aiM8Ibd2v}5t4@iyH3n*F< z352Q$k+hDCQWOw*XaMhECxQ_cOB0{L_NsO%@vEq7K=NF!%0p~e(d8FA0JO>G-fbGB>VlsNRd_fF~I7V zi*twts*E4I4*-Wd)&bp3y_`VQ>kkj*M#;C0mE@-X;^)jWh|BL;j=UK>YIC{Q#VBYE zQuy5Tk2zl(fxdc>=;~|mqpuN1&+oZ@n(uq(k~cX(P}hMSxv|v_@-(DY+!u(i9&>kZ zhkLv4=|@L}PYy?mnCi zrj;dj%P(T}SF{!BZ(2l|&hwm^cok5*-JRm1T%7eBUY4hx>MyVL#J%y(AA;=i#}>Joeb!7`cL3`jO~l{XorsWk+r68ntss-=#LzE2l5VLSh7t1S^gmJ2oB z#bwbXze6K^5!GNb=Gc_DsM*aKJ^0CBvt`#eh({3;p#S>qO-6OWlPf;k(5;66liUI89VL_-A9SyrOy@ywqSSF)HCQ| zHh#^9@5F!LBuBDUtPqyMRVPxnjCmKrMhD0=)rm;x(vssx+ul&3O+hi%h$kq)N*!CXF+71L~TLvDM!Cmh-OecLUyCkplyE%i>`cCZK(-CTuKKeAG z`ITkv-JdsRwMP6!@Zd)ADOFHq*hdvg@*7XER{V$&tx8qFtObJ^v2F5H@_{(f`aRIO zodFEyzL@+^GRa{3dwU;DQrj|^O!0atl=$9_YsS*AphnXz<)5>@uUpFrv$DG4b~%?e zT424>2b@~T_~hLKnjC*o{<@u|p%eBSZ4Vjd`fV9Z%l#r78_J45iyEgRF`w)mu4Hu~ w{Wyz8MKAG4f}I5*Y7+u}a`}JKz0jQrcN(jIdiYUX4bl2QI4?5vT8Jd;U!{^p00000 diff --git a/common/src/main/resources/assets/solarcooker/textures/item/reflector.png b/common/src/main/resources/assets/solarcooker/textures/item/reflector.png new file mode 100644 index 0000000000000000000000000000000000000000..39e50a49e1d297217c832ba6f828b76b25e2bee9 GIT binary patch literal 417 zcmV;S0bc%zP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T!0`!bdyA25P|41!h-hCLl?YMcj2AS0vCh#9ak0^8l}#4GJ}jkH;?-3gvnf;;xAl zn5HRMt@+J|!zZ6B-(X4-B5ooEWLd^SZ7l5fA1rpp3bxsn_aP#KJkPmg{MWGCwSic| z8{W0;JMRB6AhE`GH%-G$l>W^`cSe1Pd$5dSI9-pRuIqS|p9FwETf`mTj>FYa00000 LNkvXXu0mjfJ7%uS literal 0 HcmV?d00001 diff --git a/common/src/main/resources/data/minecraft/tags/block/mineable/axe.json b/common/src/main/resources/data/minecraft/tags/block/mineable/axe.json index 8f6d01d..a51ee24 100644 --- a/common/src/main/resources/data/minecraft/tags/block/mineable/axe.json +++ b/common/src/main/resources/data/minecraft/tags/block/mineable/axe.json @@ -1,7 +1,6 @@ { "replace": false, "values": [ - "solarcooker:solar_cooker", - "solarcooker:reflector" + "solarcooker:solar_cooker" ] } \ No newline at end of file diff --git a/common/src/main/resources/data/solarcooker/loot_table/blocks/reflector.json b/common/src/main/resources/data/solarcooker/loot_table/blocks/reflector.json deleted file mode 100644 index 2e14c01..0000000 --- a/common/src/main/resources/data/solarcooker/loot_table/blocks/reflector.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "functions": [ - { - "function": "minecraft:copy_name", - "source": "block_entity" - } - ], - "name": "solarcooker:reflector" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ] - } - ] -} \ No newline at end of file diff --git a/common/src/main/resources/data/solarcooker/tags/item/solar_cooker_reflector.json b/common/src/main/resources/data/solarcooker/tags/item/solar_cooker_reflector.json new file mode 100644 index 0000000..3c9a801 --- /dev/null +++ b/common/src/main/resources/data/solarcooker/tags/item/solar_cooker_reflector.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "solarcooker:reflector" + ] +} \ No newline at end of file diff --git a/fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java index c90056d..542838f 100644 --- a/fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModBlocks.java @@ -2,7 +2,6 @@ import de.cech12.solarcooker.Constants; import de.cech12.solarcooker.block.FabricSolarCookerBlock; -import de.cech12.solarcooker.block.ReflectorBlock; import de.cech12.solarcooker.block.ShiningDiamondBlock; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; @@ -14,12 +13,10 @@ public final class ModBlocks { private static final Block SOLAR_COOKER_BLOCK = register(Constants.SOLAR_COOKER_NAME, new FabricSolarCookerBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.5F, 3.5F).sound(SoundType.WOOD))); - private static final Block REFLECTOR_BLOCK = register(Constants.REFLECTOR_NAME, new ReflectorBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.0F).sound(SoundType.WOOD))); private static final Block SHINING_DIAMOND_BLOCK_BLOCK = register(Constants.SHINING_DIAMOND_BLOCK_NAME, new ShiningDiamondBlock(BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).lightLevel(state -> 15))); static { Constants.SOLAR_COOKER_BLOCK = () -> SOLAR_COOKER_BLOCK; - Constants.REFLECTOR_BLOCK = () -> REFLECTOR_BLOCK; Constants.SHINING_DIAMOND_BLOCK_BLOCK = () -> SHINING_DIAMOND_BLOCK_BLOCK; } diff --git a/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java b/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java index 9c5c2ed..18726a4 100644 --- a/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java +++ b/fabric/src/main/java/de/cech12/solarcooker/init/ModItems.java @@ -1,6 +1,7 @@ package de.cech12.solarcooker.init; import de.cech12.solarcooker.Constants; +import de.cech12.solarcooker.item.ReflectorItem; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.BlockItem; @@ -12,7 +13,7 @@ public class ModItems { private static final Item SOLAR_COOKER_ITEM = register(Constants.SOLAR_COOKER_NAME, Constants.SOLAR_COOKER_BLOCK); - private static final Item REFLECTOR_ITEM = register(Constants.REFLECTOR_NAME, Constants.REFLECTOR_BLOCK); + private static final Item REFLECTOR_ITEM = register(Constants.REFLECTOR_NAME, new ReflectorItem(new Item.Properties())); private static final Item SHINING_DIAMOND_BLOCK_ITEM = register(Constants.SHINING_DIAMOND_BLOCK_NAME, Constants.SHINING_DIAMOND_BLOCK_BLOCK); static { @@ -24,7 +25,11 @@ public class ModItems { public static void init() {} private static Item register(String name, Supplier block) { - return Registry.register(BuiltInRegistries.ITEM, Constants.id(name), new BlockItem(block.get(), new Item.Properties())); + return register(name, new BlockItem(block.get(), new Item.Properties())); + } + + private static Item register(String name, Item item) { + return Registry.register(BuiltInRegistries.ITEM, Constants.id(name), item); } } diff --git a/common/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json b/fabric/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json similarity index 84% rename from common/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json rename to fabric/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json index 7da98ce..d139fa9 100644 --- a/common/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json +++ b/fabric/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json @@ -6,12 +6,12 @@ ] }, "criteria": { - "has_cooker": { + "has_chest": { "trigger": "minecraft:inventory_changed", "conditions": { "items": [ { - "items": "solarcooker:solar_cooker" + "items": "#c:chests/wooden" } ] } @@ -25,7 +25,7 @@ }, "requirements": [ [ - "has_cooker", + "has_chest", "has_the_recipe" ] ] diff --git a/fabric/src/main/resources/data/solarcooker/recipe/reflector.json b/fabric/src/main/resources/data/solarcooker/recipe/reflector.json index c2e749f..b0e48a7 100644 --- a/fabric/src/main/resources/data/solarcooker/recipe/reflector.json +++ b/fabric/src/main/resources/data/solarcooker/recipe/reflector.json @@ -1,22 +1,17 @@ { - "type": "minecraft:crafting_shaped", + "type": "minecraft:crafting_shapeless", "category": "misc", - "pattern": [ - "GIS", - "GIS", - "GIS" - ], - "key": { - "G": { + "ingredients": [ + { "tag": "c:glass_panes" }, - "I": { + { "tag": "c:ingots/iron" }, - "S": { + { "tag": "minecraft:wooden_slabs" } - }, + ], "result": { "id": "solarcooker:reflector" } diff --git a/fabric/src/main/resources/data/solarcooker/recipe/solar_cooker.json b/fabric/src/main/resources/data/solarcooker/recipe/solar_cooker.json index eb3fa37..a75b64b 100644 --- a/fabric/src/main/resources/data/solarcooker/recipe/solar_cooker.json +++ b/fabric/src/main/resources/data/solarcooker/recipe/solar_cooker.json @@ -2,13 +2,13 @@ "type": "minecraft:crafting_shaped", "category": "misc", "pattern": [ - "IGI", - "GCG", - "IGI" + "IRI", + "RCR", + "RRR" ], "key": { - "G": { - "tag": "c:glass_panes" + "R": { + "item": "solarcooker:reflector" }, "I": { "tag": "c:ingots/iron" diff --git a/forge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java b/forge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java index 3a3d3be..208b2e8 100644 --- a/forge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java +++ b/forge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java @@ -1,12 +1,11 @@ package de.cech12.solarcooker.init; import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.block.ReflectorBlock; import de.cech12.solarcooker.block.ShiningDiamondBlock; import de.cech12.solarcooker.block.SolarCookerBlock; -import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MapColor; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; @@ -17,7 +16,6 @@ public final class ModBlocks { static { Constants.SOLAR_COOKER_BLOCK = BLOCKS.register(Constants.SOLAR_COOKER_NAME, () -> new SolarCookerBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.5F, 3.5F).sound(SoundType.WOOD))); - Constants.REFLECTOR_BLOCK = BLOCKS.register(Constants.REFLECTOR_NAME, () -> new ReflectorBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.0F).sound(SoundType.WOOD))); Constants.SHINING_DIAMOND_BLOCK_BLOCK = BLOCKS.register(Constants.SHINING_DIAMOND_BLOCK_NAME, () -> new ShiningDiamondBlock(BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).lightLevel(state -> 15))); } diff --git a/forge/src/main/java/de/cech12/solarcooker/init/ModItems.java b/forge/src/main/java/de/cech12/solarcooker/init/ModItems.java index 0071e7a..5480c65 100644 --- a/forge/src/main/java/de/cech12/solarcooker/init/ModItems.java +++ b/forge/src/main/java/de/cech12/solarcooker/init/ModItems.java @@ -1,8 +1,9 @@ package de.cech12.solarcooker.init; +import com.mojang.blaze3d.vertex.PoseStack; import de.cech12.solarcooker.Constants; import de.cech12.solarcooker.blockentity.ForgeSolarCookerBlockEntity; -import com.mojang.blaze3d.vertex.PoseStack; +import de.cech12.solarcooker.item.ReflectorItem; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; @@ -27,16 +28,20 @@ public class ModItems { static { Constants.SOLAR_COOKER_ITEM = solarCookerItem(); - Constants.REFLECTOR_ITEM = fromBlock(Constants.REFLECTOR_NAME, Constants.REFLECTOR_BLOCK); + Constants.REFLECTOR_ITEM = item(Constants.REFLECTOR_NAME, () -> new ReflectorItem(new Item.Properties())); Constants.SHINING_DIAMOND_BLOCK_ITEM = fromBlock(Constants.SHINING_DIAMOND_BLOCK_NAME, Constants.SHINING_DIAMOND_BLOCK_BLOCK); } + private static RegistryObject item(String name, Supplier itemSupplier) { + return ITEMS.register(name, itemSupplier); + } + private static RegistryObject fromBlock(String name, Supplier block) { - return ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); + return item(name, () -> new BlockItem(block.get(), new Item.Properties())); } private static RegistryObject solarCookerItem() { - return ITEMS.register(Constants.SOLAR_COOKER_NAME, () -> new BlockItem(Constants.SOLAR_COOKER_BLOCK.get(), new Item.Properties()) { + return item(Constants.SOLAR_COOKER_NAME, () -> new BlockItem(Constants.SOLAR_COOKER_BLOCK.get(), new Item.Properties()) { @Override public void initializeClient(@Nonnull Consumer consumer) { consumer.accept(new IClientItemExtensions() { diff --git a/forge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json b/forge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json new file mode 100644 index 0000000..20205d7 --- /dev/null +++ b/forge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "solarcooker:reflector" + ] + }, + "criteria": { + "has_chest": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": "#forge:chests/wooden" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "solarcooker:reflector" + } + } + }, + "requirements": [ + [ + "has_chest", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/forge/src/main/resources/data/solarcooker/recipe/reflector.json b/forge/src/main/resources/data/solarcooker/recipe/reflector.json index dfe54ca..c48100c 100644 --- a/forge/src/main/resources/data/solarcooker/recipe/reflector.json +++ b/forge/src/main/resources/data/solarcooker/recipe/reflector.json @@ -1,22 +1,17 @@ { - "type": "minecraft:crafting_shaped", + "type": "minecraft:crafting_shapeless", "category": "misc", - "pattern": [ - "GIS", - "GIS", - "GIS" - ], - "key": { - "G": { + "ingredients": [ + { "tag": "forge:glass_panes" }, - "I": { + { "tag": "forge:ingots/iron" }, - "S": { + { "tag": "minecraft:wooden_slabs" } - }, + ], "result": { "id": "solarcooker:reflector" } diff --git a/forge/src/main/resources/data/solarcooker/recipe/solar_cooker.json b/forge/src/main/resources/data/solarcooker/recipe/solar_cooker.json index de6fdad..8d74003 100644 --- a/forge/src/main/resources/data/solarcooker/recipe/solar_cooker.json +++ b/forge/src/main/resources/data/solarcooker/recipe/solar_cooker.json @@ -2,13 +2,13 @@ "type": "minecraft:crafting_shaped", "category": "misc", "pattern": [ - "IGI", - "GCG", - "IGI" + "IRI", + "RCR", + "RRR" ], "key": { - "G": { - "tag": "forge:glass_panes" + "R": { + "item": "solarcooker:reflector" }, "I": { "tag": "forge:ingots/iron" diff --git a/forge/src/test/java/de/cech12/solarcooker/ReflectorTests.java b/forge/src/test/java/de/cech12/solarcooker/ReflectorTests.java deleted file mode 100644 index e51c440..0000000 --- a/forge/src/test/java/de/cech12/solarcooker/ReflectorTests.java +++ /dev/null @@ -1,65 +0,0 @@ -package de.cech12.solarcooker; - -import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.block.ReflectorBlock; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.gametest.framework.GameTest; -import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.world.level.block.Rotation; -import net.minecraftforge.gametest.GameTestHolder; - -@GameTestHolder(Constants.MOD_ID) -public class ReflectorTests { - - private static final BlockPos REFLECTOR_POSITION = new BlockPos(0, 1, 0); - - @GameTest(template = "north") - public static void testClockwiseRotationOfNorthFacingReflector(GameTestHelper test) { - test.setBlock(REFLECTOR_POSITION, test.getBlockState(REFLECTOR_POSITION).rotate(test.getLevel(), REFLECTOR_POSITION, Rotation.CLOCKWISE_90)); - test.succeedIf(() -> test.assertBlockState(REFLECTOR_POSITION, - blockState -> ReflectorBlock.isFacingTo(blockState, Direction.EAST), - () -> "North facing reflector is not facing to east after clockwise rotation.")); - } - - @GameTest(template = "north") - public static void testCounterClockwiseRotationOfNorthFacingReflector(GameTestHelper test) { - test.setBlock(REFLECTOR_POSITION, test.getBlockState(REFLECTOR_POSITION).rotate(test.getLevel(), REFLECTOR_POSITION, Rotation.COUNTERCLOCKWISE_90)); - test.succeedIf(() -> test.assertBlockState(REFLECTOR_POSITION, - blockState -> ReflectorBlock.isFacingTo(blockState, Direction.WEST), - () -> "North facing reflector is not facing to west after counter clockwise rotation.")); - } - - @GameTest(template = "north") - public static void testClockwise180RotationOfNorthFacingReflector(GameTestHelper test) { - test.setBlock(REFLECTOR_POSITION, test.getBlockState(REFLECTOR_POSITION).rotate(test.getLevel(), REFLECTOR_POSITION, Rotation.CLOCKWISE_180)); - test.succeedIf(() -> test.assertBlockState(REFLECTOR_POSITION, - blockState -> ReflectorBlock.isFacingTo(blockState, Direction.SOUTH), - () -> "North facing reflector is not facing to south after clockwise 180 rotation.")); - } - - @GameTest(template = "north_east") - public static void testClockwiseRotationOfNorthEastFacingReflector(GameTestHelper test) { - test.setBlock(REFLECTOR_POSITION, test.getBlockState(REFLECTOR_POSITION).rotate(test.getLevel(), REFLECTOR_POSITION, Rotation.CLOCKWISE_90)); - test.succeedIf(() -> test.assertBlockState(REFLECTOR_POSITION, - blockState -> ReflectorBlock.isFacingTo(blockState, Direction.SOUTH) && ReflectorBlock.isFacingTo(blockState, Direction.EAST), - () -> "North-east facing reflector is not facing to south-east after clockwise rotation.")); - } - - @GameTest(template = "north_east") - public static void testCounterClockwiseRotationOfNorthEastFacingReflector(GameTestHelper test) { - test.setBlock(REFLECTOR_POSITION, test.getBlockState(REFLECTOR_POSITION).rotate(test.getLevel(), REFLECTOR_POSITION, Rotation.COUNTERCLOCKWISE_90)); - test.succeedIf(() -> test.assertBlockState(REFLECTOR_POSITION, - blockState -> ReflectorBlock.isFacingTo(blockState, Direction.NORTH) && ReflectorBlock.isFacingTo(blockState, Direction.WEST), - () -> "North-east facing reflector is not facing to north-west after counter clockwise rotation.")); - } - - @GameTest(template = "north_east") - public static void testClockwise180RotationOfNorthEastFacingReflector(GameTestHelper test) { - test.setBlock(REFLECTOR_POSITION, test.getBlockState(REFLECTOR_POSITION).rotate(test.getLevel(), REFLECTOR_POSITION, Rotation.CLOCKWISE_180)); - test.succeedIf(() -> test.assertBlockState(REFLECTOR_POSITION, - blockState -> ReflectorBlock.isFacingTo(blockState, Direction.SOUTH) && ReflectorBlock.isFacingTo(blockState, Direction.WEST), - () -> "North-east facing reflector is not facing to south-west after clockwise 180 rotation.")); - } - -} diff --git a/forge/src/test/resources/data/solarcooker/structures/reflector/reflectors.nbt b/forge/src/test/resources/data/solarcooker/structures/reflector/reflectors.nbt deleted file mode 100644 index 9a6166eb4c2e9417aa82088f010c68973c42df7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 291 zcmV+;0o?u{iwFP!000000F9B&YQr!PgvXYh*e;=`Lg}OA+Fp7oJ%nD%+F7R}iWH=U zLZ7~N9Vf=MNdy8d`eyd80CFTj|F8luyityft!U94(4HKN(zt3LiZ;lhjxO}@`6#48 zNcf}}GSLl8d;^2tYrsSkK4T`H@QJVZL=%jf$TenS6i~Jlh3wh6{YD?SYb1RYK6LZU z5bG@-gEQo-24cVddw+I;!m5{UoRFEB=(x+IVU|ZSEW+)g(hSKPHRSc3c^4TL?1fWA>>B$CZU$P9Nh3{Gyu|@i)#>zZ8f5xW7Om}{ifN)YN z)cLYSRx%x99(p|><`i7nQBSyK>xxU0w|Btwg3PC1`R@W diff --git a/forge/src/test/resources/data/solarcooker/structures/reflectortests.north_east.nbt b/forge/src/test/resources/data/solarcooker/structures/reflectortests.north_east.nbt deleted file mode 100644 index 8c443d019fee329c606b376cfc6a81a84a414494..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmV;E0BrvsiwFP!00000|2>Ss3c@fDL`PG#NzZuctI(C}SdVV$La99C-4=x1z7%w$F%B_N!I z3rW3f(b%I9mb*Qseu{U(RyjxMnFo@C&@EGMEYoLqj215>ns@}d7v7}OD&e;P006sf BKiU8Q diff --git a/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java b/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java index 875e131..bb3c76e 100644 --- a/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java +++ b/neoforge/src/main/java/de/cech12/solarcooker/init/ModBlocks.java @@ -1,12 +1,11 @@ package de.cech12.solarcooker.init; import de.cech12.solarcooker.Constants; -import de.cech12.solarcooker.block.ReflectorBlock; import de.cech12.solarcooker.block.ShiningDiamondBlock; import de.cech12.solarcooker.block.SolarCookerBlock; -import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MapColor; import net.neoforged.neoforge.registries.DeferredRegister; @@ -16,7 +15,6 @@ public final class ModBlocks { static { Constants.SOLAR_COOKER_BLOCK = BLOCKS.register(Constants.SOLAR_COOKER_NAME, () -> new SolarCookerBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.5F, 3.5F).sound(SoundType.WOOD))); - Constants.REFLECTOR_BLOCK = BLOCKS.register(Constants.REFLECTOR_NAME, () -> new ReflectorBlock(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).strength(2.0F).sound(SoundType.WOOD))); Constants.SHINING_DIAMOND_BLOCK_BLOCK = BLOCKS.register(Constants.SHINING_DIAMOND_BLOCK_NAME, () -> new ShiningDiamondBlock(BlockBehaviour.Properties.of().mapColor(MapColor.DIAMOND).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL).lightLevel(state -> 15))); } diff --git a/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java b/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java index 507dec5..4f9ea84 100644 --- a/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java +++ b/neoforge/src/main/java/de/cech12/solarcooker/init/ModItems.java @@ -1,8 +1,9 @@ package de.cech12.solarcooker.init; -import de.cech12.solarcooker.Constants; import com.mojang.blaze3d.vertex.PoseStack; +import de.cech12.solarcooker.Constants; import de.cech12.solarcooker.blockentity.SolarCookerBlockEntity; +import de.cech12.solarcooker.item.ReflectorItem; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; @@ -26,16 +27,20 @@ public class ModItems { static { Constants.SOLAR_COOKER_ITEM = solarCookerItem(); - Constants.REFLECTOR_ITEM = fromBlock(Constants.REFLECTOR_NAME, Constants.REFLECTOR_BLOCK); + Constants.REFLECTOR_ITEM = item(Constants.REFLECTOR_NAME, () -> new ReflectorItem(new Item.Properties())); Constants.SHINING_DIAMOND_BLOCK_ITEM = fromBlock(Constants.SHINING_DIAMOND_BLOCK_NAME, Constants.SHINING_DIAMOND_BLOCK_BLOCK); } + private static DeferredHolder item(String name, Supplier itemSupplier) { + return ITEMS.register(name, itemSupplier); + } + private static DeferredHolder fromBlock(String name, Supplier block) { - return ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); + return item(name, () -> new BlockItem(block.get(), new Item.Properties())); } private static DeferredHolder solarCookerItem() { - return ITEMS.register(Constants.SOLAR_COOKER_NAME, () -> new BlockItem(Constants.SOLAR_COOKER_BLOCK.get(), new Item.Properties()) { + return item(Constants.SOLAR_COOKER_NAME, () -> new BlockItem(Constants.SOLAR_COOKER_BLOCK.get(), new Item.Properties()) { @Override public void initializeClient(@Nonnull Consumer consumer) { consumer.accept(new IClientItemExtensions() { diff --git a/neoforge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json b/neoforge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json new file mode 100644 index 0000000..d139fa9 --- /dev/null +++ b/neoforge/src/main/resources/data/solarcooker/advancement/recipes/decorations/reflector.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "solarcooker:reflector" + ] + }, + "criteria": { + "has_chest": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "items": "#c:chests/wooden" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "solarcooker:reflector" + } + } + }, + "requirements": [ + [ + "has_chest", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/neoforge/src/main/resources/data/solarcooker/recipe/reflector.json b/neoforge/src/main/resources/data/solarcooker/recipe/reflector.json index c2e749f..b0e48a7 100644 --- a/neoforge/src/main/resources/data/solarcooker/recipe/reflector.json +++ b/neoforge/src/main/resources/data/solarcooker/recipe/reflector.json @@ -1,22 +1,17 @@ { - "type": "minecraft:crafting_shaped", + "type": "minecraft:crafting_shapeless", "category": "misc", - "pattern": [ - "GIS", - "GIS", - "GIS" - ], - "key": { - "G": { + "ingredients": [ + { "tag": "c:glass_panes" }, - "I": { + { "tag": "c:ingots/iron" }, - "S": { + { "tag": "minecraft:wooden_slabs" } - }, + ], "result": { "id": "solarcooker:reflector" } diff --git a/neoforge/src/main/resources/data/solarcooker/recipe/solar_cooker.json b/neoforge/src/main/resources/data/solarcooker/recipe/solar_cooker.json index eb3fa37..a75b64b 100644 --- a/neoforge/src/main/resources/data/solarcooker/recipe/solar_cooker.json +++ b/neoforge/src/main/resources/data/solarcooker/recipe/solar_cooker.json @@ -2,13 +2,13 @@ "type": "minecraft:crafting_shaped", "category": "misc", "pattern": [ - "IGI", - "GCG", - "IGI" + "IRI", + "RCR", + "RRR" ], "key": { - "G": { - "tag": "c:glass_panes" + "R": { + "item": "solarcooker:reflector" }, "I": { "tag": "c:ingots/iron"