diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockBlastFurnaceBooster.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockBlastFurnaceBooster.java index 42bbd13e..27978620 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockBlastFurnaceBooster.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockBlastFurnaceBooster.java @@ -8,14 +8,25 @@ import net.minecraft.block.HorizontalBlock; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.shapes.VoxelShapes; +import net.minecraft.world.IBlockReader; public class BlockBlastFurnaceBooster extends BlockContainerImpl { public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; + private static final VoxelShape SHAPE = VoxelShapes.create(1 / 16F, 0, 1 / 16F, 15 / 16F, 1, 15 / 16F); public BlockBlastFurnaceBooster() { super("blast_furnace_booster", TileEntityBlastFurnaceBooster::new, Block.Properties.from(Blocks.BLAST_FURNACE)); } + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return SHAPE; + } + @Override protected void fillStateContainer(StateContainer.Builder builder) { builder.add(FACING); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityBlastFurnaceBooster.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityBlastFurnaceBooster.java index 71d80577..dbafd427 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityBlastFurnaceBooster.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityBlastFurnaceBooster.java @@ -8,8 +8,14 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraft.tileentity.BlastFurnaceTileEntity; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.IIntArray; import net.minecraft.util.math.BlockPos; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.IItemHandlerModifiable; + +import javax.annotation.Nonnull; public class TileEntityBlastFurnaceBooster extends TileEntityImpl implements ITickableTileEntity { @@ -58,4 +64,58 @@ public class TileEntityBlastFurnaceBooster extends TileEntityImpl implements ITi PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), PacketParticles.Type.BLAST_FURNACE_BOOSTER, 1)); } + + @Override + public IItemHandlerModifiable getItemHandler(Direction facing) { + TileEntity below = this.world.getTileEntity(this.pos.down()); + if (!(below instanceof BlastFurnaceTileEntity)) + return null; + IItemHandler handler = below.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).orElse(null); + if (handler == null) + return null; + return new IItemHandlerModifiable() { + @Override + public void setStackInSlot(int slot, @Nonnull ItemStack stack) { + if (handler instanceof IItemHandlerModifiable) + ((IItemHandlerModifiable) handler).setStackInSlot(0, stack); + } + + @Override + public int getSlots() { + return 1; + } + + @Nonnull + @Override + public ItemStack getStackInSlot(int slot) { + return handler.getStackInSlot(0); + } + + @Nonnull + @Override + public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { + return handler.insertItem(0, stack, simulate); + } + + @Nonnull + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate) { + return handler.extractItem(0, amount, simulate); + } + + @Override + public int getSlotLimit(int slot) { + return handler.getSlotLimit(0); + } + + @Override + public boolean isItemValid(int slot, @Nonnull ItemStack stack) { + return handler.isItemValid(0, stack); + } + }; + } + + @Override + public void dropInventory() { + } } diff --git a/src/main/resources/assets/naturesaura/lang/en_us.json b/src/main/resources/assets/naturesaura/lang/en_us.json index 20240c7d..5b838bff 100644 --- a/src/main/resources/assets/naturesaura/lang/en_us.json +++ b/src/main/resources/assets/naturesaura/lang/en_us.json @@ -53,6 +53,7 @@ "block.naturesaura.dimension_rail_end": "Rail of the End", "block.naturesaura.dimension_rail_nether": "Rail of the Nether", "block.naturesaura.projectile_generator": "Shooting Mark", + "block.naturesaura.blast_furnace_booster": "Armorer's Aid", "item.naturesaura.eye": "Environmental Eye", "item.naturesaura.eye_improved": "Environmental Ocular", "item.naturesaura.gold_fiber": "Brilliant Fiber", diff --git a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/using/blast_furnace_booster.json b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/using/blast_furnace_booster.json new file mode 100644 index 00000000..f2422e84 --- /dev/null +++ b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/using/blast_furnace_booster.json @@ -0,0 +1,21 @@ +{ + "name": "Armorer's Aid", + "icon": "naturesaura:blast_furnace_booster", + "category": "using", + "advancement": "naturesaura:offering", + "pages": [ + { + "type": "text", + "text": "Ever since villager scientists have discovered the use of higher tier materials to create a $(item)Blast Furnace$(), magical botanists have attempted to further improve upon this technology. They have found that $(aura) might be capable of purifying any kind of $(thing)ore$() to a point where it has a chance of producing $(thing)two ingots$() rather than one." + }, + { + "type": "text", + "text": "These capabilities can be introduced through an $(item)Armorer's Aid$(), which simply has to be placed on top of a $(item)Blast Furnace$().$(p)It should be noted, for the sake of $(thing)automation$(), that ores can be inserted into any side of the $(item)Armorer's Aid$() using a $(item)Hopper$() or similar device. This will cause the items to end up in the smelting area as if they were fed directly into the top of the $(item)Blast Furnace$()." + }, + { + "type": "crafting", + "text": "Creating the $(item)Armorer's Aid$()", + "recipe": "naturesaura:blast_furnace_booster" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/recipes/blast_furnace_booster.json b/src/main/resources/data/naturesaura/recipes/blast_furnace_booster.json new file mode 100644 index 00000000..4c06706b --- /dev/null +++ b/src/main/resources/data/naturesaura/recipes/blast_furnace_booster.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "CCC", + "THT", + "IBI" + ], + "key": { + "H": { + "item": "naturesaura:furnace_heater" + }, + "B": { + "item": "minecraft:blast_furnace" + }, + "T": { + "item": "naturesaura:token_terror" + }, + "C": { + "item": "minecraft:cobblestone" + }, + "I": { + "item": "naturesaura:infused_iron" + } + }, + "result": { + "item": "naturesaura:blast_furnace_booster" + } +} \ No newline at end of file