chore: some blocks ported and INamedProviders added to tiles

This commit is contained in:
Michael Hillcox 2021-03-01 17:46:12 +00:00
parent fcb150ebaf
commit 0e4a65354f
26 changed files with 875 additions and 428 deletions

View file

@ -10,34 +10,24 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFarmer extends BlockContainerBase { public class BlockFarmer extends DirectionalBlock.Container {
public BlockFarmer() { public BlockFarmer() {
super(Material.ROCK, this.name); super(ActuallyBlocks.defaultPickProps(0));
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
} }
@Override @Override
@ -47,50 +37,20 @@ public class BlockFarmer extends BlockContainerBase {
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) { return this.openGui(worldIn, player, pos, TileEntityFarmer.class);
TileEntityFarmer farmer = (TileEntityFarmer) world.getTileEntity(pos); }
if (farmer != null) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FARMER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); @Override
} public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return true; switch (state.get(FACING)) {
case EAST:
return Shapes.FarmerShapes.SHAPE_E;
case SOUTH:
return Shapes.FarmerShapes.SHAPE_S;
case WEST:
return Shapes.FarmerShapes.SHAPE_W;
default:
return Shapes.FarmerShapes.SHAPE_N;
} }
return true;
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockHorizontal.FACING, Direction.byHorizontalIndex(meta));
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BlockHorizontal.FACING);
}
@Override
public BlockState withRotation(BlockState state, Rotation rot) {
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
}
@Override
public BlockState withMirror(BlockState state, Mirror mirror) {
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
} }
} }

View file

@ -10,28 +10,24 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import net.minecraft.block.SoundType; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFeeder extends BlockContainerBase { public class BlockFeeder extends BlockContainerBase {
public BlockFeeder() { public BlockFeeder() {
super(Material.ROCK, this.name); super(ActuallyBlocks.defaultPickProps(0, 0.5F, 6.0F));
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(6.0F);
this.setSoundType(SoundType.STONE);
} }
@Override @Override
@ -41,18 +37,11 @@ public class BlockFeeder extends BlockContainerBase {
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) { return this.openGui(worldIn, player, pos, TileEntityFeeder.class);
TileEntityFeeder feeder = (TileEntityFeeder) world.getTileEntity(pos);
if (feeder != null) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
return true;
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return EnumRarity.UNCOMMON; return Shapes.FEEDER_SHAPE;
} }
} }

View file

@ -10,38 +10,29 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.network.NetworkHooks;
public class BlockFermentingBarrel extends BlockContainerBase { public class BlockFermentingBarrel extends BlockContainerBase {
public BlockFermentingBarrel() { public BlockFermentingBarrel() {
super(Material.WOOD, this.name); super(Properties.create(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).hardnessAndResistance(0.5F, 5.0F).sound(SoundType.WOOD));
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
this.setSoundType(SoundType.WOOD);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
} }
@Override @Override
@ -50,21 +41,21 @@ public class BlockFermentingBarrel extends BlockContainerBase {
} }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if (!world.isRemote) { if (!world.isRemote) {
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos); TileEntityFermentingBarrel press = (TileEntityFermentingBarrel) world.getTileEntity(pos);
if (press != null) { if (press != null) {
if (!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)) { if (!this.tryUseItemOnTank(player, hand, press.canolaTank) && !this.tryUseItemOnTank(player, hand, press.oilTank)) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); NetworkHooks.openGui((ServerPlayerEntity) player, press, pos);
} }
} }
return true; return ActionResultType.PASS;
} }
return true; return ActionResultType.PASS;
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return EnumRarity.RARE; return Shapes.BARREL_SHAPE;
} }
} }

View file

@ -10,41 +10,32 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import net.minecraft.block.SoundType; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFireworkBox extends BlockContainerBase { public class BlockFireworkBox extends BlockContainerBase {
public BlockFireworkBox() { public BlockFireworkBox() {
super(Material.ROCK, this.name); super(ActuallyBlocks.defaultPickProps(0));
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
} }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (this.tryToggleRedstone(world, pos, player)) { if (this.tryToggleRedstone(world, pos, player)) {
return true; return ActionResultType.PASS;
} else if (!world.isRemote) {
TileEntityFireworkBox grinder = (TileEntityFireworkBox) world.getTileEntity(pos);
if (grinder != null) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FIREWORK_BOX.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
}
} }
return true;
return this.openGui(world, player, pos, TileEntityFireworkBox.class);
} }
@Override @Override
@ -53,7 +44,7 @@ public class BlockFireworkBox extends BlockContainerBase {
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return EnumRarity.RARE; return Shapes.FIREWORKS_BOX_SHAPE;
} }
} }

View file

@ -10,38 +10,27 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import net.minecraft.block.BlockDirectional; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFluidCollector extends BlockContainerBase { public class BlockFluidCollector extends FullyDirectionalBlock.Container {
private final boolean isPlacer; private final boolean isPlacer;
public BlockFluidCollector(boolean isPlacer) { public BlockFluidCollector(boolean isPlacer) {
super(Material.ROCK, this.name); super(ActuallyBlocks.defaultPickProps(0));
this.isPlacer = isPlacer; this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
} }
@Override @Override
@ -52,57 +41,29 @@ public class BlockFluidCollector extends BlockContainerBase {
} }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (this.tryToggleRedstone(world, pos, player)) { if (this.tryToggleRedstone(world, pos, player)) {
return true; return ActionResultType.PASS;
} }
if (!world.isRemote) {
TileEntityFluidCollector collector = (TileEntityFluidCollector) world.getTileEntity(pos); return this.openGui(world, player, pos, TileEntityFluidCollector.class);
if (collector != null) { }
if (!this.tryUseItemOnTank(player, hand, collector.tank)) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FLUID_COLLECTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); @Override
} public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
} switch (state.get(FACING)) {
return true; case UP:
return Shapes.FluidCollectorShapes.SHAPE_U;
case DOWN:
return Shapes.FluidCollectorShapes.SHAPE_D;
case EAST:
return Shapes.FluidCollectorShapes.SHAPE_E;
case SOUTH:
return Shapes.FluidCollectorShapes.SHAPE_S;
case WEST:
return Shapes.FluidCollectorShapes.SHAPE_W;
default:
return Shapes.FluidCollectorShapes.SHAPE_N;
} }
return true;
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) {
int rotation = Direction.getDirectionFromEntityLiving(pos, player).ordinal();
world.setBlockState(pos, this.getStateFromMeta(rotation), 2);
super.onBlockPlacedBy(world, pos, state, player, stack);
}
@Override
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(BlockDirectional.FACING, Direction.byIndex(meta));
}
@Override
public int getMetaFromState(BlockState state) {
return state.getValue(BlockDirectional.FACING).getIndex();
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BlockDirectional.FACING);
}
@Override
public BlockState withRotation(BlockState state, Rotation rot) {
return state.withProperty(BlockDirectional.FACING, rot.rotate(state.getValue(BlockDirectional.FACING)));
}
@Override
public BlockState withMirror(BlockState state, Mirror mirror) {
return this.withRotation(state, mirror.toRotation(state.getValue(BlockDirectional.FACING)));
} }
} }

View file

@ -10,48 +10,39 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
import static net.minecraft.state.properties.BlockStateProperties.LIT;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumRarity; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack; import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockAccess; import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraft.world.server.ServerWorld;
import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockFurnaceDouble extends BlockContainerBase { public class BlockFurnaceDouble extends BlockContainerBase {
public static final PropertyBool IS_ON = PropertyBool.create("on");
public BlockFurnaceDouble() { public BlockFurnaceDouble() {
super(Material.ROCK, this.name); // TODO: [port] confirm this is correct for light level... Might not be reactive.
this.setHarvestLevel("pickaxe", 0); super(ActuallyBlocks.defaultPickProps(0).tickRandomly().setLightLevel(state -> state.get(LIT)
this.setHardness(1.5F); ? 12
this.setResistance(10.0F); : 0));
this.setSoundType(SoundType.STONE);
this.setTickRandomly(true); this.setDefaultState(this.stateContainer.getBaseState().with(HORIZONTAL_FACING, Direction.NORTH).with(LIT, false));
} }
@Override @Override
@ -60,92 +51,55 @@ public class BlockFurnaceDouble extends BlockContainerBase {
} }
@Override @Override
@OnlyIn(Dist.CLIENT) public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) { if (state.get(LIT)) {
if (state.getValue(IS_ON)) {
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D); worldIn.addParticle(ParticleTypes.SMOKE, (double) pos.getX() + 0.5F, (double) pos.getY() + 1.0F, (double) pos.getZ() + 0.5F, 0.0D, 0.0D, 0.0D);
} }
} }
} }
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) { return this.openGui(worldIn, player, pos, TileEntityFurnaceDouble.class);
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble) world.getTileEntity(pos);
if (furnace != null) {
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FURNACE_DOUBLE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
return true;
} }
@Override @Override
public int getLightValue(BlockState state, IBlockAccess world, BlockPos pos) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return state.getValue(IS_ON) return this.getDefaultState().with(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).with(LIT, false);
? 12
: 0;
} }
@Override @Override
public EnumRarity getRarity(ItemStack stack) { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
return EnumRarity.UNCOMMON; builder.add(LIT).add(HORIZONTAL_FACING);
} }
// TODO: [port] add back
// public static class TheItemBlock extends ItemBlockBase {
//
// public TheItemBlock(Block block) {
// super(block);
// }
//
// @Override
// public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
// tooltip.add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".previouslyDoubleFurnace"));
// }
// }
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
world.setBlockState(pos, state.withProperty(BlockHorizontal.FACING, player.getHorizontalFacing().getOpposite()), 2); switch (state.get(HORIZONTAL_FACING)) {
case EAST:
super.onBlockPlacedBy(world, pos, state, player, stack); return Shapes.FurnaceDoubleShapes.SHAPE_E;
} case SOUTH:
return Shapes.FurnaceDoubleShapes.SHAPE_S;
@Override case WEST:
public BlockState getStateFromMeta(int meta) { return Shapes.FurnaceDoubleShapes.SHAPE_W;
boolean isOn = meta >= 4; default:
Direction facing = Direction.byHorizontalIndex(isOn return Shapes.FurnaceDoubleShapes.SHAPE_N;
? meta - 4
: meta);
return this.getDefaultState().withProperty(BlockHorizontal.FACING, facing).withProperty(IS_ON, isOn);
}
@Override
public int getMetaFromState(BlockState state) {
int meta = state.getValue(BlockHorizontal.FACING).getHorizontalIndex();
return state.getValue(IS_ON)
? meta + 4
: meta;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BlockHorizontal.FACING, IS_ON);
}
@Override
public BlockState withRotation(BlockState state, Rotation rot) {
return state.withProperty(BlockHorizontal.FACING, rot.rotate(state.getValue(BlockHorizontal.FACING)));
}
@Override
public BlockState withMirror(BlockState state, Mirror mirror) {
return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING)));
}
@Override
protected ItemBlockBase getItemBlock() {
return new TheItemBlock(this);
}
public static class TheItemBlock extends ItemBlockBase {
public TheItemBlock(Block block) {
super(block);
}
@Override
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("tooltip." + ActuallyAdditions.MODID + ".previouslyDoubleFurnace"));
} }
} }
} }

View file

@ -5,6 +5,7 @@ import net.minecraft.util.math.shapes.IBooleanFunction;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import java.util.Optional;
import java.util.stream.Stream; import java.util.stream.Stream;
public class Shapes { public class Shapes {
@ -79,6 +80,47 @@ public class Shapes {
Block.makeCuboidShape(0, 4, 4, 1, 12, 6), Block.makeCuboidShape(15, 4, 10, 16, 12, 12) Block.makeCuboidShape(0, 4, 4, 1, 12, 6), Block.makeCuboidShape(15, 4, 10, 16, 12, 12)
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
static final VoxelShape BARREL_SHAPE = Stream.of(
Block.makeCuboidShape(0, 12, 0, 16, 14, 1), Block.makeCuboidShape(1, 0.5, 1, 15, 15, 15),
Block.makeCuboidShape(0, 2, 15, 16, 4, 16), Block.makeCuboidShape(0, 7, 15, 16, 9, 16),
Block.makeCuboidShape(0, 12, 15, 16, 14, 16), Block.makeCuboidShape(0, 2, 0, 16, 4, 1),
Block.makeCuboidShape(0, 7, 0, 16, 9, 1), Block.makeCuboidShape(0, 2, 1, 1, 4, 15),
Block.makeCuboidShape(0, 7, 1, 1, 9, 15), Block.makeCuboidShape(0, 12, 1, 1, 14, 15),
Block.makeCuboidShape(15, 12, 1, 16, 14, 15), Block.makeCuboidShape(15, 7, 1, 16, 9, 15),
Block.makeCuboidShape(15, 2, 1, 16, 4, 15), Block.makeCuboidShape(7, 0, 0.5, 9, 16, 1.5),
Block.makeCuboidShape(0.5, 0, 7, 1.5, 16, 9), Block.makeCuboidShape(7, 0, 14.5, 9, 16, 15.5),
Block.makeCuboidShape(14.5, 0, 7, 15.5, 16, 9), Block.makeCuboidShape(2, 0, 0.5, 5, 16, 1.5),
Block.makeCuboidShape(0.5, 0, 11, 1.5, 16, 14), Block.makeCuboidShape(2, 0, 14.5, 5, 16, 15.5),
Block.makeCuboidShape(14.5, 0, 11, 15.5, 16, 14), Block.makeCuboidShape(11, 0, 0.5, 14, 16, 1.5),
Block.makeCuboidShape(0.5, 0, 2, 1.5, 16, 5), Block.makeCuboidShape(11, 0, 14.5, 14, 16, 15.5),
Block.makeCuboidShape(14.5, 0, 2, 15.5, 16, 5), Block.makeCuboidShape(4, 15, 7, 6, 15.3, 9),
Block.makeCuboidShape(2, 15, 4, 3, 15.3, 12), Block.makeCuboidShape(4, 15, 13, 12, 15.3, 14),
Block.makeCuboidShape(4, 15, 2, 12, 15.3, 3), Block.makeCuboidShape(13, 15, 4, 14, 15.3, 12),
Block.makeCuboidShape(3, 15, 3, 4, 15.3, 4), Block.makeCuboidShape(3, 15, 12, 4, 15.3, 13),
Block.makeCuboidShape(12, 15, 3, 13, 15.3, 4), Block.makeCuboidShape(12, 15, 12, 13, 15.3, 13)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape FIREWORKS_BOX_SHAPE = Stream.of(
Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 0, 15, 15, 1, 16),
Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 0, 0, 15, 1, 1),
Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16),
Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(10, 14, 9, 12, 15, 10), Block.makeCuboidShape(7, 14, 9, 9, 15, 10),
Block.makeCuboidShape(4, 14, 9, 6, 15, 10), Block.makeCuboidShape(10, 14, 6, 12, 15, 7),
Block.makeCuboidShape(7, 14, 6, 9, 15, 7), Block.makeCuboidShape(4, 14, 6, 6, 15, 7),
Block.makeCuboidShape(6, 14, 4, 7, 15, 12), Block.makeCuboidShape(9, 14, 4, 10, 15, 12),
Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4),
Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 14, 2, 4, 15, 14),
Block.makeCuboidShape(2, 13, 2, 14, 14, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14),
Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14),
Block.makeCuboidShape(1, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final class CoalGeneratorShapes { static final class CoalGeneratorShapes {
static final VoxelShape NORTH = Stream.of( static final VoxelShape NORTH = Stream.of(
@ -320,4 +362,303 @@ public class Shapes {
Block.makeCuboidShape(0, 6, 11, 1, 10, 13), Block.makeCuboidShape(0, 6, 3, 1, 10, 5) Block.makeCuboidShape(0, 6, 11, 1, 10, 13), Block.makeCuboidShape(0, 6, 3, 1, 10, 5)
).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get(); ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();
} }
static class FarmerShapes {
static final VoxelShape SHAPE_N = Stream.of(
Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(0, 0, 0, 1, 1, 16),
Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 0, 0, 16, 1, 16),
Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 15, 0, 1, 16, 16),
Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1),
Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(4, 11, 4, 12, 12, 12),
Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(3, 12, 5, 4, 14, 11),
Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(5, 12, 3, 11, 14, 4),
Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(11, 12, 11, 12, 14, 12),
Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(4, 12, 4, 5, 14, 5),
Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(4, 14, 11, 5, 15, 12),
Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(2, 14, 2, 4, 15, 14),
Block.makeCuboidShape(4, 14, 2, 12, 15, 4), Block.makeCuboidShape(4, 14, 12, 12, 15, 14),
Block.makeCuboidShape(12, 14, 2, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14),
Block.makeCuboidShape(1, 0, 2, 2, 15, 14), Block.makeCuboidShape(14, 0, 2, 15, 15, 14),
Block.makeCuboidShape(1, 0, 1, 5, 15, 2), Block.makeCuboidShape(5, 5, 2, 11, 11, 3),
Block.makeCuboidShape(5, 0, 1, 11, 5, 2), Block.makeCuboidShape(5, 11, 1, 11, 15, 2),
Block.makeCuboidShape(11, 0, 1, 15, 15, 2), Block.makeCuboidShape(1, 0, 14, 15, 15, 15)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_E = Stream.of(
Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(0, 0, 0, 16, 1, 1),
Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 0, 15, 16, 1, 16),
Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1),
Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(15, 15, 1, 16, 16, 15),
Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(4, 11, 4, 12, 12, 12),
Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(5, 12, 3, 11, 14, 4),
Block.makeCuboidShape(5, 12, 12, 11, 14, 13), Block.makeCuboidShape(12, 12, 5, 13, 14, 11),
Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(4, 12, 11, 5, 14, 12),
Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 12, 4, 12, 14, 5),
Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 14, 4, 5, 15, 5),
Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(2, 14, 2, 14, 15, 4),
Block.makeCuboidShape(12, 14, 4, 14, 15, 12), Block.makeCuboidShape(2, 14, 4, 4, 15, 12),
Block.makeCuboidShape(2, 14, 12, 14, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14),
Block.makeCuboidShape(2, 0, 1, 14, 15, 2), Block.makeCuboidShape(2, 0, 14, 14, 15, 15),
Block.makeCuboidShape(14, 0, 1, 15, 15, 5), Block.makeCuboidShape(13, 5, 5, 14, 11, 11),
Block.makeCuboidShape(14, 0, 5, 15, 5, 11), Block.makeCuboidShape(14, 11, 5, 15, 15, 11),
Block.makeCuboidShape(14, 0, 11, 15, 15, 15), Block.makeCuboidShape(1, 0, 1, 2, 15, 15)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_S = Stream.of(
Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(15, 0, 0, 16, 1, 16),
Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 0, 0, 1, 1, 16),
Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16),
Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16),
Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(4, 11, 4, 12, 12, 12),
Block.makeCuboidShape(11, 14, 11, 12, 15, 12), Block.makeCuboidShape(12, 12, 5, 13, 14, 11),
Block.makeCuboidShape(3, 12, 5, 4, 14, 11), Block.makeCuboidShape(5, 12, 12, 11, 14, 13),
Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(4, 12, 4, 5, 14, 5),
Block.makeCuboidShape(4, 12, 11, 5, 14, 12), Block.makeCuboidShape(11, 12, 11, 12, 14, 12),
Block.makeCuboidShape(11, 12, 4, 12, 14, 5), Block.makeCuboidShape(11, 14, 4, 12, 15, 5),
Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(12, 14, 2, 14, 15, 14),
Block.makeCuboidShape(4, 14, 12, 12, 15, 14), Block.makeCuboidShape(4, 14, 2, 12, 15, 4),
Block.makeCuboidShape(2, 14, 2, 4, 15, 14), Block.makeCuboidShape(2, 0, 2, 14, 1, 14),
Block.makeCuboidShape(14, 0, 2, 15, 15, 14), Block.makeCuboidShape(1, 0, 2, 2, 15, 14),
Block.makeCuboidShape(11, 0, 14, 15, 15, 15), Block.makeCuboidShape(5, 5, 13, 11, 11, 14),
Block.makeCuboidShape(5, 0, 14, 11, 5, 15), Block.makeCuboidShape(5, 11, 14, 11, 15, 15),
Block.makeCuboidShape(1, 0, 14, 5, 15, 15), Block.makeCuboidShape(1, 0, 1, 15, 15, 2)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_W = Stream.of(
Block.makeCuboidShape(4, 14, 4, 5, 15, 5), Block.makeCuboidShape(0, 0, 15, 16, 1, 16),
Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1),
Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16),
Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15),
Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(4, 11, 4, 12, 12, 12),
Block.makeCuboidShape(4, 14, 11, 5, 15, 12), Block.makeCuboidShape(5, 12, 12, 11, 14, 13),
Block.makeCuboidShape(5, 12, 3, 11, 14, 4), Block.makeCuboidShape(3, 12, 5, 4, 14, 11),
Block.makeCuboidShape(12, 12, 5, 13, 14, 11), Block.makeCuboidShape(11, 12, 4, 12, 14, 5),
Block.makeCuboidShape(4, 12, 4, 5, 14, 5), Block.makeCuboidShape(4, 12, 11, 5, 14, 12),
Block.makeCuboidShape(11, 12, 11, 12, 14, 12), Block.makeCuboidShape(11, 14, 11, 12, 15, 12),
Block.makeCuboidShape(11, 14, 4, 12, 15, 5), Block.makeCuboidShape(2, 14, 12, 14, 15, 14),
Block.makeCuboidShape(2, 14, 4, 4, 15, 12), Block.makeCuboidShape(12, 14, 4, 14, 15, 12),
Block.makeCuboidShape(2, 14, 2, 14, 15, 4), Block.makeCuboidShape(2, 0, 2, 14, 1, 14),
Block.makeCuboidShape(2, 0, 14, 14, 15, 15), Block.makeCuboidShape(2, 0, 1, 14, 15, 2),
Block.makeCuboidShape(1, 0, 11, 2, 15, 15), Block.makeCuboidShape(2, 5, 5, 3, 11, 11),
Block.makeCuboidShape(1, 0, 5, 2, 5, 11), Block.makeCuboidShape(1, 11, 5, 2, 15, 11),
Block.makeCuboidShape(1, 0, 1, 2, 15, 5), Block.makeCuboidShape(14, 0, 1, 15, 15, 15)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
}
static class FluidCollectorShapes {
static final VoxelShape SHAPE_U = Stream.of(
Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16),
Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 0, 15, 16, 1, 16),
Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 15, 1, 1, 16, 15),
Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 0, 1, 16, 1, 15),
Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(15, 3, 6, 16, 13, 10),
Block.makeCuboidShape(0, 3, 6, 1, 13, 10), Block.makeCuboidShape(5, 15, 5, 11, 16, 11),
Block.makeCuboidShape(3, 15, 6, 5, 16, 10), Block.makeCuboidShape(11, 15, 6, 13, 16, 10),
Block.makeCuboidShape(6, 15, 11, 10, 16, 13), Block.makeCuboidShape(6, 15, 3, 10, 16, 5)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_D = Stream.of(
Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 0, 0, 16, 1, 1),
Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1),
Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(0, 0, 1, 1, 1, 15),
Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15),
Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(15, 3, 6, 16, 13, 10),
Block.makeCuboidShape(0, 3, 6, 1, 13, 10), Block.makeCuboidShape(5, 0, 5, 11, 1, 11),
Block.makeCuboidShape(3, 0, 6, 5, 1, 10), Block.makeCuboidShape(11, 0, 6, 13, 1, 10),
Block.makeCuboidShape(6, 0, 3, 10, 1, 5), Block.makeCuboidShape(6, 0, 11, 10, 1, 13)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_N = Stream.of(
Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 0, 16, 16, 1),
Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16),
Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 1, 1, 16, 15),
Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15),
Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(15, 6, 3, 16, 10, 13),
Block.makeCuboidShape(0, 6, 3, 1, 10, 13), Block.makeCuboidShape(5, 5, 0, 11, 11, 1),
Block.makeCuboidShape(3, 6, 0, 5, 10, 1), Block.makeCuboidShape(11, 6, 0, 13, 10, 1),
Block.makeCuboidShape(6, 11, 0, 10, 13, 1), Block.makeCuboidShape(6, 3, 0, 10, 5, 1)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_E = Stream.of(
Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(15, 15, 0, 16, 16, 16),
Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16),
Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1),
Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16),
Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(3, 6, 15, 13, 10, 16),
Block.makeCuboidShape(3, 6, 0, 13, 10, 1), Block.makeCuboidShape(15, 5, 5, 16, 11, 11),
Block.makeCuboidShape(15, 6, 3, 16, 10, 5), Block.makeCuboidShape(15, 6, 11, 16, 10, 13),
Block.makeCuboidShape(15, 11, 6, 16, 13, 10), Block.makeCuboidShape(15, 3, 6, 16, 5, 10)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_S = Stream.of(
Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 15, 16, 16, 16),
Block.makeCuboidShape(0, 0, 15, 16, 1, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1),
Block.makeCuboidShape(0, 0, 0, 16, 1, 1), Block.makeCuboidShape(15, 15, 1, 16, 16, 15),
Block.makeCuboidShape(15, 0, 1, 16, 1, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15),
Block.makeCuboidShape(0, 0, 1, 1, 1, 15), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(0, 6, 3, 1, 10, 13),
Block.makeCuboidShape(15, 6, 3, 16, 10, 13), Block.makeCuboidShape(5, 5, 15, 11, 11, 16),
Block.makeCuboidShape(11, 6, 15, 13, 10, 16), Block.makeCuboidShape(3, 6, 15, 5, 10, 16),
Block.makeCuboidShape(6, 11, 15, 10, 13, 16), Block.makeCuboidShape(6, 3, 15, 10, 5, 16)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_W = Stream.of(
Block.makeCuboidShape(1, 1, 1, 15, 15, 15), Block.makeCuboidShape(0, 15, 0, 1, 16, 16),
Block.makeCuboidShape(0, 0, 0, 1, 1, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16),
Block.makeCuboidShape(15, 0, 0, 16, 1, 16), Block.makeCuboidShape(1, 15, 15, 15, 16, 16),
Block.makeCuboidShape(1, 0, 15, 15, 1, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1),
Block.makeCuboidShape(1, 0, 0, 15, 1, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(3, 6, 0, 13, 10, 1),
Block.makeCuboidShape(3, 6, 15, 13, 10, 16), Block.makeCuboidShape(0, 5, 5, 1, 11, 11),
Block.makeCuboidShape(0, 6, 11, 1, 10, 13), Block.makeCuboidShape(0, 6, 3, 1, 10, 5),
Block.makeCuboidShape(0, 11, 6, 1, 13, 10), Block.makeCuboidShape(0, 3, 6, 1, 5, 10)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
}
static class FurnaceDoubleShapes {
static final VoxelShape SHAPE_N = Stream.of(
Block.makeCuboidShape(15, 15, 0, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 1, 16, 16),
Block.makeCuboidShape(1, 15, 0, 15, 16, 1), Block.makeCuboidShape(1, 15, 15, 15, 16, 16),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(5, 14, 6, 11, 15, 7),
Block.makeCuboidShape(5, 14, 8, 11, 15, 9), Block.makeCuboidShape(5, 14, 10, 11, 15, 14),
Block.makeCuboidShape(5, 14, 2, 11, 15, 5), Block.makeCuboidShape(11, 14, 2, 14, 15, 14),
Block.makeCuboidShape(2, 14, 2, 5, 15, 14), Block.makeCuboidShape(1, 1, 2, 2, 15, 14),
Block.makeCuboidShape(14, 1, 2, 15, 15, 14), Block.makeCuboidShape(1, 1, 14, 15, 15, 15),
Block.makeCuboidShape(7, 3, 1, 9, 7, 2), Block.makeCuboidShape(3, 7, 1, 13, 15, 2),
Block.makeCuboidShape(3, 1, 1, 13, 3, 2), Block.makeCuboidShape(1, 1, 1, 3, 15, 2),
Block.makeCuboidShape(13, 1, 1, 15, 15, 2), Block.makeCuboidShape(5, 13, 5, 11, 14, 10),
Block.makeCuboidShape(2, 3, 2, 14, 8, 3)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_E = Stream.of(
Block.makeCuboidShape(0, 15, 15, 16, 16, 16), Block.makeCuboidShape(0, 15, 0, 16, 16, 1),
Block.makeCuboidShape(15, 15, 1, 16, 16, 15), Block.makeCuboidShape(0, 15, 1, 1, 16, 15),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(9, 14, 5, 10, 15, 11),
Block.makeCuboidShape(7, 14, 5, 8, 15, 11), Block.makeCuboidShape(2, 14, 5, 6, 15, 11),
Block.makeCuboidShape(11, 14, 5, 14, 15, 11), Block.makeCuboidShape(2, 14, 11, 14, 15, 14),
Block.makeCuboidShape(2, 14, 2, 14, 15, 5), Block.makeCuboidShape(2, 1, 1, 14, 15, 2),
Block.makeCuboidShape(2, 1, 14, 14, 15, 15), Block.makeCuboidShape(1, 1, 1, 2, 15, 15),
Block.makeCuboidShape(14, 3, 7, 15, 7, 9), Block.makeCuboidShape(14, 7, 3, 15, 15, 13),
Block.makeCuboidShape(14, 1, 3, 15, 3, 13), Block.makeCuboidShape(14, 1, 1, 15, 15, 3),
Block.makeCuboidShape(14, 1, 13, 15, 15, 15), Block.makeCuboidShape(6, 13, 5, 11, 14, 11),
Block.makeCuboidShape(13, 3, 2, 14, 8, 14)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_S = Stream.of(
Block.makeCuboidShape(0, 15, 0, 1, 16, 16), Block.makeCuboidShape(15, 15, 0, 16, 16, 16),
Block.makeCuboidShape(1, 15, 15, 15, 16, 16), Block.makeCuboidShape(1, 15, 0, 15, 16, 1),
Block.makeCuboidShape(15, 1, 0, 16, 15, 1), Block.makeCuboidShape(0, 1, 0, 1, 15, 1),
Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(5, 14, 9, 11, 15, 10),
Block.makeCuboidShape(5, 14, 7, 11, 15, 8), Block.makeCuboidShape(5, 14, 2, 11, 15, 6),
Block.makeCuboidShape(5, 14, 11, 11, 15, 14), Block.makeCuboidShape(2, 14, 2, 5, 15, 14),
Block.makeCuboidShape(11, 14, 2, 14, 15, 14), Block.makeCuboidShape(14, 1, 2, 15, 15, 14),
Block.makeCuboidShape(1, 1, 2, 2, 15, 14), Block.makeCuboidShape(1, 1, 1, 15, 15, 2),
Block.makeCuboidShape(7, 3, 14, 9, 7, 15), Block.makeCuboidShape(3, 7, 14, 13, 15, 15),
Block.makeCuboidShape(3, 1, 14, 13, 3, 15), Block.makeCuboidShape(13, 1, 14, 15, 15, 15),
Block.makeCuboidShape(1, 1, 14, 3, 15, 15), Block.makeCuboidShape(5, 13, 6, 11, 14, 11),
Block.makeCuboidShape(2, 3, 13, 14, 8, 14)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
static final VoxelShape SHAPE_W = Stream.of(
Block.makeCuboidShape(0, 15, 0, 16, 16, 1), Block.makeCuboidShape(0, 15, 15, 16, 16, 16),
Block.makeCuboidShape(0, 15, 1, 1, 16, 15), Block.makeCuboidShape(15, 15, 1, 16, 16, 15),
Block.makeCuboidShape(15, 1, 15, 16, 15, 16), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(0, 1, 15, 1, 15, 16),
Block.makeCuboidShape(0, 0, 0, 16, 1, 16), Block.makeCuboidShape(6, 14, 5, 7, 15, 11),
Block.makeCuboidShape(8, 14, 5, 9, 15, 11), Block.makeCuboidShape(10, 14, 5, 14, 15, 11),
Block.makeCuboidShape(2, 14, 5, 5, 15, 11), Block.makeCuboidShape(2, 14, 2, 14, 15, 5),
Block.makeCuboidShape(2, 14, 11, 14, 15, 14), Block.makeCuboidShape(2, 1, 14, 14, 15, 15),
Block.makeCuboidShape(2, 1, 1, 14, 15, 2), Block.makeCuboidShape(14, 1, 1, 15, 15, 15),
Block.makeCuboidShape(1, 3, 7, 2, 7, 9), Block.makeCuboidShape(1, 7, 3, 2, 15, 13),
Block.makeCuboidShape(1, 1, 3, 2, 3, 13), Block.makeCuboidShape(1, 1, 13, 2, 15, 15),
Block.makeCuboidShape(1, 1, 1, 2, 15, 3), Block.makeCuboidShape(5, 13, 5, 10, 14, 11),
Block.makeCuboidShape(2, 3, 2, 3, 8, 14)
).reduce((v1, v2) -> {
return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
}).get();
}
public static final VoxelShape FEEDER_SHAPE = ShapeBuilder.get()
.add(0, 15, 0, 1, 16, 16).add(15, 15, 0, 16, 16, 16)
.add(1, 15, 0, 15, 16, 1).add(1, 15, 15, 15, 16, 16).add(1, 0, 15, 15, 1, 16)
.add(1, 0, 0, 15, 1, 1).add(15, 0, 0, 16, 1, 16).add(0, 0, 0, 1, 1, 16)
.add(0, 1, 15, 1, 15, 16).add(15, 1, 15, 16, 15, 16).add(15, 1, 0, 16, 15, 1)
.add(0, 1, 0, 1, 15, 1).add(11, 14, 11, 12, 15, 12).add(11, 14, 4, 12, 15, 5)
.add(4, 14, 11, 5, 15, 12).add(4, 14, 4, 5, 15, 5).add(4, 13, 4, 12, 14, 12)
.add(4, 14, 12, 12, 15, 15).add(4, 14, 1, 12, 15, 4).add(1, 14, 1, 4, 15, 15)
.add(12, 14, 1, 15, 15, 15).add(1, 1, 1, 15, 2, 15).add(14, 2, 1, 15, 14, 15)
.add(1, 2, 1, 2, 14, 15).add(2, 2, 14, 14, 14, 15).add(2, 2, 1, 14, 14, 2)
.standardReduceBuild().get();
public static class ShapeBuilder {
Stream.Builder<VoxelShape> shapes = Stream.builder();
public ShapeBuilder add(double x1, double y1, double z1, double x2, double y2, double z2) {
this.shapes.add(Block.makeCuboidShape(x1, y1, z1, x2, y2, z2));
return this;
}
public Stream<VoxelShape> build() {
return this.shapes.build();
}
public Optional<VoxelShape> standardReduceBuild() {
return this.shapes.build().reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR));
}
public static ShapeBuilder get() {
return new ShapeBuilder();
}
}
} }

View file

@ -29,13 +29,13 @@ public class ContainerGrinder extends Container {
public final boolean isDouble; public final boolean isDouble;
public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerGrinder fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerGrinder(windowId, inv, data.readBoolean(), (TileEntityGrinder) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerGrinder(windowId, inv, (TileEntityGrinder) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
} }
public ContainerGrinder(int windowId, PlayerInventory inventory, boolean isDouble, TileEntityGrinder tile) { public ContainerGrinder(int windowId, PlayerInventory inventory, TileEntityGrinder tile) {
super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId); super(ActuallyContainers.GRINDER_CONTAINER.get(), windowId);
this.tileGrinder = tile; this.tileGrinder = tile;
this.isDouble = isDouble; this.isDouble = tile.isDouble;
this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble this.addSlot(new SlotItemHandlerUnconditioned(this.tileGrinder.inv, TileEntityGrinder.SLOT_INPUT_1, this.isDouble
? 51 ? 51

View file

@ -30,19 +30,19 @@ public class ContainerInputter extends Container {
public final boolean isAdvanced; public final boolean isAdvanced;
public static ContainerInputter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) { public static ContainerInputter fromNetwork(int windowId, PlayerInventory inv, PacketBuffer data) {
return new ContainerInputter(windowId, inv, data.readBoolean(), (TileEntityInputter) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos()))); return new ContainerInputter(windowId, inv, (TileEntityInputter) Objects.requireNonNull(inv.player.world.getTileEntity(data.readBlockPos())));
} }
public ContainerInputter(int windowId, PlayerInventory inventory, boolean isAdvanced, TileEntityInputter tile) { public ContainerInputter(int windowId, PlayerInventory inventory, TileEntityInputter tile) {
super(ActuallyContainers.INPUTTER_CONTAINER.get(), windowId); super(ActuallyContainers.INPUTTER_CONTAINER.get(), windowId);
this.tileInputter = tile; this.tileInputter = tile;
this.isAdvanced = isAdvanced; this.isAdvanced = tile.isAdvanced;
this.addSlot(new SlotItemHandlerUnconditioned(this.tileInputter.inv, 0, 80, 21 + (isAdvanced this.addSlot(new SlotItemHandlerUnconditioned(this.tileInputter.inv, 0, 80, 21 + (this.isAdvanced
? 12 ? 12
: 0))); : 0)));
if (isAdvanced) { if (this.isAdvanced) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
for (int x = 0; x < 3; x++) { for (int x = 0; x < 3; x++) {
for (int y = 0; y < 4; y++) { for (int y = 0; y < 4; y++) {
@ -56,13 +56,13 @@ public class ContainerInputter extends Container {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) { for (int j = 0; j < 9; j++) {
this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 101 + i * 18 + (isAdvanced this.addSlot(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 101 + i * 18 + (this.isAdvanced
? GuiInputter.OFFSET_ADVANCED ? GuiInputter.OFFSET_ADVANCED
: 0))); : 0)));
} }
} }
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
this.addSlot(new Slot(inventory, i, 8 + i * 18, 159 + (isAdvanced this.addSlot(new Slot(inventory, i, 8 + i * 18, 159 + (this.isAdvanced
? GuiInputter.OFFSET_ADVANCED ? GuiInputter.OFFSET_ADVANCED
: 0))); : 0)));
} }

View file

@ -15,25 +15,33 @@ import de.ellpeck.actuallyadditions.api.farmer.FarmerResult;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.api.internal.IFarmer; import de.ellpeck.actuallyadditions.api.internal.IFarmer;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFarmer;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer { public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer, INamedContainerProvider {
private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<>(); private static final List<IFarmerBehavior> SORTED_FARMER_BEHAVIORS = new ArrayList<>();
public final CustomEnergyStorage storage = new CustomEnergyStorage(100000, 1000, 0); public final CustomEnergyStorage storage = new CustomEnergyStorage(100000, 1000, 0);
@ -225,4 +233,15 @@ public class TileEntityFarmer extends TileEntityInventoryBase implements IFarmer
public void addToOutput(List<ItemStack> stacks) { public void addToOutput(List<ItemStack> stacks) {
StackUtil.addAll(this.inv, stacks, 6, 12, false); StackUtil.addAll(this.inv, stacks, 6, 12, false);
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) {
return new ContainerFarmer(windowId, playerInventory, this);
}
} }

View file

@ -10,9 +10,14 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFeeder;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.horse.HorseEntity; import net.minecraft.entity.passive.horse.HorseEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
@ -20,11 +25,14 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
public class TileEntityFeeder extends TileEntityInventoryBase { public class TileEntityFeeder extends TileEntityInventoryBase implements INamedContainerProvider {
public static final int THRESHOLD = 30; public static final int THRESHOLD = 30;
private static final int TIME = 100; private static final int TIME = 100;
@ -109,4 +117,15 @@ public class TileEntityFeeder extends TileEntityInventoryBase {
} }
return animal.getGrowingAge() == 0 && !animal.isInLove() && animal.isBreedingItem(stack); return animal.getGrowingAge() == 0 && !animal.isInLove() && animal.isBreedingItem(stack);
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) {
return new ContainerFeeder(windowId, playerInventory, this);
}
} }

View file

@ -11,16 +11,25 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank; import net.minecraftforge.fluids.capability.templates.FluidTank;
public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler { import javax.annotation.Nullable;
public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider {
private static final int PROCESS_TIME = 100; private static final int PROCESS_TIME = 100;
public final FluidTank canolaTank = new FluidTank(2 * Util.BUCKET) { public final FluidTank canolaTank = new FluidTank(2 * Util.BUCKET) {
@ -149,4 +158,15 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
public Direction[] getFluidShareSides() { public Direction[] getFluidShareSides() {
return Direction.values(); return Direction.values();
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) {
return new ContainerFermentingBarrel(windowId, playerInventory, this);
}
} }

View file

@ -10,9 +10,13 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFireworkBox;
import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor; import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.projectile.FireworkRocketEntity; import net.minecraft.entity.projectile.FireworkRocketEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.DyeColor; import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
@ -22,14 +26,17 @@ import net.minecraft.util.Direction;
import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor { public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisplay, INumberReactor, INamedContainerProvider {
public static final int USE_PER_SHOT = 500; public static final int USE_PER_SHOT = 500;
public final CustomEnergyStorage storage = new CustomEnergyStorage(20000, 200, 0); public final CustomEnergyStorage storage = new CustomEnergyStorage(20000, 200, 0);
@ -277,6 +284,17 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyDisp
return this.lazyEnergy; return this.lazyEnergy;
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity p_createMenu_3_) {
return new ContainerFireworkBox(windowId, playerInventory);
}
private static class WeightedFireworkType extends WeightedRandom.Item { private static class WeightedFireworkType extends WeightedRandom.Item {
public final int type; public final int type;

View file

@ -10,13 +10,18 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
@ -24,6 +29,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents; import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -32,8 +39,9 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank; import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler { public class TileEntityFluidCollector extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider {
public boolean isPlacer; public boolean isPlacer;
public final FluidTank tank = new FluidTank(8 * Util.BUCKET) { public final FluidTank tank = new FluidTank(8 * Util.BUCKET) {
@ -209,4 +217,15 @@ public class TileEntityFluidCollector extends TileEntityBase implements ISharing
public Direction[] getFluidShareSides() { public Direction[] getFluidShareSides() {
return Direction.values(); return Direction.values();
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerFluidCollector(windowId, playerInventory, this);
}
} }

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceDouble; import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -19,15 +20,22 @@ import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipe; import net.minecraft.item.crafting.FurnaceRecipe;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.datafix.fixes.FurnaceRecipes; import net.minecraft.util.datafix.fixes.FurnaceRecipes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IButtonReactor { import javax.annotation.Nullable;
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
public static final int SLOT_INPUT_1 = 0; public static final int SLOT_INPUT_1 = 0;
public static final int SLOT_OUTPUT_1 = 1; public static final int SLOT_OUTPUT_1 = 1;
@ -223,4 +231,15 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) { public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
return this.lazyEnergy; return this.lazyEnergy;
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerFurnaceDouble(windowId, playerInventory, this);
}
} }

View file

@ -1,18 +1,19 @@
/* // TODO: [port][note] not used
* This file ("TileEntityGiantChestLarge.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("TileEntityGiantChestLarge.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.tile; //
//package de.ellpeck.actuallyadditions.mod.tile;
public class TileEntityGiantChestLarge extends TileEntityGiantChest { //
//public class TileEntityGiantChestLarge extends TileEntityGiantChest {
public TileEntityGiantChestLarge() { //
super(9 * 13 * 3, "giantChestLarge"); // public TileEntityGiantChestLarge() {
} // super(9 * 13 * 3, "giantChestLarge");
} // }
//}

View file

@ -1,18 +1,19 @@
/* // TODO: [port][note] not used
* This file ("TileEntityGiantChestMedium.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("TileEntityGiantChestMedium.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.tile; //
//package de.ellpeck.actuallyadditions.mod.tile;
public class TileEntityGiantChestMedium extends TileEntityGiantChest { //
//public class TileEntityGiantChestMedium extends TileEntityGiantChest {
public TileEntityGiantChestMedium() { //
super(9 * 13 * 2, "giantChestMedium"); // public TileEntityGiantChestMedium() {
} // super(9 * 13 * 2, "giantChestMedium");
} // }
//}

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe; import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceDouble; import de.ellpeck.actuallyadditions.mod.blocks.BlockFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
@ -21,15 +22,22 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
public class TileEntityGrinder extends TileEntityInventoryBase implements IButtonReactor { import javax.annotation.Nullable;
public class TileEntityGrinder extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
public static final int SLOT_INPUT_1 = 0; public static final int SLOT_INPUT_1 = 0;
public static final int SLOT_OUTPUT_1_1 = 1; public static final int SLOT_OUTPUT_1_1 = 1;
@ -265,4 +273,15 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IButto
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) { public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
return this.lazyEnergy; return this.lazyEnergy;
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerGrinder(windowId, playerInventory, this);
}
} }

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerInputter;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor; import de.ellpeck.actuallyadditions.mod.network.gui.INumberReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -18,20 +19,26 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.AbstractFurnaceTileEntity; import net.minecraft.tileentity.AbstractFurnaceTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nullable;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor { public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor, INamedContainerProvider {
public static final int OKAY_BUTTON_ID = 133; public static final int OKAY_BUTTON_ID = 133;
private final SlotlessableItemHandlerWrapper wrapper = new SlotlessableItemHandlerWrapper(this.lazyInv, null); private final SlotlessableItemHandlerWrapper wrapper = new SlotlessableItemHandlerWrapper(this.lazyInv, null);
@ -309,4 +316,15 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
public IRemover getRemover() { public IRemover getRemover() {
return (slot, automation) -> !automation || slot == 0; return (slot, automation) -> !automation || slot == 0;
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerInputter(windowId, playerInventory, this);
}
} }

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFilter;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotFilter;
import de.ellpeck.actuallyadditions.mod.items.ItemDrill; import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
@ -18,11 +19,17 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper; import de.ellpeck.actuallyadditions.mod.util.compat.SlotlessableItemHandlerWrapper;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.IItemHandler; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor { import javax.annotation.Nullable;
public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor, INamedContainerProvider {
public FilterSettings leftFilter = new FilterSettings(12, true, true, false, false, 0, -1000); public FilterSettings leftFilter = new FilterSettings(12, true, true, false, false, 0, -1000);
public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000); public FilterSettings rightFilter = new FilterSettings(12, true, true, false, false, 0, -2000);
@ -72,15 +79,14 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem
private void addWhitelistSmart(boolean output) { private void addWhitelistSmart(boolean output) {
for (SlotlessableItemHandlerWrapper handler : this.handlersAround.values()) { for (SlotlessableItemHandlerWrapper handler : this.handlersAround.values()) {
IItemHandler itemHandler = handler.getNormalHandler(); handler.getNormalHandler().ifPresent(itemHandler -> {
if (itemHandler != null) {
for (int i = 0; i < itemHandler.getSlots(); i++) { for (int i = 0; i < itemHandler.getSlots(); i++) {
ItemStack stack = itemHandler.getStackInSlot(i); ItemStack stack = itemHandler.getStackInSlot(i);
if (StackUtil.isValid(stack)) { if (StackUtil.isValid(stack)) {
this.addWhitelistSmart(output, stack); this.addWhitelistSmart(output, stack);
} }
} }
} });
} }
} }
@ -132,4 +138,15 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem
} }
} }
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerLaserRelayItemWhitelist(windowId, playerInventory, this);
}
} }

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerMiner;
import de.ellpeck.actuallyadditions.mod.items.ItemDrill; import de.ellpeck.actuallyadditions.mod.items.ItemDrill;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
@ -21,21 +22,27 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidBlock;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay { public class TileEntityMiner extends TileEntityInventoryBase implements IButtonReactor, IEnergyDisplay, INamedContainerProvider {
public static final int ENERGY_USE_PER_BLOCK = 650; public static final int ENERGY_USE_PER_BLOCK = 650;
public static final int DEFAULT_RANGE = 2; public static final int DEFAULT_RANGE = 2;
@ -235,4 +242,15 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IButtonR
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) { public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
return this.lazyEnergy; return this.lazyEnergy;
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerMiner(windowId, playerInventory, this);
}
} }

View file

@ -13,11 +13,18 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe; import de.ellpeck.actuallyadditions.api.recipe.OilGenRecipe;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -27,8 +34,9 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank; import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler { public class TileEntityOilGenerator extends TileEntityBase implements ISharingEnergyProvider, ISharingFluidHandler, INamedContainerProvider {
int[] i = ConfigIntListValues.OIL_POWER.getValue(); int[] i = ConfigIntListValues.OIL_POWER.getValue();
@ -214,4 +222,15 @@ public class TileEntityOilGenerator extends TileEntityBase implements ISharingEn
public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) { public LazyOptional<IEnergyStorage> getEnergyStorage(Direction facing) {
return this.lazyEnergy; return this.lazyEnergy;
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerOilGenerator(windowId, playerInventory, this);
}
} }

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
@ -21,17 +22,23 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor { public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IButtonReactor, INamedContainerProvider {
public static final int RANGE = 3; public static final int RANGE = 3;
public BlockPos boundPosition; public BlockPos boundPosition;
@ -225,4 +232,15 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
this.sendUpdate(); this.sendUpdate();
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerPhantomPlacer(windowId, playerInventory, this);
}
} }

View file

@ -10,21 +10,28 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerRangedCollector;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor { public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
public static final int RANGE = 6; public static final int RANGE = 6;
public FilterSettings filter = new FilterSettings(12, true, true, false, false, 0, -1000); public FilterSettings filter = new FilterSettings(12, true, true, false, false, 0, -1000);
@ -96,4 +103,15 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
public void onButtonPressed(int buttonID, PlayerEntity player) { public void onButtonPressed(int buttonID, PlayerEntity player) {
this.filter.onButtonPressed(buttonID); this.filter.onButtonPressed(buttonID);
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerRangedCollector(windowId, playerInventory, this);
}
} }

View file

@ -1,60 +1,61 @@
/* // TODO: [port][note]: Not used
* This file ("TileEntitySmileyCloud.java") is part of the Actually Additions mod for Minecraft. ///*
* It is created and owned by Ellpeck and distributed // * This file ("TileEntitySmileyCloud.java") is part of the Actually Additions mod for Minecraft.
* under the Actually Additions License to be found at // * It is created and owned by Ellpeck and distributed
* http://ellpeck.de/actaddlicense // * under the Actually Additions License to be found at
* View the source code at https://github.com/Ellpeck/ActuallyAdditions // * http://ellpeck.de/actaddlicense
* // * View the source code at https://github.com/Ellpeck/ActuallyAdditions
* © 2015-2017 Ellpeck // *
*/ // * © 2015-2017 Ellpeck
// */
package de.ellpeck.actuallyadditions.mod.tile; //
//package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor; //
import net.minecraft.entity.player.PlayerEntity; //import de.ellpeck.actuallyadditions.mod.network.gui.IStringReactor;
import net.minecraft.nbt.CompoundNBT; //import net.minecraft.entity.player.PlayerEntity;
//import net.minecraft.nbt.CompoundNBT;
public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor { //
//public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor {
public String name; //
private String nameBefore; // public String name;
// private String nameBefore;
public TileEntitySmileyCloud() { //
super("smileyCloud"); // public TileEntitySmileyCloud() {
} // super("smileyCloud");
// }
@Override //
public void writeSyncableNBT(CompoundNBT compound, NBTType type) { // @Override
super.writeSyncableNBT(compound, type); // public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
if (this.name != null && type != NBTType.SAVE_BLOCK) { // super.writeSyncableNBT(compound, type);
compound.setString("Name", this.name); // if (this.name != null && type != NBTType.SAVE_BLOCK) {
} // compound.setString("Name", this.name);
} // }
// }
@Override //
public void readSyncableNBT(CompoundNBT compound, NBTType type) { // @Override
super.readSyncableNBT(compound, type); // public void readSyncableNBT(CompoundNBT compound, NBTType type) {
if (type != NBTType.SAVE_BLOCK) { // super.readSyncableNBT(compound, type);
this.name = compound.getString("Name"); // if (type != NBTType.SAVE_BLOCK) {
} // this.name = compound.getString("Name");
} // }
// }
@Override //
public void updateEntity() { // @Override
super.updateEntity(); // public void updateEntity() {
if (!this.world.isRemote) { // super.updateEntity();
boolean nameChanged = this.name != null // if (!this.world.isRemote) {
? !this.name.equals(this.nameBefore) // boolean nameChanged = this.name != null
: this.nameBefore != null; // ? !this.name.equals(this.nameBefore)
if (nameChanged && this.sendUpdateWithInterval()) { // : this.nameBefore != null;
this.nameBefore = this.name; // if (nameChanged && this.sendUpdateWithInterval()) {
this.markDirty(); // this.nameBefore = this.name;
} // this.markDirty();
} // }
} // }
// }
@Override //
public void onTextReceived(String text, int textID, PlayerEntity player) { // @Override
this.name = text; // public void onTextReceived(String text, int textID, PlayerEntity player) {
} // this.name = text;
} // }
//}

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerXPSolidifier;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience; import de.ellpeck.actuallyadditions.mod.items.ItemSolidifiedExperience;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
@ -18,14 +19,20 @@ import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.entity.item.ExperienceOrbEntity; import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor { public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
private static final int[] XP_MAP = new int[256]; private static final int[] XP_MAP = new int[256];
@ -124,10 +131,8 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
if (this.amount > 0) { if (this.amount > 0) {
ItemStack stack = this.inv.getStackInSlot(0); ItemStack stack = this.inv.getStackInSlot(0);
if (stack.isEmpty()) { if (stack.isEmpty()) {
int toSet = this.amount > 64 int toSet = Math.min(this.amount, 64);
? 64 this.inv.setStackInSlot(0, new ItemStack(InitItems.itemSolidifiedExperience.get(), toSet));
: this.amount;
this.inv.setStackInSlot(0, new ItemStack(InitItems.itemSolidifiedExperience, toSet));
this.amount -= toSet; this.amount -= toSet;
this.markDirty(); this.markDirty();
} else if (stack.getCount() < 64) { } else if (stack.getCount() < 64) {
@ -177,7 +182,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
@Override @Override
public IAcceptor getAcceptor() { public IAcceptor getAcceptor() {
return (slot, stack, automation) -> slot == 1 && stack.getItem() == InitItems.itemSolidifiedExperience; return (slot, stack, automation) -> slot == 1 && stack.getItem() == InitItems.itemSolidifiedExperience.get();
} }
@Override @Override
@ -205,4 +210,15 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
} }
} }
} }
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
}
@Nullable
@Override
public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerXPSolidifier(windowId, playerInventory, this);
}
} }