From 541e04834131356e867f5d72ff5e3618bd3ff192 Mon Sep 17 00:00:00 2001 From: Trytoon Date: Tue, 15 Aug 2023 18:56:02 +0200 Subject: [PATCH 1/2] Starting the farming station Ads functionnalities to plant crops. --- .../enderio/blockstates/farming_station.json | 19 ++ .../resources/assets/enderio/lang/en_ud.json | 1 + .../resources/assets/enderio/lang/en_us.json | 1 + .../block/farming_station_combined.json | 16 ++ .../enderio/models/item/farming_station.json | 3 + .../loot_tables/blocks/farming_station.json | 29 +++ .../tags/blocks/mineable/pickaxe.json | 1 + .../tags/blocks/needs_iron_tool.json | 1 + .../gui/screen/FarmingStationScreen.java | 55 +++++ .../FarmingStationBlockEntity.java | 229 ++++++++++++++++++ .../blockentity/base/MachineBlockEntity.java | 1 + .../common/init/MachineBlockEntities.java | 1 + .../machines/common/init/MachineBlocks.java | 3 + .../machines/common/init/MachineMenus.java | 1 + .../common/menu/FarmingStationMenu.java | 49 ++++ .../enderio/textures/gui/farm_station.png | Bin 2001 -> 0 bytes .../enderio/textures/gui/farming_station.png | Bin 0 -> 1590 bytes 17 files changed, 410 insertions(+) create mode 100644 src/generated/resources/assets/enderio/blockstates/farming_station.json create mode 100644 src/generated/resources/assets/enderio/models/block/farming_station_combined.json create mode 100644 src/generated/resources/assets/enderio/models/item/farming_station.json create mode 100644 src/generated/resources/data/enderio/loot_tables/blocks/farming_station.json create mode 100644 src/machines/java/com/enderio/machines/client/gui/screen/FarmingStationScreen.java create mode 100644 src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java create mode 100644 src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java delete mode 100644 src/main/resources/assets/enderio/textures/gui/farm_station.png create mode 100644 src/main/resources/assets/enderio/textures/gui/farming_station.png diff --git a/src/generated/resources/assets/enderio/blockstates/farming_station.json b/src/generated/resources/assets/enderio/blockstates/farming_station.json new file mode 100644 index 0000000000..d379f9d30a --- /dev/null +++ b/src/generated/resources/assets/enderio/blockstates/farming_station.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=east": { + "model": "enderio:block/farming_station_combined", + "y": 90 + }, + "facing=north": { + "model": "enderio:block/farming_station_combined" + }, + "facing=south": { + "model": "enderio:block/farming_station_combined", + "y": 180 + }, + "facing=west": { + "model": "enderio:block/farming_station_combined", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/enderio/lang/en_ud.json b/src/generated/resources/assets/enderio/lang/en_ud.json index 54ae62999d..ed53eba440 100644 --- a/src/generated/resources/assets/enderio/lang/en_ud.json +++ b/src/generated/resources/assets/enderio/lang/en_ud.json @@ -83,6 +83,7 @@ "block.enderio.energetic_alloy_block": "ʞɔoןᗺ ʎoןןⱯ ɔıʇǝbɹǝuƎ", "block.enderio.energetic_photovoltaic_module": "ǝןnpoW ɔıɐʇןoʌoʇoɥԀ ɔıʇǝbɹǝuƎ", "block.enderio.ensouled_chassis": "sıssɐɥƆ pǝןnosuƎ", + "block.enderio.farming_station": "uoıʇɐʇS buıɯɹɐℲ", "block.enderio.fire_water": "ɹǝʇɐM ǝɹıℲ", "block.enderio.fluid_tank": "ʞuɐ⟘ pınןℲ", "block.enderio.fused_quartz": "zʇɹɐnὉ pǝsnℲ", diff --git a/src/generated/resources/assets/enderio/lang/en_us.json b/src/generated/resources/assets/enderio/lang/en_us.json index bf07fb6dac..f1c0a8c9a0 100644 --- a/src/generated/resources/assets/enderio/lang/en_us.json +++ b/src/generated/resources/assets/enderio/lang/en_us.json @@ -83,6 +83,7 @@ "block.enderio.energetic_alloy_block": "Energetic Alloy Block", "block.enderio.energetic_photovoltaic_module": "Energetic Photovoltaic Module", "block.enderio.ensouled_chassis": "Ensouled Chassis", + "block.enderio.farming_station": "Farming Station", "block.enderio.fire_water": "Fire Water", "block.enderio.fluid_tank": "Fluid Tank", "block.enderio.fused_quartz": "Fused Quartz", diff --git a/src/generated/resources/assets/enderio/models/block/farming_station_combined.json b/src/generated/resources/assets/enderio/models/block/farming_station_combined.json new file mode 100644 index 0000000000..3d8a233c9f --- /dev/null +++ b/src/generated/resources/assets/enderio/models/block/farming_station_combined.json @@ -0,0 +1,16 @@ +{ + "parent": "minecraft:block/block", + "children": { + "machine": { + "parent": "enderio:block/farming_station" + }, + "overlay": { + "parent": "enderio:block/io_overlay" + } + }, + "item_render_order": [ + "machine", + "overlay" + ], + "loader": "forge:composite" +} \ No newline at end of file diff --git a/src/generated/resources/assets/enderio/models/item/farming_station.json b/src/generated/resources/assets/enderio/models/item/farming_station.json new file mode 100644 index 0000000000..712115f1ef --- /dev/null +++ b/src/generated/resources/assets/enderio/models/item/farming_station.json @@ -0,0 +1,3 @@ +{ + "parent": "enderio:block/farming_station" +} \ No newline at end of file diff --git a/src/generated/resources/data/enderio/loot_tables/blocks/farming_station.json b/src/generated/resources/data/enderio/loot_tables/blocks/farming_station.json new file mode 100644 index 0000000000..68bc4d91c1 --- /dev/null +++ b/src/generated/resources/data/enderio/loot_tables/blocks/farming_station.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "", + "target": "BlockEntityTag" + } + ], + "source": "block_entity" + } + ], + "name": "enderio:farming_station" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "enderio:blocks/farming_station" +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index 3027e7460a..670479463a 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -47,6 +47,7 @@ "enderio:slice_and_splice", "enderio:impulse_hopper", "enderio:soul_binder", + "enderio:farming_station", "enderio:powered_spawner", "enderio:vacuum_chest", "enderio:xp_vacuum", diff --git a/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json b/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json index a7e24fbdce..fbf1e910e0 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json +++ b/src/generated/resources/data/minecraft/tags/blocks/needs_iron_tool.json @@ -18,6 +18,7 @@ "enderio:slice_and_splice", "enderio:impulse_hopper", "enderio:soul_binder", + "enderio:farming_station", "enderio:powered_spawner", "enderio:vacuum_chest", "enderio:xp_vacuum", diff --git a/src/machines/java/com/enderio/machines/client/gui/screen/FarmingStationScreen.java b/src/machines/java/com/enderio/machines/client/gui/screen/FarmingStationScreen.java new file mode 100644 index 0000000000..ab83f43791 --- /dev/null +++ b/src/machines/java/com/enderio/machines/client/gui/screen/FarmingStationScreen.java @@ -0,0 +1,55 @@ +package com.enderio.machines.client.gui.screen; + +import com.enderio.EnderIO; +import com.enderio.api.misc.Vector2i; +import com.enderio.base.common.lang.EIOLang; +import com.enderio.core.client.gui.screen.EIOScreen; +import com.enderio.core.client.gui.widgets.EnumIconWidget; +import com.enderio.core.client.gui.widgets.ToggleImageButton; +import com.enderio.machines.client.gui.widget.CapacitorEnergyWidget; +import com.enderio.machines.client.gui.widget.FluidStackWidget; +import com.enderio.machines.client.gui.widget.ProgressWidget; +import com.enderio.machines.client.gui.widget.ioconfig.IOConfigButton; +import com.enderio.machines.common.menu.FarmingStationMenu; +import com.enderio.machines.common.menu.WiredChargerMenu; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; + +public class FarmingStationScreen extends EIOScreen { + + private static final ResourceLocation BG_TEXTURE = EnderIO.loc("textures/gui/farming_station.png"); + private static final ResourceLocation RANGE_BUTTON_TEXTURE = EnderIO.loc("textures/gui/icons/range_buttons.png"); + public FarmingStationScreen(FarmingStationMenu pMenu, Inventory pPlayerInventory, Component pTitle) { + super(pMenu, pPlayerInventory, pTitle); + } + + @Override + protected void init() { + super.init(); + + addRenderableOnly(new CapacitorEnergyWidget(this, getMenu().getBlockEntity()::getEnergyStorage, getMenu().getBlockEntity()::isCapacitorInstalled, 16 + leftPos + 42, 14 + topPos, 9, 45)); + + addRenderableWidget(new EnumIconWidget<>(this, leftPos + imageWidth - 8 - 12, topPos + 6, () -> menu.getBlockEntity().getRedstoneControl(), + control -> menu.getBlockEntity().setRedstoneControl(control), EIOLang.REDSTONE_MODE)); + + addRenderableWidget(new IOConfigButton<>(this, leftPos + imageWidth - 6 - 16, topPos + 22, 16, 16, menu, this::addRenderableWidget, font)); + + + addRenderableWidget(new ToggleImageButton<>(this, leftPos + imageWidth - 6 - 16, topPos + 40, 16, 16, 0, 0, 16, 0, RANGE_BUTTON_TEXTURE, + () -> menu.getBlockEntity().isRangeVisible(), state -> menu.getBlockEntity().setIsRangeVisible(state), + () -> menu.getBlockEntity().isRangeVisible() ? EIOLang.HIDE_RANGE : EIOLang.SHOW_RANGE)); + + addRenderableOnly(new FluidStackWidget(this, getMenu().getBlockEntity()::getFluidTank, 7 + leftPos, 14 + topPos, 16, 47)); + } + + @Override + public ResourceLocation getBackgroundImage() { + return BG_TEXTURE; + } + + @Override + protected Vector2i getBackgroundImageSize() { + return new Vector2i(227, 169); + } +} diff --git a/src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java b/src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java new file mode 100644 index 0000000000..f50b3a1f49 --- /dev/null +++ b/src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java @@ -0,0 +1,229 @@ +package com.enderio.machines.common.blockentity; + +import com.enderio.api.capacitor.CapacitorModifier; +import com.enderio.api.capacitor.QuadraticScalable; +import com.enderio.api.io.energy.EnergyIOMode; +import com.enderio.machines.common.blockentity.base.PoweredMachineBlockEntity; +import com.enderio.machines.common.config.MachinesConfig; +import com.enderio.machines.common.io.item.MachineInventoryLayout; +import com.enderio.machines.common.io.item.MultiSlotAccess; +import com.enderio.machines.common.io.item.SingleSlotAccess; +import com.enderio.machines.common.menu.FarmingStationMenu; +import net.minecraft.client.Minecraft; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.FluidTags; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.*; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.FarmBlock; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.IPlantable; +import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.templates.FluidTank; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class FarmingStationBlockEntity extends PoweredMachineBlockEntity { + + public static final QuadraticScalable CAPACITY = new QuadraticScalable(CapacitorModifier.ENERGY_CAPACITY, MachinesConfig.COMMON.ENERGY.WIRED_CHARGER_CAPACITY); + + public static final QuadraticScalable USAGE = new QuadraticScalable(CapacitorModifier.ENERGY_USE, MachinesConfig.COMMON.ENERGY.WIRED_CHARGER_USAGE); + + public static final SingleSlotAccess HOE = new SingleSlotAccess(); + + public static final SingleSlotAccess AXE = new SingleSlotAccess(); + + public static final SingleSlotAccess SHEARS = new SingleSlotAccess(); + + public static final MultiSlotAccess FERTILIZERS = new MultiSlotAccess(); + + public static final MultiSlotAccess INPUTS = new MultiSlotAccess(); + + public static final MultiSlotAccess OUTPUT = new MultiSlotAccess(); + + //Should be dynamically increased with a better capacitor + public static final int TICK_PER_OPERATION = 5; + public static int RANGE = 4; + + public static final int GET_WATER_PER_OPERATION = 1000/ RANGE*RANGE; + + private int completedTicks = 0; + private int counter = 0; + + private List blocksInRange; + + + public FarmingStationBlockEntity(BlockEntityType type, BlockPos worldPosition, BlockState blockState) { + super(EnergyIOMode.Input, CAPACITY, USAGE, type, worldPosition, blockState); + blocksInRange = getBlocksInRange(); + setRange(RANGE); + } + + + @Override + public @Nullable MachineInventoryLayout getInventoryLayout() { + return MachineInventoryLayout.builder() + .inputSlot(4, (slot, stack) -> acceptInput(stack)) + .slotAccess(INPUTS) + .setStackLimit(1) // Reset stack limit + .inputSlot((slot, stack) -> stack.getItem() instanceof HoeItem) + .slotAccess(HOE) + .inputSlot((slot, stack) -> stack.getItem() instanceof AxeItem) + .slotAccess(AXE) + .inputSlot((slot, stack) -> stack.getItem() instanceof ShearsItem) + .slotAccess(SHEARS) + .setStackLimit(64) // Reset stack limit + .inputSlot(2, (slot, stack) -> stack.getItem() instanceof BoneMealItem) + .slotAccess(FERTILIZERS) + .outputSlot(6) + .slotAccess(OUTPUT) + .capacitor() + .build(); + } + + @Override + protected boolean isActive() { + return false; + } + + @Override + public void serverTick() { + super.serverTick(); + + if (canAct()) { + completedTicks = (completedTicks + 1) % TICK_PER_OPERATION; + if (completedTicks == 0) { + + + if (counter < blocksInRange.size()) { + till(blocksInRange.get(counter).below()); + plant(blocksInRange.get(counter)); + boneMealBlock(); + waterSoil(); + counter++; + } else { + counter = 0; + } + + } + } else { + completedTicks = 0; + } + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player player) { + return new FarmingStationMenu(this, pPlayerInventory, pContainerId); + } + + @Override + protected @Nullable FluidTank createFluidTank() { + return new FluidTank(2000, f -> f.getFluid().is(FluidTags.WATER)); + } + + public boolean acceptInput(ItemStack stack) { + return stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock() instanceof IPlantable; + } + + + //Randomly choose a crop and apply bone meal on it + public void boneMealBlock() { + ItemStack boneMealItemStack = getFirstNonEmptyItemStack(FERTILIZERS); + Minecraft mc = Minecraft.getInstance(); + if (!boneMealItemStack.equals(ItemStack.EMPTY)) { + Random random = new Random(); + int chosenCrop = random.nextInt(blocksInRange.size()); + BoneMealItem.applyBonemeal(boneMealItemStack, level, blocksInRange.get(chosenCrop), mc.player); + } + } + + //Randomly makes farmland wet + public void waterSoil() { + Random random = new Random(); + int chosenBlock = random.nextInt(blocksInRange.size()); + + BlockPos pos = getBlocksInRange().get(chosenBlock); + BlockState blockState = level.getBlockState(pos.below()); + + if (blockState.getBlock().equals(Blocks.FARMLAND) && GET_WATER_PER_OPERATION >= getFluidTank().getFluidAmount()) { + this.level.setBlockAndUpdate(pos.below(), blockState.setValue(FarmBlock.MOISTURE, 7)); + getFluidTank().drain(GET_WATER_PER_OPERATION, IFluidHandler.FluidAction.EXECUTE); + } + } + + + public void till(BlockPos pos) { + ItemStack hoe = getInventory().getStackInSlot(HOE.getIndex()); + + if (!hoe.isEmpty()) { + BlockState blockState = level.getBlockState(pos); + if (blockState.getBlock().equals(Blocks.DIRT) || blockState.getBlock().equals(Blocks.GRASS_BLOCK)) { + this.level.setBlockAndUpdate(pos, Blocks.FARMLAND.defaultBlockState()); + level.playSound(null, pos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0f, 1.0f); + hoe.hurt(1, level.getRandom(), null); + getEnergyStorage().consumeEnergy(getEnergyStorage().getMaxEnergyUse(), false); + } + } + } + + public void plant(BlockPos pos) { + ItemStack inputItemStack = getFirstNonEmptyItemStack(INPUTS); + + if (!inputItemStack.equals(ItemStack.EMPTY)) { + + //If an item is a crop or everything that can grow + if (inputItemStack.getItem() instanceof BlockItem && ((BlockItem) inputItemStack.getItem()).getBlock() instanceof IPlantable) { + Block block = ((BlockItem) inputItemStack.getItem()).getBlock(); + + //If the seed / sapling can be planted on the block + if (this.level.getBlockState(pos.below()).canSustainPlant(level, pos.below(), Direction.UP, (IPlantable) block)) { + + //If the block isn't already planted + if (this.level.getBlockState(pos).getBlock().equals(Blocks.AIR)) { + //Plant it and update corresponding machine slots + if (this.level.setBlockAndUpdate(pos, ((IPlantable) block).getPlant(level, pos))) { + inputItemStack.shrink(1); + getEnergyStorage().consumeEnergy(getEnergyStorage().getMaxEnergyUse(), false); + } + } + } + } + } + } + + + //Get all blocks that are around the farming station at the same y level (sometimes need to get pos.below) + List getBlocksInRange() { + BlockPos farmerPos = getBlockPos(); + + Stream blocks = BlockPos.betweenClosedStream(farmerPos.getX() - getRange(), farmerPos.getY(), farmerPos.getZ() - getRange(), + farmerPos.getX() + getRange(), farmerPos.getY(), farmerPos.getZ() + getRange()); + + return blocks + .map(BlockPos::immutable) + .distinct() + .collect(Collectors.toList()); + } + + public ItemStack getFirstNonEmptyItemStack(MultiSlotAccess slot) { + for (int i = 0; i < slot.size(); i++) { + ItemStack slotItemStack = slot.get(i).getItemStack(getInventory()); + if (!slotItemStack.equals(ItemStack.EMPTY) && slotItemStack.getCount() != 0) { + return slot.get(i).getItemStack(getInventory()); + } + } + return ItemStack.EMPTY; + } +} \ No newline at end of file diff --git a/src/machines/java/com/enderio/machines/common/blockentity/base/MachineBlockEntity.java b/src/machines/java/com/enderio/machines/common/blockentity/base/MachineBlockEntity.java index 826f8b9dac..31d6039c20 100644 --- a/src/machines/java/com/enderio/machines/common/blockentity/base/MachineBlockEntity.java +++ b/src/machines/java/com/enderio/machines/common/blockentity/base/MachineBlockEntity.java @@ -267,6 +267,7 @@ public int getRange() { public void setRange(int range) { if (level != null && level.isClientSide()) { clientUpdateSlot(rangeDataSlot, range); + this.range = range; } else this.range = range; } diff --git a/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java b/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java index ecf5f3e1a6..fedec1ccc1 100644 --- a/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java +++ b/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java @@ -63,6 +63,7 @@ public class MachineBlockEntities { public static final BlockEntityEntry PAINTING_MACHINE = register("painting_machine", PaintingMachineBlockEntity::new, MachineBlocks.PAINTING_MACHINE); public static final BlockEntityEntry POWERED_SPAWNER = register("powered_spawner", PoweredSpawnerBlockEntity::new, MachineBlocks.POWERED_SPAWNER); + public static final BlockEntityEntry FARMING_STATION = register("farming_station", FarmingStationBlockEntity::new, MachineBlocks.FARMING_STATION); public static final Map> SOLAR_PANELS = Util.make(() -> { Map> map = new HashMap<>(); diff --git a/src/machines/java/com/enderio/machines/common/init/MachineBlocks.java b/src/machines/java/com/enderio/machines/common/init/MachineBlocks.java index 92c90726f9..bb775371fb 100644 --- a/src/machines/java/com/enderio/machines/common/init/MachineBlocks.java +++ b/src/machines/java/com/enderio/machines/common/init/MachineBlocks.java @@ -123,6 +123,9 @@ public class MachineBlocks { .lang("Soul Binder") .register(); + public static final BlockEntry FARMING_STATION = machine("farming_station", () -> MachineBlockEntities.FARMING_STATION) + .register(); + public static final BlockEntry POWERED_SPAWNER = REGISTRATE .block("powered_spawner", properties -> new ProgressMachineBlock(properties, MachineBlockEntities.POWERED_SPAWNER)) .loot((l,t) -> MachinesLootTable.copyNBTSingleCap(l, t, "EntityStorage")) diff --git a/src/machines/java/com/enderio/machines/common/init/MachineMenus.java b/src/machines/java/com/enderio/machines/common/init/MachineMenus.java index 53b840b5bd..2fc49edd07 100644 --- a/src/machines/java/com/enderio/machines/common/init/MachineMenus.java +++ b/src/machines/java/com/enderio/machines/common/init/MachineMenus.java @@ -26,6 +26,7 @@ private MachineMenus() {} public static final MenuEntry CRAFTER = REGISTRATE.menu("crafter", CrafterMenu::factory, () -> CrafterScreen::new).register(); public static final MenuEntry WIRED_CHARGER = REGISTRATE.menu("wired_charger", WiredChargerMenu::factory, () -> WiredChargerScreen::new).register(); public static final MenuEntry PAINTING_MACHINE = REGISTRATE.menu("painting_machine", PaintingMachineMenu::factory, () -> PaintingMachineScreen::new).register(); + public static final MenuEntry FARMING_STATION = REGISTRATE.menu("farming_station", FarmingStationMenu::factory, () -> FarmingStationScreen::new).register(); public static final MenuEntry CAPACITOR_BANK = REGISTRATE .menu("capacitor_bank", CapacitorBankMenu::factory, () -> CapacitorBankScreen::new) .register(); diff --git a/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java b/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java new file mode 100644 index 0000000000..c1baf50029 --- /dev/null +++ b/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java @@ -0,0 +1,49 @@ +package com.enderio.machines.common.menu; + +import com.enderio.machines.common.blockentity.FarmingStationBlockEntity; +import com.enderio.machines.common.init.MachineMenus; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.level.block.entity.BlockEntity; +import org.apache.logging.log4j.LogManager; +import org.jetbrains.annotations.Nullable; + +public class FarmingStationMenu extends MachineMenu { + public FarmingStationMenu(@Nullable FarmingStationBlockEntity blockEntity, Inventory inventory, int pContainerId) { + super(blockEntity, inventory, MachineMenus.FARMING_STATION.get(), pContainerId); + if (blockEntity != null) { + addSlot(new MachineSlot(blockEntity.getInventory(), blockEntity.getCapacitorSlot(), 12 + 42, 60)); + + //Tool slots + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.HOE, 44 + 42, 19)); + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.AXE, 62 + 42, 19)); + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.SHEARS, 80 + 42, 19)); + + //Bonemeal slots + for (int i = 0; i < 2; i++) { + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.FERTILIZERS.get(i), 116 + 42 + 18 * i, 19)); + } + + //Seed slots + for (int i = 0; i < 4; i++) { + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.INPUTS.get(i), 53 + 42 + 18 * (i % 2), i < 2 ? 44 : 62)); + } + + //Output, seeds / trees harvested + for (int i = 0; i < 6; i++) { + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.OUTPUT.get(i), 107 + 42 + 18 * (i % 3), i < 3 ? 44 : 62)); + } + } + addInventorySlots(8 + 42, 87); + } + + public static FarmingStationMenu factory(@Nullable MenuType pMenuType, int pContainerId, Inventory inventory, FriendlyByteBuf buf) { + BlockEntity entity = inventory.player.level().getBlockEntity(buf.readBlockPos()); + if (entity instanceof FarmingStationBlockEntity castBlockEntity) + return new FarmingStationMenu(castBlockEntity, inventory, pContainerId); + LogManager.getLogger().warn("couldn't find BlockEntity"); + return new FarmingStationMenu(null, inventory, pContainerId); + } + +} diff --git a/src/main/resources/assets/enderio/textures/gui/farm_station.png b/src/main/resources/assets/enderio/textures/gui/farm_station.png deleted file mode 100644 index 8bb36ed64a7a9ba068622f8e071e94f1544ca4c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2001 zcmcIkdrVVj6hHU2mx`r80N07mHptW=DqCl8gBI#AQYMe7$jlJBm`SipB{+d1;&p8C zF*hq>s*9y811e@v9gGQfa1#u3BA}><6-s?zeM=_lrbHBc}?qI6*l26uy zqiaj4^Cw>GA_fmE!Y+TNvecP>$`?78*>vT#jY$Fd%JE&p*~9%e>U9ZatDA)7nlYz! zw<2C4mJ+ZaSGQfKQgLS`&Zc_rNd%dhna?)icyITR!-Kq*ysFF#*6yh_rpLhPL|2&q zyxi7%MO8Ql0uub7%uJA%kGq5qDX^k+ROa^i07Z>|8zw%;-h}fHTk%N^@f^^=q0SdV0H{xz+S?NhElI(-H+Q0BF93eC z2dN>Hz6_H$$pnZ5m_De+GvmL%-PUqEW6w66YQ+=hlESZ|$F8TPnxig=1enPipfoJO zU_ zW!&R2#3wuSk`PqbNrIG7?+vtK{+nzI<%XKJ ziq=3VR&)On@gL>#Pp5#%(vZTQ4wggh%`0;*!V4Z!)^xUHtl%_{=lU9^Fjw-*6Dvzll!34Xv`g}htrv~ z6fzH6CG3=i;ABsu!ETUg`w)o-xHC;7L19ASZz7SXZkOF$|BGX+XF_n#d!L;k^F&x^ zXy_^R{$#i$yRO3md4m>XWY0j?Ho8D9M0eFCCY z`zQF&Honj+Bl~d8EA4OkPQ7de zxH*{0k>G}o-WmpU;~lAbG?Z6`q!PB}%3xv2r@uBBP!rHz_&YO{>cSB8&8r(<4ZhB# zhKLUP&s$TP*pLTGFVyrKtI&t@Ep1fwpf!&HhnC`T6QVpI1Ut(QvaptNq>mMXACzk+}#oG1^(EKp|8st%y)%+m@(Moqw|zZkid)~JJ`W_c@ee6d%?i3 Vtev%4*?{H*k~J|A6|1FR{t2F&@^1hD diff --git a/src/main/resources/assets/enderio/textures/gui/farming_station.png b/src/main/resources/assets/enderio/textures/gui/farming_station.png new file mode 100644 index 0000000000000000000000000000000000000000..f62823938957376e3da30e820c2a6fc016c99c21 GIT binary patch literal 1590 zcmcIj3rt&O6h8O%1*I*8naFTm?mCvvjSQmM1nb%hYq7!V?Y0kcc(w4p{&sU$6%&N!T|Bz?;-- zvhvG(v!hw2XV(d-Rx?*=VNBV zZ+mxJmzL)z{Rz;t_e)j&!bJh#j07|togjrheBu`wpGJ8?41hU^n2k-E6}C8fY@xNi zXKW!LJ95wPjTTZ@BDse->2~RxmraJb;CXApE1DymrKXA-ua5pH_NTttVI>oJxJE?^_pp+8EW{bcob1@h9}khFiU ztxay*iJ!D+9Uo&!`zInRsu5F5O}E;!b0xBL=VDooV-;r%{owKjdNM;iy1SBZv-^s6 zRTm8}PIo8)KkDH) z&RA=1IU}Q0d8=vhAZV2VFqjFYYo>=$D>wN|QC@4z?xV=}kgOJ7TkhLF^W)0hEnwCX zN>>aQ(y*CmcZb+HQEXdi1PQ>xz<)Dtx)jZ=P6n;0VS_^@><~}XCL^5jZFGHI>DOGK zIU^DPKeV77$zWy?hQzEym{Bv;gM1Io*q+=kfdudj=Yv=<7a6DP2Mlc=*@G zyvX=}suG}5fO+S27K!q)-T$Y;9q!L>`$`T{)!Yk(i6Te@AW*Q4)vu4VuL literal 0 HcmV?d00001 From 56f9bfa1c150f0600b3034c0939b27a944ed01a0 Mon Sep 17 00:00:00 2001 From: Trytoon Date: Sun, 17 Sep 2023 15:22:40 +0200 Subject: [PATCH 2/2] started work on collecting crops not ready yet --- .../enderio/models/item/farming_station.json | 37 ++- .../blockentity/farming/FarmingOperation.java | 8 + .../FarmingStationBlockEntity.java | 161 +++++++-- .../blockentity/farming/farmers/IFarmer.java | 39 +++ .../farming/farmers/PlantFarmer.java | 22 ++ .../farming/farmers/PumpkinFarmer.java | 22 ++ .../common/init/MachineBlockEntities.java | 1 + .../common/menu/FarmingStationMenu.java | 18 +- .../enderio/models/block/farming_station.json | 308 ++++++++++++++++++ .../enderio/textures/block/farm_base_top.png | Bin 0 -> 537 bytes .../enderio/textures/block/farm_core.png | Bin 0 -> 317 bytes .../textures/block/farm_hat_bottom.png | Bin 0 -> 424 bytes .../enderio/textures/block/farm_side.png | Bin 0 -> 627 bytes 13 files changed, 586 insertions(+), 30 deletions(-) create mode 100644 src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingOperation.java rename src/machines/java/com/enderio/machines/common/blockentity/{ => farming}/FarmingStationBlockEntity.java (63%) create mode 100644 src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/IFarmer.java create mode 100644 src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PlantFarmer.java create mode 100644 src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PumpkinFarmer.java create mode 100644 src/machines/resources/assets/enderio/models/block/farming_station.json create mode 100644 src/machines/resources/assets/enderio/textures/block/farm_base_top.png create mode 100644 src/machines/resources/assets/enderio/textures/block/farm_core.png create mode 100644 src/machines/resources/assets/enderio/textures/block/farm_hat_bottom.png create mode 100644 src/machines/resources/assets/enderio/textures/block/farm_side.png diff --git a/src/generated/resources/assets/enderio/models/item/farming_station.json b/src/generated/resources/assets/enderio/models/item/farming_station.json index 712115f1ef..ce56437eed 100644 --- a/src/generated/resources/assets/enderio/models/item/farming_station.json +++ b/src/generated/resources/assets/enderio/models/item/farming_station.json @@ -1,3 +1,38 @@ { - "parent": "enderio:block/farming_station" + "parent": "enderio:block/farming_station", + "textures": { + "particle": "enderio:block/farming_station" + }, + "display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + }, + "ground": { + "rotation": [ 0, 0, 0 ], + "translation": [ 0, 3, 0], + "scale":[ 0.25, 0.25, 0.25 ] + }, + "head": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 1, 1, 1] + }, + "fixed": { + "rotation": [ 0, 180, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.5, 0.5, 0.5 ] + }, + "thirdperson_righthand": { + "rotation": [ 75, 315, 0 ], + "translation": [ 0, 2.5, 0], + "scale": [ 0.375, 0.375, 0.375 ] + }, + "firstperson_righthand": { + "rotation": [ 0, 315, 0 ], + "translation": [ 0, 0, 0], + "scale": [ 0.4, 0.4, 0.4 ] + } + } } \ No newline at end of file diff --git a/src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingOperation.java b/src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingOperation.java new file mode 100644 index 0000000000..4049f32c68 --- /dev/null +++ b/src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingOperation.java @@ -0,0 +1,8 @@ +package com.enderio.machines.common.blockentity.farming; + +public enum FarmingOperation { + TILL, + PLANT, + CHOP, + MISC +} diff --git a/src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java b/src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingStationBlockEntity.java similarity index 63% rename from src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java rename to src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingStationBlockEntity.java index f50b3a1f49..c0da7e4e2a 100644 --- a/src/machines/java/com/enderio/machines/common/blockentity/FarmingStationBlockEntity.java +++ b/src/machines/java/com/enderio/machines/common/blockentity/farming/FarmingStationBlockEntity.java @@ -1,15 +1,19 @@ -package com.enderio.machines.common.blockentity; +package com.enderio.machines.common.blockentity.farming; import com.enderio.api.capacitor.CapacitorModifier; import com.enderio.api.capacitor.QuadraticScalable; import com.enderio.api.io.energy.EnergyIOMode; +import com.enderio.core.common.network.slot.BooleanNetworkDataSlot; +import com.enderio.core.common.network.slot.IntegerNetworkDataSlot; import com.enderio.machines.common.blockentity.base.PoweredMachineBlockEntity; +import com.enderio.machines.common.blockentity.farming.farmers.IFarmer; +import com.enderio.machines.common.blockentity.farming.farmers.PlantFarmer; +import com.enderio.machines.common.blockentity.farming.farmers.PumpkinFarmer; import com.enderio.machines.common.config.MachinesConfig; import com.enderio.machines.common.io.item.MachineInventoryLayout; import com.enderio.machines.common.io.item.MultiSlotAccess; import com.enderio.machines.common.io.item.SingleSlotAccess; import com.enderio.machines.common.menu.FarmingStationMenu; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.sounds.SoundEvents; @@ -19,12 +23,11 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.*; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.FarmBlock; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.IPlantable; +import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.templates.FluidTank; import org.jetbrains.annotations.Nullable; @@ -53,10 +56,9 @@ public class FarmingStationBlockEntity extends PoweredMachineBlockEntity { public static final MultiSlotAccess OUTPUT = new MultiSlotAccess(); //Should be dynamically increased with a better capacitor - public static final int TICK_PER_OPERATION = 5; - public static int RANGE = 4; + public static final int TICK_PER_OPERATION = 1; - public static final int GET_WATER_PER_OPERATION = 1000/ RANGE*RANGE; + public static final int GET_WATER_PER_OPERATION = 20; private int completedTicks = 0; private int counter = 0; @@ -66,8 +68,14 @@ public class FarmingStationBlockEntity extends PoweredMachineBlockEntity { public FarmingStationBlockEntity(BlockEntityType type, BlockPos worldPosition, BlockState blockState) { super(EnergyIOMode.Input, CAPACITY, USAGE, type, worldPosition, blockState); + setRange(getRange()); blocksInRange = getBlocksInRange(); - setRange(RANGE); + + rangeDataSlot = new IntegerNetworkDataSlot(this::getRange, r -> this.range = r); + addDataSlot(rangeDataSlot); + + rangeVisibleDataSlot = new BooleanNetworkDataSlot(this::isRangeVisible, b -> this.rangeVisible = b); + addDataSlot(rangeVisibleDataSlot); } @@ -100,26 +108,24 @@ protected boolean isActive() { @Override public void serverTick() { super.serverTick(); - if (canAct()) { + completedTicks = (completedTicks + 1) % TICK_PER_OPERATION; if (completedTicks == 0) { - - if (counter < blocksInRange.size()) { till(blocksInRange.get(counter).below()); plant(blocksInRange.get(counter)); boneMealBlock(); waterSoil(); - counter++; - } else { - counter = 0; + collect(blocksInRange.get(counter)); + increasePointer(); } - } } else { completedTicks = 0; + resetCounter(); } + } @Nullable @@ -133,19 +139,17 @@ public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInven return new FluidTank(2000, f -> f.getFluid().is(FluidTags.WATER)); } - public boolean acceptInput(ItemStack stack) { - return stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock() instanceof IPlantable; - } + //region operations + //Randomly choose a crop and apply bone meal on it public void boneMealBlock() { ItemStack boneMealItemStack = getFirstNonEmptyItemStack(FERTILIZERS); - Minecraft mc = Minecraft.getInstance(); - if (!boneMealItemStack.equals(ItemStack.EMPTY)) { + if (!boneMealItemStack.equals(ItemStack.EMPTY) && getEnergyStorage().getEnergyStored() >= getEnergyStorage().getMaxEnergyUse()) { Random random = new Random(); int chosenCrop = random.nextInt(blocksInRange.size()); - BoneMealItem.applyBonemeal(boneMealItemStack, level, blocksInRange.get(chosenCrop), mc.player); + BoneMealItem.applyBonemeal(boneMealItemStack, level, blocksInRange.get(chosenCrop), FakePlayerFactory.getMinecraft((net.minecraft.server.level.ServerLevel) level)); } } @@ -157,7 +161,10 @@ public void waterSoil() { BlockPos pos = getBlocksInRange().get(chosenBlock); BlockState blockState = level.getBlockState(pos.below()); - if (blockState.getBlock().equals(Blocks.FARMLAND) && GET_WATER_PER_OPERATION >= getFluidTank().getFluidAmount()) { + if (blockState.getBlock().equals(Blocks.FARMLAND) + && GET_WATER_PER_OPERATION <= getFluidTank().getFluidAmount() + && getEnergyStorage().getEnergyStored() >= getEnergyStorage().getMaxEnergyUse() + ) { this.level.setBlockAndUpdate(pos.below(), blockState.setValue(FarmBlock.MOISTURE, 7)); getFluidTank().drain(GET_WATER_PER_OPERATION, IFluidHandler.FluidAction.EXECUTE); } @@ -167,7 +174,7 @@ public void waterSoil() { public void till(BlockPos pos) { ItemStack hoe = getInventory().getStackInSlot(HOE.getIndex()); - if (!hoe.isEmpty()) { + if (!hoe.isEmpty() && getEnergyStorage().getEnergyStored() >= getEnergyStorage().getMaxEnergyUse()) { BlockState blockState = level.getBlockState(pos); if (blockState.getBlock().equals(Blocks.DIRT) || blockState.getBlock().equals(Blocks.GRASS_BLOCK)) { this.level.setBlockAndUpdate(pos, Blocks.FARMLAND.defaultBlockState()); @@ -188,10 +195,12 @@ public void plant(BlockPos pos) { Block block = ((BlockItem) inputItemStack.getItem()).getBlock(); //If the seed / sapling can be planted on the block - if (this.level.getBlockState(pos.below()).canSustainPlant(level, pos.below(), Direction.UP, (IPlantable) block)) { + if (this.level.getBlockState(pos.below()).canSustainPlant(level, pos.below(), Direction.UP, (IPlantable) block) + && block.canSurvive(this.level.getBlockState(pos), this.getLevel(), pos)) { //If the block isn't already planted if (this.level.getBlockState(pos).getBlock().equals(Blocks.AIR)) { + //Plant it and update corresponding machine slots if (this.level.setBlockAndUpdate(pos, ((IPlantable) block).getPlant(level, pos))) { inputItemStack.shrink(1); @@ -203,6 +212,53 @@ public void plant(BlockPos pos) { } } + public void collect(BlockPos pos) { + Block block = getLevel().getBlockState(pos).getBlock(); + IFarmer farmer = null; + + //We look for the good operation to do + if (block instanceof CropBlock) + farmer = new PlantFarmer(); + else if (block instanceof PumpkinBlock || block instanceof MelonBlock) + farmer = new PumpkinFarmer(); + + + //If a block can be harvested, do the operation + if (farmer != null) { + List items = farmer.doOperation(getLevel(), pos, this.level.getBlockState(pos), true); + getEnergyStorage().consumeEnergy(farmer.getCostPerOperation(), false); + + boolean canOutput = canOutput(items); + + if (canOutput) { + farmer.doOperation(getLevel(), pos, this.level.getBlockState(pos), false); + for (ItemStack loot : items) { + + for (SingleSlotAccess outputSlot : OUTPUT.getAccesses()) { + + ItemStack simulated = outputSlot.insertItem(getInventory(), loot, true); + if (simulated.isEmpty()) { + outputSlot.insertItem(getInventory(), loot, false); + break; + } + } + } + } + } + } + + + public void increasePointer() { + this.counter = (counter + 1) % blocksInRange.size(); + } + + public void resetCounter() { + this.counter = 0; + } + + //endregion + + //region inventory update //Get all blocks that are around the farming station at the same y level (sometimes need to get pos.below) List getBlocksInRange() { @@ -220,10 +276,63 @@ List getBlocksInRange() { public ItemStack getFirstNonEmptyItemStack(MultiSlotAccess slot) { for (int i = 0; i < slot.size(); i++) { ItemStack slotItemStack = slot.get(i).getItemStack(getInventory()); - if (!slotItemStack.equals(ItemStack.EMPTY) && slotItemStack.getCount() != 0) { + if (slotItemStack.isEmpty()) { return slot.get(i).getItemStack(getInventory()); } } return ItemStack.EMPTY; } + + + @Override + public int getRange() { + if (requiresCapacitor() && isCapacitorInstalled()) { + if (getCapacitorData().getBase() <= 1) + return 4; + else if (getCapacitorData().getBase() <= 2) + return 6; + else if (getCapacitorData().getBase() <= 3) + return 10; + } + return 0; + } + + @Override + public int getMaxRange() { + return 10; + } + + @Override + protected void onInventoryContentsChanged(int slot) { + super.onInventoryContentsChanged(slot); + setRange(getRange()); + blocksInRange = getBlocksInRange(); + } + + public boolean acceptInput(ItemStack stack) { + return stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock() instanceof IPlantable; + } + + public boolean canOutput(List items) { + boolean canOutput = true; + + for (ItemStack loot : items) { + canOutput = false; + + for (SingleSlotAccess outputSlot : OUTPUT.getAccesses()) { + + ItemStack simulated = outputSlot.insertItem(getInventory(), loot, true); + if (simulated.isEmpty()) { + canOutput = true; + break; + } + } + + if (!canOutput) + break; + } + + return canOutput; + } + //endregion } \ No newline at end of file diff --git a/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/IFarmer.java b/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/IFarmer.java new file mode 100644 index 0000000000..17729236f3 --- /dev/null +++ b/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/IFarmer.java @@ -0,0 +1,39 @@ +package com.enderio.machines.common.blockentity.farming.farmers; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; + +import java.util.List; + +public interface IFarmer { + + boolean canHarvest(Level level, BlockPos pos, BlockState blockState); + + default List doOperation(Level level, BlockPos pos, BlockState blockState, boolean simulate) { + NonNullList items = NonNullList.create(); + + if (canHarvest(level, pos, blockState)) { + items.addAll(Block.getDrops(blockState, (ServerLevel) level, pos, null)); + if (!simulate) { + level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + level.playSound(null, pos, getHarvestSound(), SoundSource.BLOCKS, 1.0f, 1.0f); + } + } + return items; + } + + default int getCostPerOperation() { + return 120; + } + SoundEvent getHarvestSound(); + +} diff --git a/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PlantFarmer.java b/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PlantFarmer.java new file mode 100644 index 0000000000..7bf4ce2e37 --- /dev/null +++ b/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PlantFarmer.java @@ -0,0 +1,22 @@ +package com.enderio.machines.common.blockentity.farming.farmers; + +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.NetherWartBlock; +import net.minecraft.world.level.block.state.BlockState; + +public class PlantFarmer implements IFarmer{ + + @Override + public boolean canHarvest(Level level, BlockPos pos, BlockState blockState) { + return level != null && blockState.getBlock() instanceof CropBlock && ((CropBlock) blockState.getBlock()).isMaxAge(blockState); + } + + @Override + public SoundEvent getHarvestSound() { + return SoundEvents.CROP_BREAK; + } +} diff --git a/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PumpkinFarmer.java b/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PumpkinFarmer.java new file mode 100644 index 0000000000..2a7d5930a9 --- /dev/null +++ b/src/machines/java/com/enderio/machines/common/blockentity/farming/farmers/PumpkinFarmer.java @@ -0,0 +1,22 @@ +package com.enderio.machines.common.blockentity.farming.farmers; + +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.MelonBlock; +import net.minecraft.world.level.block.PumpkinBlock; +import net.minecraft.world.level.block.state.BlockState; + +public class PumpkinFarmer implements IFarmer { + + @Override + public boolean canHarvest(Level level, BlockPos pos, BlockState blockState) { + return level != null && blockState.getBlock() instanceof PumpkinBlock || blockState.getBlock() instanceof MelonBlock; + } + + @Override + public SoundEvent getHarvestSound() { + return SoundEvents.WOOD_BREAK; + } +} diff --git a/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java b/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java index fedec1ccc1..12910a9f76 100644 --- a/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java +++ b/src/machines/java/com/enderio/machines/common/init/MachineBlockEntities.java @@ -4,6 +4,7 @@ import com.enderio.machines.common.blockentity.*; import com.enderio.machines.common.blockentity.capacitorbank.CapacitorBankBlockEntity; import com.enderio.machines.common.blockentity.capacitorbank.CapacitorTier; +import com.enderio.machines.common.blockentity.farming.FarmingStationBlockEntity; import com.enderio.machines.common.blockentity.solar.SolarPanelBlockEntity; import com.enderio.machines.common.blockentity.solar.SolarPanelTier; import com.google.common.collect.ImmutableMap; diff --git a/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java b/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java index c1baf50029..6384eda3dc 100644 --- a/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java +++ b/src/machines/java/com/enderio/machines/common/menu/FarmingStationMenu.java @@ -1,8 +1,9 @@ package com.enderio.machines.common.menu; -import com.enderio.machines.common.blockentity.FarmingStationBlockEntity; +import com.enderio.machines.common.blockentity.farming.FarmingStationBlockEntity; import com.enderio.machines.common.init.MachineMenus; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.level.block.entity.BlockEntity; @@ -10,16 +11,27 @@ import org.jetbrains.annotations.Nullable; public class FarmingStationMenu extends MachineMenu { + + public static final ResourceLocation BLOCK_ATLAS = new ResourceLocation("textures/atlas/blocks.png"); + public static final ResourceLocation EMPTY_HOE = new ResourceLocation("item/empty_slot_hoe"); + public static final ResourceLocation EMPTY_AXE = new ResourceLocation("item/empty_slot_axe"); + public static final ResourceLocation EMPTY_SHEARS = new ResourceLocation("item/empty_slot_shears"); public FarmingStationMenu(@Nullable FarmingStationBlockEntity blockEntity, Inventory inventory, int pContainerId) { super(blockEntity, inventory, MachineMenus.FARMING_STATION.get(), pContainerId); if (blockEntity != null) { + addSlot(new MachineSlot(blockEntity.getInventory(), blockEntity.getCapacitorSlot(), 12 + 42, 60)); //Tool slots - addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.HOE, 44 + 42, 19)); - addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.AXE, 62 + 42, 19)); + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.HOE, 44 + 42, 19) + .setBackground(BLOCK_ATLAS, EMPTY_HOE)); + + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.AXE, 62 + 42, 19) + .setBackground(BLOCK_ATLAS, EMPTY_AXE)); + addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.SHEARS, 80 + 42, 19)); + //Bonemeal slots for (int i = 0; i < 2; i++) { addSlot(new MachineSlot(blockEntity.getInventory(), FarmingStationBlockEntity.FERTILIZERS.get(i), 116 + 42 + 18 * i, 19)); diff --git a/src/machines/resources/assets/enderio/models/block/farming_station.json b/src/machines/resources/assets/enderio/models/block/farming_station.json new file mode 100644 index 0000000000..2d6ea712a4 --- /dev/null +++ b/src/machines/resources/assets/enderio/models/block/farming_station.json @@ -0,0 +1,308 @@ +{ +"credit": "Designed by Henryloenwind with BDcraft Cubik PRO 0.95 Beta - http://bdcraft.net", +"textures": { + "farmSide": "enderio:block/farm_side", + "farmHatBottom": "enderio:block/farm_hat_bottom", + "farmCore": "enderio:block/farm_core", + "machineBottom": "enderio:block/machine_bottom", + "machineTop": "enderio:block/machine_top", + "farmBaseTop": "enderio:block/farm_base_top" +}, +"elements": [ +{ + "__comment": "base", + "from": [ 0.25, 0.25, 0.25 ], + "to": [ 15.75, 10.75, 15.75 ], + "faces": { + "down": { "uv": [ 15.74, 15.74, 0.26, 0.26 ], "texture": "#machineBottom", "cullface": "down" }, + "up": { "uv": [ 0.26, 0.26, 15.74, 15.74 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.26, 5.26, 15.74, 15.74 ], "texture": "#farmSide", "cullface": "north" }, + "south": { "uv": [ 0.26, 5.26, 15.74, 15.74 ], "texture": "#farmSide", "cullface": "south" }, + "west": { "uv": [ 0.26, 5.26, 15.74, 15.74 ], "texture": "#farmSide", "cullface": "west" }, + "east": { "uv": [ 0.26, 5.26, 15.74, 15.74 ], "texture": "#farmSide", "cullface": "east" } + } +}, +{ + "__comment": "top", + "from": [ 0.25, 15.25, 0 ], + "to": [ 15.75, 15.75, 16 ], + "faces": { + "down": { "uv": [ 15.74, 15.99, 0.26, 0.01 ], "texture": "#farmHatBottom" }, + "up": { "uv": [ 0.26, 0.01, 15.74, 15.99 ], "texture": "#machineTop", "cullface": "up" }, + "north": { "uv": [ 0.26, 0.26, 15.74, 0.74 ], "texture": "#farmSide", "cullface": "north" }, + "south": { "uv": [ 0.26, 0.26, 15.74, 0.74 ], "texture": "#farmSide", "cullface": "south" }, + "west": { "uv": [ 0.01, 0.26, 15.99, 0.74 ], "texture": "#farmSide", "cullface": "west" }, + "east": { "uv": [ 0.01, 0.26, 15.99, 0.74 ], "texture": "#farmSide", "cullface": "east" } + } +}, +{ + "__comment": "center", + "from": [ 3, 11, 3 ], + "to": [ 13, 15, 13 ], + "faces": { + "north": { "uv": [ 3.01, 1.01, 12.99, 4.99 ], "texture": "#farmCore" }, + "south": { "uv": [ 3.01, 1.01, 12.99, 4.99 ], "texture": "#farmCore" }, + "west": { "uv": [ 3.01, 1.01, 12.99, 4.99 ], "texture": "#farmCore" }, + "east": { "uv": [ 3.01, 1.01, 12.99, 4.99 ], "texture": "#farmCore" } + } +}, +{ + "__comment": "rod1", + "from": [ 1, 10.75, 1 ], + "to": [ 2, 15.25, 2 ], + "faces": { + "north": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" }, + "south": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" }, + "west": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" }, + "east": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" } + } +}, +{ + "__comment": "rod2", + "from": [ 14, 10.75, 1 ], + "to": [ 15, 15.25, 2 ], + "faces": { + "north": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" }, + "south": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" }, + "west": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" }, + "east": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" } + } +}, +{ + "__comment": "rod3", + "from": [ 14, 10.75, 14 ], + "to": [ 15, 15.25, 15 ], + "faces": { + "north": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" }, + "south": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" }, + "west": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" }, + "east": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" } + } +}, +{ + "__comment": "rod4", + "from": [ 1, 10.75, 14 ], + "to": [ 2, 15.25, 15 ], + "faces": { + "north": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" }, + "south": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" }, + "west": { "uv": [ 14.01, 0.76, 14.99, 5.24 ], "texture": "#farmSide" }, + "east": { "uv": [ 1.01, 0.76, 1.99, 5.24 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 10, 15 ], + "to": [ 16, 11, 16 ], + "faces": { + "down": { "uv": [ 15.99, 15.99, 0.01, 15.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 15.01, 15.99, 15.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 15.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 5.01, 0.99, 5.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 0, 15 ], + "to": [ 16, 1, 16 ], + "faces": { + "down": { "uv": [ 15.99, 15.99, 0.01, 15.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 15.01, 15.99, 15.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 15.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 15.01, 0.99, 15.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 0, 0 ], + "to": [ 16, 1, 1 ], + "faces": { + "down": { "uv": [ 15.99, 0.99, 0.01, 0.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 0.01, 15.99, 0.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 15.01, 0.99, 15.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 15.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 10, 0 ], + "to": [ 16, 11, 1 ], + "faces": { + "down": { "uv": [ 15.99, 0.99, 0.01, 0.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 0.01, 15.99, 0.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 5.01, 0.99, 5.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 15.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 15, 0, 1 ], + "to": [ 16, 1, 15 ], + "faces": { + "down": { "uv": [ 0.99, 14.99, 0.01, 1.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 15.01, 1.01, 15.99, 14.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 15.01, 0.99, 15.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 15.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 1.01, 15.01, 14.99, 15.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 1.01, 15.01, 14.99, 15.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 0, 1 ], + "to": [ 1, 1, 15 ], + "faces": { + "down": { "uv": [ 15.99, 14.99, 15.01, 1.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 1.01, 0.99, 14.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 15.01, 15.01, 15.99, 15.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 15.01, 0.99, 15.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 1.01, 15.01, 14.99, 15.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 1.01, 15.01, 14.99, 15.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 10, 1 ], + "to": [ 1, 11, 15 ], + "faces": { + "down": { "uv": [ 15.99, 14.99, 15.01, 1.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 1.01, 0.99, 14.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 15.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 5.01, 0.99, 5.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 1.01, 5.01, 14.99, 5.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 1.01, 5.01, 14.99, 5.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 15, 10, 1 ], + "to": [ 16, 11, 15 ], + "faces": { + "down": { "uv": [ 0.99, 14.99, 0.01, 1.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 15.01, 1.01, 15.99, 14.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 5.01, 0.99, 5.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 15.01, 5.01, 15.99, 5.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 1.01, 5.01, 14.99, 5.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 1.01, 5.01, 14.99, 5.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 15, 1, 15 ], + "to": [ 16, 10, 16 ], + "faces": { + "down": { "uv": [ 0.99, 15.99, 0.01, 15.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 15.01, 15.01, 15.99, 15.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 1, 15 ], + "to": [ 1, 10, 16 ], + "faces": { + "down": { "uv": [ 15.99, 15.99, 15.01, 15.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 15.01, 0.99, 15.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 15, 1, 0 ], + "to": [ 16, 10, 1 ], + "faces": { + "down": { "uv": [ 0.99, 0.99, 0.01, 0.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 15.01, 0.01, 15.99, 0.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 1, 0 ], + "to": [ 1, 10, 1 ], + "faces": { + "down": { "uv": [ 15.99, 0.99, 15.01, 0.01 ], "texture": "#machineBottom" }, + "up": { "uv": [ 0.01, 0.01, 0.99, 0.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 6.01, 0.99, 14.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 15.01, 6.01, 15.99, 14.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 1, 15, 15 ], + "to": [ 15, 16, 16 ], + "faces": { + "down": { "uv": [ 14.99, 15.99, 1.01, 15.01 ], "texture": "#farmHatBottom" }, + "up": { "uv": [ 1.01, 15.01, 14.99, 15.99 ], "texture": "#machineTop" }, + "north": { "uv": [ 1.01, 0.01, 14.99, 0.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 1.01, 0.01, 14.99, 0.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 15.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 0.01, 0.99, 0.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 1, 15, 0 ], + "to": [ 15, 16, 1 ], + "faces": { + "down": { "uv": [ 14.99, 0.99, 1.01, 0.01 ], "texture": "#farmHatBottom" }, + "up": { "uv": [ 1.01, 0.01, 14.99, 0.99 ], "texture": "#machineTop" }, + "north": { "uv": [ 1.01, 0.01, 14.99, 0.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 1.01, 0.01, 14.99, 0.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 0.01, 0.99, 0.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 15.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 15, 15, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "uv": [ 0.99, 15.99, 0.01, 0.01 ], "texture": "#farmHatBottom" }, + "up": { "uv": [ 15.01, 0.01, 15.99, 15.99 ], "texture": "#machineTop" }, + "north": { "uv": [ 0.01, 0.01, 0.99, 0.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 15.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 0, 15, 0 ], + "to": [ 1, 16, 16 ], + "faces": { + "down": { "uv": [ 15.99, 15.99, 15.01, 0.01 ], "texture": "#farmHatBottom" }, + "up": { "uv": [ 0.01, 0.01, 0.99, 15.99 ], "texture": "#machineTop" }, + "north": { "uv": [ 15.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" }, + "south": { "uv": [ 0.01, 0.01, 0.99, 0.99 ], "texture": "#farmSide" }, + "west": { "uv": [ 0.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" }, + "east": { "uv": [ 0.01, 0.01, 15.99, 0.99 ], "texture": "#farmSide" } + } +}, +{ + "from": [ 2, 10.75, 2 ], + "to": [ 14, 11, 14 ], + "faces": { + "up": { "uv": [ 2.01, 2.01, 13.99, 13.99 ], "texture": "#farmBaseTop" }, + "north": { "uv": [ 2.01, 2.01, 13.99, 2.99 ], "texture": "#farmBaseTop" }, + "south": { "uv": [ 2.01, 13.01, 13.99, 13.99 ], "texture": "#farmBaseTop" }, + "west": { "uv": [ 2.01, 13.01, 13.99, 13.99 ], "texture": "#farmBaseTop" }, + "east": { "uv": [ 2.01, 2.01, 13.99, 2.99 ], "texture": "#farmBaseTop" } + } +}, +{ + "from": [ 2, 15, 2 ], + "to": [ 14, 15.25, 14 ], + "faces": { + "down": { "uv": [ 13.99, 13.99, 2.01, 2.01 ], "texture": "#farmHatBottom" }, + "north": { "uv": [ 2.01, 2.01, 13.99, 2.99 ], "texture": "#farmHatBottom" }, + "south": { "uv": [ 2.01, 13.01, 13.99, 13.99 ], "texture": "#farmHatBottom" }, + "west": { "uv": [ 2.01, 13.01, 13.99, 13.99 ], "texture": "#farmHatBottom" }, + "east": { "uv": [ 2.01, 2.01, 13.99, 2.99 ], "texture": "#farmHatBottom" } + } +} +] +} \ No newline at end of file diff --git a/src/machines/resources/assets/enderio/textures/block/farm_base_top.png b/src/machines/resources/assets/enderio/textures/block/farm_base_top.png new file mode 100644 index 0000000000000000000000000000000000000000..1785b2b9f8961e62b00e3bc1a386179f3523b108 GIT binary patch literal 537 zcmV+!0_OdRP)N2bZe?^J zG%heMGBNQWX_Wu~0hUQbK~y+TU6O}x!axv2{Rb)Z5=!VL1QH;C!8RC!ap(}z{{KJn zP8*$~NTb#IZf19O&xSqfFQyaE8P6uexox`Eh)6yi56DRb{bpf`k`7ZDznGCv0a5=22h3sR!+-_7l&8j4=TIr!$BsR+ToRo6u({@D@ zBk-maes0yX$!IPW`v(rwu}~qCMDr`~UHj{8PvLwz&Nav+A|k$vhm(<;RP>e;1o&ha zV>z=vPFq?Fn`?M~1%L#5hxL+u80?4n5I_~+0ft0ja|i)}>cCnNP=LEc_*$1lAh`em zi&8UK!yc0#LT=By}Z;C1rt33JtM=93Yk-ZigtOr zIEHw5zny%V>yUwf>u<(ev(&=wX2fsHytL~7|I)af0!~Nfx=v`^JYyzbvBI6S?#+hZ zZ%&*&pKsZkEss9zxSnCy^Zc`kROpM?cW(vsR8nGV`*v1FC*8RV1am#i1-GEBP}AfV)d(dI69NM1bAFJ zG?RGEA5FQ#S>yZRyX6TT=_II}1TG;+8oG>I$y*m~fmy4CX4DO=90x&ZVAgQu&X J%Q~loCIDGScUS-b literal 0 HcmV?d00001 diff --git a/src/machines/resources/assets/enderio/textures/block/farm_hat_bottom.png b/src/machines/resources/assets/enderio/textures/block/farm_hat_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..4259c7ad1d2ca0e93b0238a00914ca5634e562af GIT binary patch literal 424 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DDyK$uZbZ`*dDpk#?_L`iUdT1k0gQ7S`0VrE{6US4X6f{C7io{`~4h0Li842-It zE{-7<{<)Jn^9~#EIDZz5HeYjmo66bR<(W}AzyIIAB^<$#7uX<>5j{oYcHmt3-@90H zXA19LCBR-F_}o>>T_%3|&-c5y>|Y-eit)Q#DdnV-94{v$Dp|)C8+CkvKWfte)zj5d8H5v;PaT*+x z__1B`MXLilpRTP}g6xhkmNkDP3ix&kheUR%UVEo_rg+}b_~i?Y8Pl#+Ug1fc)W6V| z<&JvUnM=(IIZI_Zclf_?@tv6HXIydB;3{kJ{aFmrdn~if1>D-LW~kPQZa;GR@)JfC z&H|x4CLKdwUxPLw2ZnN{4U8TNpOU`)ln_s6$Y)}A`J3(~bh5cYsrNslU3iwP(+o)? QV5l;9y85}Sb4q9e069~d$N&HU literal 0 HcmV?d00001 diff --git a/src/machines/resources/assets/enderio/textures/block/farm_side.png b/src/machines/resources/assets/enderio/textures/block/farm_side.png new file mode 100644 index 0000000000000000000000000000000000000000..5fce227ef2fad23bda045491562a1b4ab97e60a4 GIT binary patch literal 627 zcmV-(0*w8MP)N2bZe?^J zG%heMGBNQWX_Wu~0q{vgK~zXfz1Hh)sz4Zp;a<^Bx3wNXP67%jD4=-iVehv0e+^yD zYs|Fiucl-2Bu+kImV7XSH_rWE@yGY#jrtNzMl$ur!Z-~lLM8Scp&mE`Va&NyFz(-q z{Q$FMgZ%)SV~_m+chIxSe!!P|^6Rb@FpE4f7gQ3s!m?saon=LxiitYMu!MgYz+6;J z-vluAW>v^xvyxL+3*%i=3g4nBGg&WY7ge6fsz}AGuz6f7psSaXgcEr>wDNr1$jjqS z%*x}wk>hqHr*19Vbs-!RPDavJxzH&40Yw@K4S9P$2vabfi78AEyIS^bDX&j^;mGR- zWN{$J?OOgnbn@@C6=Fau7&A4MU9%Jd%wu>QcyR3p%%{HW+e#v>BX3;hsboobQOu^o zcpeABIMv#Wyjbfoa5>i<-buZj3(M1f0NVr0XR6ijJLbhQK5VKB+S1jFi?+(7Ud}`r znt_0Gi_8Fi%g+LuQj>lJ$fp24G`To~p0M2VG!h!Jn8(7{WHu*ohcf8>5jKqTV`@Es z4VD(M&}oI)95x0XN7};nK;P9Ip>@P$u`lPBzJC6f0L}HA0iipTA`OK`ae+jFn?{{u zz*)$XKp3Z?E9dRndH^prE{75~hnvrsN12NGQsi~Zm~*M%D*vwgx9^#KE(fxX3!DG| N002ovPDHLkV1iYR7U}>1 literal 0 HcmV?d00001