Block package
This commit is contained in:
		| @@ -4,28 +4,17 @@ import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.IBlockInfo; | ||||
| import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockBase; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.AdvancedRayTraceResult; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.AdvancedRayTracer; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileBase; | ||||
| import com.raoulvdberge.refinedstorage.util.CollisionUtils; | ||||
| import com.raoulvdberge.refinedstorage.util.WorldUtils; | ||||
| import net.minecraft.block.Block; | ||||
| import net.minecraft.block.BlockState; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.entity.Entity; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.state.StateContainer; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.math.AxisAlignedBB; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.util.math.RayTraceResult; | ||||
| import net.minecraft.util.math.Vec3d; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.IBlockReader; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraft.world.chunk.BlockStateContainer; | ||||
| import net.minecraftforge.api.distmarker.Dist; | ||||
| import net.minecraftforge.api.distmarker.OnlyIn; | ||||
|  | ||||
| @@ -60,61 +49,25 @@ public abstract class BlockBase extends Block { | ||||
|         return "block." + info.getId().toString(); | ||||
|     } | ||||
|  | ||||
|     protected BlockStateContainer.Builder createBlockStateBuilder() { | ||||
|         BlockStateContainer.Builder builder = new BlockStateContainer.Builder(this); | ||||
|     @Override | ||||
|     protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { | ||||
|         super.fillStateContainer(builder); | ||||
|  | ||||
|         if (getDirection() != null) { | ||||
|             builder.add(getDirection().getProperty()); | ||||
|         } | ||||
|  | ||||
|         return builder; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected BlockStateContainer createBlockState() { | ||||
|         return createBlockStateBuilder().build(); | ||||
|     } | ||||
|  | ||||
|     public Item createItem() { | ||||
|         return new ItemBlockBase(this, false); | ||||
|     } | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public IBlockState getStateFromMeta(int meta) { | ||||
|         return getDefaultState(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int getMetaFromState(IBlockState state) { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         if (getDirection() != null) { | ||||
|             TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|             if (tile instanceof TileBase) { | ||||
|                 return state.withProperty(getDirection().getProperty(), ((TileBase) tile).getDirection()); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return state; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int damageDropped(IBlockState state) { | ||||
|         return getMetaFromState(state); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) { | ||||
|     public boolean rotateBlock(World world, BlockPos pos, Direction axis) { | ||||
|         if (!world.isRemote && getDirection() != null) { | ||||
|             TileBase tile = (TileBase) world.getTileEntity(pos); | ||||
|  | ||||
|             EnumFacing newDirection = getDirection().cycle(tile.getDirection()); | ||||
|             Direction newDirection = getDirection().cycle(tile.getDirection()); | ||||
|  | ||||
|             tile.setDirection(newDirection); | ||||
|  | ||||
| @@ -124,15 +77,16 @@ public abstract class BlockBase extends Block { | ||||
|         } | ||||
|  | ||||
|         return false; | ||||
|     } | ||||
|     } */ | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     public void breakBlock(World world, BlockPos pos, IBlockState state) { | ||||
|     public void breakBlock(World world, BlockPos pos, BlockState state) { | ||||
|         dropContents(world, pos); | ||||
|         removeTile(world, pos, state); | ||||
|     } | ||||
|  | ||||
|     void removeTile(World world, BlockPos pos, IBlockState state) { | ||||
|     void removeTile(World world, BlockPos pos, BlockState state) { | ||||
|         if (hasTileEntity(state)) { | ||||
|             world.removeTileEntity(pos); | ||||
|         } | ||||
| @@ -147,24 +101,25 @@ public abstract class BlockBase extends Block { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) { | ||||
|     public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) { | ||||
|         return willHarvest || super.removedByPlayer(state, world, pos, player, willHarvest); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void harvestBlock(World world, PlayerEntity player, BlockPos pos, IBlockState state, TileEntity tile, ItemStack stack) { | ||||
|     public void harvestBlock(World world, PlayerEntity player, BlockPos pos, BlockState state, TileEntity tile, ItemStack stack) { | ||||
|         super.harvestBlock(world, player, pos, state, tile, stack); | ||||
|  | ||||
|         world.setBlockToAir(pos); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public final boolean hasTileEntity(IBlockState state) { | ||||
|     public final boolean hasTileEntity(BlockState state) { | ||||
|         return info.hasTileEntity(); | ||||
|     } | ||||
|  | ||||
|     @Nullable | ||||
|     @Override | ||||
|     public final TileEntity createTileEntity(World world, IBlockState state) { | ||||
|     public TileEntity createTileEntity(BlockState state, IBlockReader world) { | ||||
|         return info.createTileEntity(); | ||||
|     } | ||||
|  | ||||
| @@ -177,9 +132,7 @@ public abstract class BlockBase extends Block { | ||||
|         return info; | ||||
|     } | ||||
|  | ||||
|     protected boolean canAccessGui(IBlockState state, World world, BlockPos pos, float hitX, float hitY, float hitZ) { | ||||
|         state = getActualState(state, world, pos); | ||||
|  | ||||
|     protected boolean canAccessGui(BlockState state, World world, BlockPos pos, float hitX, float hitY, float hitZ) { | ||||
|         for (CollisionGroup group : getCollisions(world.getTileEntity(pos), state)) { | ||||
|             if (group.canAccessGui()) { | ||||
|                 for (AxisAlignedBB aabb : group.getItems()) { | ||||
| @@ -206,9 +159,10 @@ public abstract class BlockBase extends Block { | ||||
|         return DEFAULT_COLLISION_GROUPS; | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { | ||||
|     public void addCollisionBoxToList(BlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) { | ||||
|         for (CollisionGroup group : getCollisions(world.getTileEntity(pos), this.getActualState(state, world, pos))) { | ||||
|             for (AxisAlignedBB aabb : group.getItems()) { | ||||
|                 addCollisionBoxToList(pos, entityBox, collidingBoxes, aabb); | ||||
| @@ -218,9 +172,9 @@ public abstract class BlockBase extends Block { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) { | ||||
|     public RayTraceResult collisionRayTrace(BlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) { | ||||
|         AdvancedRayTraceResult result = AdvancedRayTracer.rayTrace(pos, start, end, getCollisions(world.getTileEntity(pos), this.getActualState(state, world, pos))); | ||||
|  | ||||
|         return result != null ? result.getHit() : null; | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -8,33 +8,28 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverType; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.block.info.IBlockInfo; | ||||
| import com.raoulvdberge.refinedstorage.block.property.PropertyObject; | ||||
| import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsCable; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelCableCover; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileBase; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileCable; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileNode; | ||||
| import com.raoulvdberge.refinedstorage.util.CollisionUtils; | ||||
| import net.minecraft.block.Block; | ||||
| 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.BlockFaceShape; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.client.renderer.model.ModelResourceLocation; | ||||
| import net.minecraft.state.BooleanProperty; | ||||
| import net.minecraft.state.StateContainer; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.Direction; | ||||
| import net.minecraft.util.ResourceLocation; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.common.property.IExtendedBlockState; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
| import net.minecraftforge.api.distmarker.Dist; | ||||
| import net.minecraftforge.api.distmarker.OnlyIn; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| @@ -47,12 +42,12 @@ public class BlockCable extends BlockNode { | ||||
|     public static final PropertyObject<Cover> COVER_UP = new PropertyObject<>("cover_up", Cover.class); | ||||
|     public static final PropertyObject<Cover> COVER_DOWN = new PropertyObject<>("cover_down", Cover.class); | ||||
|  | ||||
|     private static final PropertyBool NORTH = PropertyBool.create("north"); | ||||
|     private static final PropertyBool EAST = PropertyBool.create("east"); | ||||
|     private static final PropertyBool SOUTH = PropertyBool.create("south"); | ||||
|     private static final PropertyBool WEST = PropertyBool.create("west"); | ||||
|     private static final PropertyBool UP = PropertyBool.create("up"); | ||||
|     private static final PropertyBool DOWN = PropertyBool.create("down"); | ||||
|     private static final BooleanProperty NORTH = BooleanProperty.create("north"); | ||||
|     private static final BooleanProperty EAST = BooleanProperty.create("east"); | ||||
|     private static final BooleanProperty SOUTH = BooleanProperty.create("south"); | ||||
|     private static final BooleanProperty WEST = BooleanProperty.create("west"); | ||||
|     private static final BooleanProperty UP = BooleanProperty.create("up"); | ||||
|     private static final BooleanProperty DOWN = BooleanProperty.create("down"); | ||||
|  | ||||
|     public BlockCable(IBlockInfo info) { | ||||
|         super(info); | ||||
| @@ -66,18 +61,18 @@ public class BlockCable extends BlockNode { | ||||
|         return BlockInfoBuilder.forId(id).material(Material.GLASS).soundType(SoundType.GLASS).hardness(0.35F); | ||||
|     } | ||||
|  | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     void registerCover(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.addBakedModelOverride(info.getId(), BakedModelCableCover::new); | ||||
|     } | ||||
|  | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     void registerCoverAndFullbright(IModelRegistration modelRegistration, String... textures) { | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     void registerCoverAndFullbright(IModelRegistration modelRegistration, ResourceLocation... textures) { | ||||
|         modelRegistration.addBakedModelOverride(info.getId(), base -> new BakedModelCableCover(new BakedModelFullbright(base, textures))); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -90,58 +85,48 @@ public class BlockCable extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected BlockStateContainer createBlockState() { | ||||
|         return super.createBlockStateBuilder() | ||||
|             .add(NORTH) | ||||
|             .add(EAST) | ||||
|             .add(SOUTH) | ||||
|             .add(WEST) | ||||
|             .add(UP) | ||||
|             .add(DOWN) | ||||
|             .add(COVER_NORTH) | ||||
|             .add(COVER_EAST) | ||||
|             .add(COVER_SOUTH) | ||||
|             .add(COVER_WEST) | ||||
|             .add(COVER_UP) | ||||
|             .add(COVER_DOWN) | ||||
|             .build(); | ||||
|     protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { | ||||
|         super.fillStateContainer(builder); | ||||
|  | ||||
|         builder.add(NORTH, EAST, SOUTH, WEST, UP, DOWN); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|     public BlockState getActualState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|         state = super.getActualState(state, world, pos) | ||||
|             .withProperty(NORTH, hasConnectionWith(world, pos, this, tile, EnumFacing.NORTH)) | ||||
|             .withProperty(EAST, hasConnectionWith(world, pos, this, tile, EnumFacing.EAST)) | ||||
|             .withProperty(SOUTH, hasConnectionWith(world, pos, this, tile, EnumFacing.SOUTH)) | ||||
|             .withProperty(WEST, hasConnectionWith(world, pos, this, tile, EnumFacing.WEST)) | ||||
|             .withProperty(UP, hasConnectionWith(world, pos, this, tile, EnumFacing.UP)) | ||||
|             .withProperty(DOWN, hasConnectionWith(world, pos, this, tile, EnumFacing.DOWN)); | ||||
|             .withProperty(NORTH, hasConnectionWith(world, pos, this, tile, Direction.NORTH)) | ||||
|             .withProperty(EAST, hasConnectionWith(world, pos, this, tile, Direction.EAST)) | ||||
|             .withProperty(SOUTH, hasConnectionWith(world, pos, this, tile, Direction.SOUTH)) | ||||
|             .withProperty(WEST, hasConnectionWith(world, pos, this, tile, Direction.WEST)) | ||||
|             .withProperty(UP, hasConnectionWith(world, pos, this, tile, Direction.UP)) | ||||
|             .withProperty(DOWN, hasConnectionWith(world, pos, this, tile, Direction.DOWN)); | ||||
|  | ||||
|         return state; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         IBlockState s = super.getExtendedState(state, world, pos); | ||||
|     public BlockState getExtendedState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         BlockState s = super.getExtendedState(state, world, pos); | ||||
|  | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|         if (tile instanceof TileNode && ((TileNode) tile).getNode() instanceof ICoverable) { | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_NORTH, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(EnumFacing.NORTH)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_EAST, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(EnumFacing.EAST)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_SOUTH, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(EnumFacing.SOUTH)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_WEST, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(EnumFacing.WEST)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_UP, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(EnumFacing.UP)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_DOWN, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(EnumFacing.DOWN)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_NORTH, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(Direction.NORTH)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_EAST, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(Direction.EAST)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_SOUTH, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(Direction.SOUTH)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_WEST, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(Direction.WEST)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_UP, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(Direction.UP)); | ||||
|             s = ((IExtendedBlockState) s).withProperty(COVER_DOWN, ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().getCover(Direction.DOWN)); | ||||
|         } | ||||
|  | ||||
|         return s; | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     private static boolean hasConnectionWith(IBlockAccess world, BlockPos pos, BlockBase block, TileEntity tile, EnumFacing direction) { | ||||
|     private static boolean hasConnectionWith(World world, BlockPos pos, BlockBase block, TileEntity tile, Direction direction) { | ||||
|         if (!(tile instanceof TileNode)) { | ||||
|             return false; | ||||
|         } | ||||
| @@ -166,6 +151,7 @@ public class BlockCable extends BlockNode { | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /* TODO | ||||
|         if (otherTile != null && otherTile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, direction.getOpposite())) { | ||||
|             // Prevent the block adding connections in itself | ||||
|             // For example: importer cable connection on the importer face | ||||
| @@ -174,18 +160,18 @@ public class BlockCable extends BlockNode { | ||||
|             } | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|         } */ | ||||
|  | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         List<CollisionGroup> groups = getCoverCollisions(tile); | ||||
|  | ||||
|         groups.add(ConstantsCable.CORE); | ||||
|  | ||||
|         if (state.getValue(NORTH)) { | ||||
|         /* TODO if (state.getValue(NORTH)) { | ||||
|             groups.add(ConstantsCable.NORTH); | ||||
|         } | ||||
|  | ||||
| @@ -207,7 +193,7 @@ public class BlockCable extends BlockNode { | ||||
|  | ||||
|         if (state.getValue(DOWN)) { | ||||
|             groups.add(ConstantsCable.DOWN); | ||||
|         } | ||||
|         } */ | ||||
|  | ||||
|         return groups; | ||||
|     } | ||||
| @@ -218,18 +204,18 @@ public class BlockCable extends BlockNode { | ||||
|         if (tile instanceof TileNode && ((TileNode) tile).getNode() instanceof ICoverable) { | ||||
|             CoverManager coverManager = ((ICoverable) ((TileNode) tile).getNode()).getCoverManager(); | ||||
|  | ||||
|             Cover coverNorth = coverManager.getCover(EnumFacing.NORTH); | ||||
|             Cover coverEast = coverManager.getCover(EnumFacing.EAST); | ||||
|             Cover coverSouth = coverManager.getCover(EnumFacing.SOUTH); | ||||
|             Cover coverWest = coverManager.getCover(EnumFacing.WEST); | ||||
|             Cover coverUp = coverManager.getCover(EnumFacing.UP); | ||||
|             Cover coverDown = coverManager.getCover(EnumFacing.DOWN); | ||||
|             Cover coverNorth = coverManager.getCover(Direction.NORTH); | ||||
|             Cover coverEast = coverManager.getCover(Direction.EAST); | ||||
|             Cover coverSouth = coverManager.getCover(Direction.SOUTH); | ||||
|             Cover coverWest = coverManager.getCover(Direction.WEST); | ||||
|             Cover coverUp = coverManager.getCover(Direction.UP); | ||||
|             Cover coverDown = coverManager.getCover(Direction.DOWN); | ||||
|  | ||||
|             if (coverNorth != null) { | ||||
|                 groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds( | ||||
|                     coverWest != null ? 2 : 0, coverDown != null ? 2 : 0, 0, | ||||
|                     coverEast != null ? 14 : 16, coverUp != null ? 14 : 16, 2 | ||||
|                 )).setDirection(EnumFacing.NORTH)); | ||||
|                 )).setDirection(Direction.NORTH)); | ||||
|  | ||||
|                 if (coverNorth.getType() != CoverType.HOLLOW) { | ||||
|                     groups.add(ConstantsCable.HOLDER_NORTH); | ||||
| @@ -240,7 +226,7 @@ public class BlockCable extends BlockNode { | ||||
|                 groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds( | ||||
|                     14, coverDown != null ? 2 : 0, 0, | ||||
|                     16, coverUp != null ? 14 : 16, 16 | ||||
|                 )).setDirection(EnumFacing.EAST)); | ||||
|                 )).setDirection(Direction.EAST)); | ||||
|  | ||||
|                 if (coverEast.getType() != CoverType.HOLLOW) { | ||||
|                     groups.add(ConstantsCable.HOLDER_EAST); | ||||
| @@ -251,7 +237,7 @@ public class BlockCable extends BlockNode { | ||||
|                 groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds( | ||||
|                     coverEast != null ? 14 : 16, coverDown != null ? 2 : 0, 16, | ||||
|                     coverWest != null ? 2 : 0, coverUp != null ? 14 : 16, 14 | ||||
|                 )).setDirection(EnumFacing.SOUTH)); | ||||
|                 )).setDirection(Direction.SOUTH)); | ||||
|  | ||||
|                 if (coverSouth.getType() != CoverType.HOLLOW) { | ||||
|                     groups.add(ConstantsCable.HOLDER_SOUTH); | ||||
| @@ -262,7 +248,7 @@ public class BlockCable extends BlockNode { | ||||
|                 groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds( | ||||
|                     0, coverDown != null ? 2 : 0, 0, | ||||
|                     2, coverUp != null ? 14 : 16, 16 | ||||
|                 )).setDirection(EnumFacing.WEST)); | ||||
|                 )).setDirection(Direction.WEST)); | ||||
|  | ||||
|                 if (coverWest.getType() != CoverType.HOLLOW) { | ||||
|                     groups.add(ConstantsCable.HOLDER_WEST); | ||||
| @@ -273,7 +259,7 @@ public class BlockCable extends BlockNode { | ||||
|                 groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds( | ||||
|                     0, 14, 0, | ||||
|                     16, 16, 16 | ||||
|                 )).setDirection(EnumFacing.UP)); | ||||
|                 )).setDirection(Direction.UP)); | ||||
|  | ||||
|                 if (coverUp.getType() != CoverType.HOLLOW) { | ||||
|                     groups.add(ConstantsCable.HOLDER_UP); | ||||
| @@ -284,7 +270,7 @@ public class BlockCable extends BlockNode { | ||||
|                 groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds( | ||||
|                     0, 0, 0, | ||||
|                     16, 2, 16 | ||||
|                 )).setDirection(EnumFacing.DOWN)); | ||||
|                 )).setDirection(Direction.DOWN)); | ||||
|  | ||||
|                 if (coverDown.getType() != CoverType.HOLLOW) { | ||||
|                     groups.add(ConstantsCable.HOLDER_DOWN); | ||||
| @@ -295,22 +281,23 @@ public class BlockCable extends BlockNode { | ||||
|         return groups; | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isOpaqueCube(IBlockState state) { | ||||
|     public boolean isOpaqueCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isFullCube(IBlockState state) { | ||||
|     public boolean isFullCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase entity) { | ||||
|         IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, entity); | ||||
|     public BlockState getStateForPlacement(World world, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase entity) { | ||||
|         BlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, entity); | ||||
|  | ||||
|         if (getDirection() != null) { | ||||
|             return state.withProperty(getDirection().getProperty(), getDirection().getFrom(facing, pos, entity)); | ||||
| @@ -326,7 +313,7 @@ public class BlockCable extends BlockNode { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { | ||||
|         return BlockFaceShape.UNDEFINED; | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,89 +1,74 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsCable; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsConstructor; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileConstructor; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockConstructor extends BlockCable { | ||||
|     public BlockConstructor() { | ||||
|         super(createBuilder("constructor").tileEntity(TileConstructor::new).create()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
|         registerCoverAndFullbright(modelRegistration, RS.ID + ":blocks/constructor/cutouts/connected"); | ||||
|     } | ||||
|     /* TODO | ||||
|         @Override | ||||
|         @OnlyIn(Dist.CLIENT) | ||||
|         public void registerModels(IModelRegistration modelRegistration) { | ||||
|             modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
|             registerCoverAndFullbright(modelRegistration, RS.ID + ":blocks/constructor/cutouts/connected"); | ||||
|         } | ||||
|     */ | ||||
|     @Override | ||||
|     @Nullable | ||||
|     public BlockDirection getDirection() { | ||||
|         return BlockDirection.ANY; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|         List<CollisionGroup> groups = super.getCollisions(tile, state); | ||||
|     /* TODO | ||||
|         @Override | ||||
|         public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|             List<CollisionGroup> groups = super.getCollisions(tile, state); | ||||
|  | ||||
|         switch (state.getValue(getDirection().getProperty())) { | ||||
|             case NORTH: | ||||
|                 groups.add(ConstantsCable.HOLDER_NORTH); | ||||
|                 groups.add(ConstantsConstructor.HEAD_NORTH); | ||||
|                 break; | ||||
|             case EAST: | ||||
|                 groups.add(ConstantsCable.HOLDER_EAST); | ||||
|                 groups.add(ConstantsConstructor.HEAD_EAST); | ||||
|                 break; | ||||
|             case SOUTH: | ||||
|                 groups.add(ConstantsCable.HOLDER_SOUTH); | ||||
|                 groups.add(ConstantsConstructor.HEAD_SOUTH); | ||||
|                 break; | ||||
|             case WEST: | ||||
|                 groups.add(ConstantsCable.HOLDER_WEST); | ||||
|                 groups.add(ConstantsConstructor.HEAD_WEST); | ||||
|                 break; | ||||
|             case UP: | ||||
|                 groups.add(ConstantsCable.HOLDER_UP); | ||||
|                 groups.add(ConstantsConstructor.HEAD_UP); | ||||
|                 break; | ||||
|             case DOWN: | ||||
|                 groups.add(ConstantsCable.HOLDER_DOWN); | ||||
|                 groups.add(ConstantsConstructor.HEAD_DOWN); | ||||
|                 break; | ||||
|             switch (state.getValue(getDirection().getProperty())) { | ||||
|                 case NORTH: | ||||
|                     groups.add(ConstantsCable.HOLDER_NORTH); | ||||
|                     groups.add(ConstantsConstructor.HEAD_NORTH); | ||||
|                     break; | ||||
|                 case EAST: | ||||
|                     groups.add(ConstantsCable.HOLDER_EAST); | ||||
|                     groups.add(ConstantsConstructor.HEAD_EAST); | ||||
|                     break; | ||||
|                 case SOUTH: | ||||
|                     groups.add(ConstantsCable.HOLDER_SOUTH); | ||||
|                     groups.add(ConstantsConstructor.HEAD_SOUTH); | ||||
|                     break; | ||||
|                 case WEST: | ||||
|                     groups.add(ConstantsCable.HOLDER_WEST); | ||||
|                     groups.add(ConstantsConstructor.HEAD_WEST); | ||||
|                     break; | ||||
|                 case UP: | ||||
|                     groups.add(ConstantsCable.HOLDER_UP); | ||||
|                     groups.add(ConstantsConstructor.HEAD_UP); | ||||
|                     break; | ||||
|                 case DOWN: | ||||
|                     groups.add(ConstantsCable.HOLDER_DOWN); | ||||
|                     groups.add(ConstantsConstructor.HEAD_DOWN); | ||||
|                     break; | ||||
|             } | ||||
|  | ||||
|             return groups; | ||||
|         } | ||||
|  | ||||
|         return groups; | ||||
|     } | ||||
|         @Override | ||||
|         public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|             if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|                 return false; | ||||
|             } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|             return openNetworkGui(RSGui.CONSTRUCTOR, player, world, pos, side); | ||||
|         } | ||||
|  | ||||
|         return openNetworkGui(RSGui.CONSTRUCTOR, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
|     */ | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|         return true; | ||||
|   | ||||
| @@ -1,38 +1,17 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.enums.ControllerEnergyType; | ||||
| import com.raoulvdberge.refinedstorage.block.enums.ControllerType; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockController; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.meshdefinition.ItemMeshDefinitionController; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileController; | ||||
| import net.minecraft.block.properties.PropertyEnum; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.statemap.StateMap; | ||||
| import net.minecraft.creativetab.CreativeTabs; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.nbt.CompoundNBT; | ||||
| import net.minecraft.state.EnumProperty; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.NonNullList; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockController extends BlockNodeProxy { | ||||
|     public static final PropertyEnum TYPE = PropertyEnum.create("type", ControllerType.class); | ||||
|     public static final PropertyEnum ENERGY_TYPE = PropertyEnum.create("energy_type", ControllerEnergyType.class); | ||||
|     public static final EnumProperty TYPE = EnumProperty.create("type", ControllerType.class); | ||||
|     public static final EnumProperty ENERGY_TYPE = EnumProperty.create("energy_type", ControllerEnergyType.class); | ||||
|  | ||||
|     public BlockController() { | ||||
|         super(BlockInfoBuilder.forId("controller").tileEntity(TileController::new).create()); | ||||
| @@ -43,8 +22,9 @@ public class BlockController extends BlockNodeProxy { | ||||
|         return BlockRenderLayer.CUTOUT; | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModelMeshDefinition(this, new ItemMeshDefinitionController()); | ||||
|  | ||||
| @@ -74,28 +54,28 @@ public class BlockController extends BlockNodeProxy { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getStateFromMeta(int meta) { | ||||
|     public BlockState getStateFromMeta(int meta) { | ||||
|         return getDefaultState().withProperty(TYPE, meta == 0 ? ControllerType.NORMAL : ControllerType.CREATIVE); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int getMetaFromState(IBlockState state) { | ||||
|     public int getMetaFromState(BlockState state) { | ||||
|         return state.getValue(TYPE) == ControllerType.NORMAL ? 0 : 1; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|     public BlockState getActualState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         return super.getActualState(state, world, pos) | ||||
|             .withProperty(ENERGY_TYPE, ((TileController) world.getTileEntity(pos)).getEnergyType()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.CONTROLLER, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { | ||||
|         if (!world.isRemote) { | ||||
|             TileController controller = (TileController) world.getTileEntity(pos); | ||||
|  | ||||
| @@ -110,14 +90,14 @@ public class BlockController extends BlockNodeProxy { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { | ||||
|         ItemStack stack = new ItemStack(this, 1, getMetaFromState(state)); | ||||
|  | ||||
|         stack.setTagCompound(new CompoundNBT()); | ||||
|         stack.getTagCompound().putInt(TileController.NBT_ENERGY, ((TileController) world.getTileEntity(pos)).getEnergy().getStored()); | ||||
|  | ||||
|         drops.add(stack); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public Item createItem() { | ||||
|   | ||||
| @@ -1,28 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileCrafter; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.client.renderer.model.ModelResourceLocation; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.NonNullList; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
| import net.minecraft.util.ResourceLocation; | ||||
| import net.minecraftforge.api.distmarker.Dist; | ||||
| import net.minecraftforge.api.distmarker.OnlyIn; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| @@ -32,17 +20,17 @@ public class BlockCrafter extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north")); | ||||
|  | ||||
|         modelRegistration.addBakedModelOverride(info.getId(), base -> new BakedModelFullbright( | ||||
|             base, | ||||
|             RS.ID + ":blocks/crafter/cutouts/side_connected", | ||||
|             RS.ID + ":blocks/crafter/cutouts/side_connected_90", | ||||
|             RS.ID + ":blocks/crafter/cutouts/side_connected_180", | ||||
|             RS.ID + ":blocks/crafter/cutouts/side_connected_270", | ||||
|             RS.ID + ":blocks/crafter/cutouts/front_connected" | ||||
|             new ResourceLocation(RS.ID, "blocks/crafter/cutouts/side_connected"), | ||||
|             new ResourceLocation(RS.ID, "blocks/crafter/cutouts/side_connected_90"), | ||||
|             new ResourceLocation(RS.ID, "blocks/crafter/cutouts/side_connected_180"), | ||||
|             new ResourceLocation(RS.ID, "blocks/crafter/cutouts/side_connected_270"), | ||||
|             new ResourceLocation(RS.ID, "blocks/crafter/cutouts/front_connected") | ||||
|         )); | ||||
|     } | ||||
|  | ||||
| @@ -57,27 +45,38 @@ public class BlockCrafter extends BlockNode { | ||||
|         return BlockDirection.ANY_FACE_PLAYER; | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { | ||||
|         super.onBlockPlacedBy(world, pos, state, placer, stack); | ||||
|  | ||||
|         if (!world.isRemote) { | ||||
|             TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|             if (tile instanceof TileCrafter && stack.hasDisplayName()) { | ||||
|                 ((TileCrafter) tile).getNode().setDisplayName(stack.getDisplayName()); | ||||
|                 ((TileCrafter) tile).getNode().setDisplayName(stack.getDisplayName().getFormattedText()); // TODO getFormattedText | ||||
|                 ((TileCrafter) tile).getNode().markDirty(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { | ||||
|         return super.onBlockActivated(state, worldIn, pos, player, handIn, hit); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.CRAFTER, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { | ||||
|     public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { | ||||
|         return super.getDrops(state, builder); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { | ||||
|         super.getDrops(drops, world, pos, state, fortune); | ||||
|  | ||||
|         String displayName = ((TileCrafter) world.getTileEntity(pos)).getNode().getDisplayName(); | ||||
| @@ -89,7 +88,7 @@ public class BlockCrafter extends BlockNode { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,34 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileCrafterManager; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.entity.player.ServerPlayerEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| public class BlockCrafterManager extends BlockNode { | ||||
|     public BlockCrafterManager() { | ||||
|         super(BlockInfoBuilder.forId("crafter_manager").tileEntity(TileCrafterManager::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north")); | ||||
|  | ||||
| @@ -47,13 +29,13 @@ public class BlockCrafterManager extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!world.isRemote && openNetworkGui(RSGui.CRAFTER_MANAGER, player, world, pos, side, Permission.MODIFY, Permission.AUTOCRAFTING)) { | ||||
|             ((TileCrafterManager) world.getTileEntity(pos)).getNode().sendTo((ServerPlayerEntity) player); | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,33 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| public class BlockCraftingMonitor extends BlockNode { | ||||
|     public BlockCraftingMonitor() { | ||||
|         super(BlockInfoBuilder.forId("crafting_monitor").tileEntity(TileCraftingMonitor::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -46,10 +29,10 @@ public class BlockCraftingMonitor extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.CRAFTING_MONITOR, player, world, pos, side, Permission.MODIFY, Permission.AUTOCRAFTING); | ||||
|     } | ||||
|  | ||||
| */ | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|         return true; | ||||
|   | ||||
| @@ -1,33 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSBlocks; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDestructor; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockDestructor extends BlockCable { | ||||
|     public BlockDestructor() { | ||||
|         super(createBuilder("destructor").tileEntity(TileDestructor::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -41,18 +23,18 @@ public class BlockDestructor extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         return RSBlocks.CONSTRUCTOR.getCollisions(tile, state); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         return openNetworkGui(RSGui.DESTRUCTOR, player, world, pos, side); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,41 +1,19 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsDetector; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDetector; | ||||
| import net.minecraft.block.properties.PropertyBool; | ||||
| import net.minecraft.block.state.BlockFaceShape; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import net.minecraft.state.BooleanProperty; | ||||
|  | ||||
| public class BlockDetector extends BlockNode { | ||||
|     private static final PropertyBool POWERED = PropertyBool.create("powered"); | ||||
|     private static final BooleanProperty POWERED = BooleanProperty.create("powered"); | ||||
|  | ||||
|     public BlockDetector() { | ||||
|         super(BlockInfoBuilder.forId("detector").tileEntity(TileDetector::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -50,24 +28,24 @@ public class BlockDetector extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|     public BlockState getActualState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         return super.getActualState(state, world, pos) | ||||
|             .withProperty(POWERED, ((TileDetector) world.getTileEntity(pos)).getNode().isPowered()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         return Collections.singletonList(ConstantsDetector.COLLISION); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.DETECTOR, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { | ||||
|     public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) { | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|         return (tile instanceof TileDetector && ((TileDetector) tile).getNode().isPowered()) ? 15 : 0; | ||||
| @@ -75,19 +53,19 @@ public class BlockDetector extends BlockNode { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean canProvidePower(IBlockState state) { | ||||
|     public boolean canProvidePower(BlockState state) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isOpaqueCube(IBlockState state) { | ||||
|     public boolean isOpaqueCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isFullCube(IBlockState state) { | ||||
|     public boolean isFullCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
| @@ -98,7 +76,7 @@ public class BlockDetector extends BlockNode { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { | ||||
|         return BlockFaceShape.UNDEFINED; | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,28 +1,8 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.block.property.PropertyObject; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.ModelDiskDrive; | ||||
| import com.raoulvdberge.refinedstorage.render.model.loader.CustomModelLoaderDefault; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDiskDrive; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.common.property.IExtendedBlockState; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| public class BlockDiskDrive extends BlockNode { | ||||
|     public static final PropertyObject<Integer[]> DISK_STATE = new PropertyObject<>("disk_state", Integer[].class); | ||||
| @@ -30,9 +10,9 @@ public class BlockDiskDrive extends BlockNode { | ||||
|     public BlockDiskDrive() { | ||||
|         super(BlockInfoBuilder.forId("disk_drive").tileEntity(TileDiskDrive::new).create()); | ||||
|     } | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -46,7 +26,7 @@ public class BlockDiskDrive extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.DISK_DRIVE, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
| @@ -56,8 +36,8 @@ public class BlockDiskDrive extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         IBlockState s = super.getExtendedState(state, world, pos); | ||||
|     public BlockState getExtendedState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         BlockState s = super.getExtendedState(state, world, pos); | ||||
|  | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
| @@ -66,5 +46,5 @@ public class BlockDiskDrive extends BlockNode { | ||||
|         } | ||||
|  | ||||
|         return s; | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,29 +1,8 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.block.property.PropertyObject; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.ModelDiskManipulator; | ||||
| import com.raoulvdberge.refinedstorage.render.model.loader.CustomModelLoaderDefault; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileDiskManipulator; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.common.property.IExtendedBlockState; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| public class BlockDiskManipulator extends BlockNode { | ||||
|     public static final PropertyObject<Integer[]> DISK_STATE = new PropertyObject<>("disk_state", Integer[].class); | ||||
| @@ -32,8 +11,9 @@ public class BlockDiskManipulator extends BlockNode { | ||||
|         super(BlockInfoBuilder.forId("disk_manipulator").tileEntity(TileDiskManipulator::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -52,7 +32,7 @@ public class BlockDiskManipulator extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.DISK_MANIPULATOR, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
| @@ -62,8 +42,8 @@ public class BlockDiskManipulator extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         IBlockState s = super.getExtendedState(state, world, pos); | ||||
|     public BlockState getExtendedState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         BlockState s = super.getExtendedState(state, world, pos); | ||||
|  | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
| @@ -72,7 +52,7 @@ public class BlockDiskManipulator extends BlockNode { | ||||
|         } | ||||
|  | ||||
|         return s; | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,32 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsExporter; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileExporter; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockExporter extends BlockCable { | ||||
|     public BlockExporter() { | ||||
|         super(createBuilder("exporter").tileEntity(TileExporter::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -40,7 +23,7 @@ public class BlockExporter extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         List<CollisionGroup> groups = super.getCollisions(tile, state); | ||||
|  | ||||
|         switch (state.getValue(getDirection().getProperty())) { | ||||
| @@ -68,11 +51,11 @@ public class BlockExporter extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         return openNetworkGui(RSGui.EXPORTER, player, world, pos, side); | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,35 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeExternalStorage; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsCable; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsExternalStorage; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileExternalStorage; | ||||
| import net.minecraft.block.Block; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockExternalStorage extends BlockCable { | ||||
|     public BlockExternalStorage() { | ||||
|         super(createBuilder("external_storage").tileEntity(TileExternalStorage::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -43,7 +23,7 @@ public class BlockExternalStorage extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         List<CollisionGroup> groups = super.getCollisions(tile, state); | ||||
|  | ||||
|         switch (state.getValue(getDirection().getProperty())) { | ||||
| @@ -77,7 +57,7 @@ public class BlockExternalStorage extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|         } | ||||
| @@ -87,7 +67,7 @@ public class BlockExternalStorage extends BlockCable { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) { | ||||
|     public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) { | ||||
|         super.neighborChanged(state, world, pos, block, fromPos); | ||||
|  | ||||
|         if (!world.isRemote) { | ||||
| @@ -101,5 +81,5 @@ public class BlockExternalStorage extends BlockCable { | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,35 +1,23 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileFluidInterface; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockFluidInterface extends BlockNode { | ||||
|     public BlockFluidInterface() { | ||||
|         super(BlockInfoBuilder.forId("fluid_interface").tileEntity(TileFluidInterface::new).create()); | ||||
|     } | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.FLUID_INTERFACE, player, world, pos, side, Permission.MODIFY, Permission.INSERT, Permission.EXTRACT); | ||||
|     } | ||||
|     } */ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,40 +1,20 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.NetworkNodeFluidStorage; | ||||
| import com.raoulvdberge.refinedstorage.block.enums.FluidStorageType; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockFluidStorage; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileFluidStorage; | ||||
| import net.minecraft.block.properties.PropertyEnum; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.creativetab.CreativeTabs; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.nbt.CompoundNBT; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.NonNullList; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
| import net.minecraft.state.EnumProperty; | ||||
|  | ||||
| public class BlockFluidStorage extends BlockNode { | ||||
|     public static final PropertyEnum TYPE = PropertyEnum.create("type", FluidStorageType.class); | ||||
|     public static final EnumProperty TYPE = EnumProperty.create("type", FluidStorageType.class); | ||||
|  | ||||
|     public BlockFluidStorage() { | ||||
|         super(BlockInfoBuilder.forId("fluid_storage").hardness(5.8F).tileEntity(TileFluidStorage::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, FluidStorageType.TYPE_64K.getId(), new ModelResourceLocation(info.getId(), "type=64k")); | ||||
|         modelRegistration.setModel(this, FluidStorageType.TYPE_256K.getId(), new ModelResourceLocation(info.getId(), "type=256k")); | ||||
| @@ -58,17 +38,17 @@ public class BlockFluidStorage extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getStateFromMeta(int meta) { | ||||
|     public BlockState getStateFromMeta(int meta) { | ||||
|         return getDefaultState().withProperty(TYPE, FluidStorageType.getById(meta)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int getMetaFromState(IBlockState state) { | ||||
|     public int getMetaFromState(BlockState state) { | ||||
|         return ((FluidStorageType) state.getValue(TYPE)).getId(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.FLUID_STORAGE, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
| @@ -78,7 +58,7 @@ public class BlockFluidStorage extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { | ||||
|         if (!world.isRemote) { | ||||
|             NetworkNodeFluidStorage storage = ((TileFluidStorage) world.getTileEntity(pos)).getNode(); | ||||
|  | ||||
| @@ -94,7 +74,7 @@ public class BlockFluidStorage extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { | ||||
|         TileFluidStorage storage = (TileFluidStorage) world.getTileEntity(pos); | ||||
|  | ||||
|         ItemStack stack = new ItemStack(this, 1, getMetaFromState(state)); | ||||
| @@ -103,5 +83,5 @@ public class BlockFluidStorage extends BlockNode { | ||||
|         stack.getTagCompound().setUniqueId(NetworkNodeFluidStorage.NBT_ID, storage.getNode().getStorageId()); | ||||
|  | ||||
|         drops.add(stack); | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,44 +1,21 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.api.network.grid.GridType; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.API; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockBase; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.grid.TileGrid; | ||||
| import net.minecraft.block.properties.PropertyEnum; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.creativetab.CreativeTabs; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.entity.player.ServerPlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.NonNullList; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import net.minecraft.state.EnumProperty; | ||||
|  | ||||
| public class BlockGrid extends BlockNode { | ||||
|     public static final PropertyEnum TYPE = PropertyEnum.create("type", GridType.class); | ||||
|     public static final EnumProperty TYPE = EnumProperty.create("type", GridType.class); | ||||
|  | ||||
|     public BlockGrid() { | ||||
|         super(BlockInfoBuilder.forId("grid").tileEntity(TileGrid::new).create()); | ||||
|     } | ||||
|  | ||||
| /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, GridType.NORMAL.getId(), new ModelResourceLocation(info.getId(), "connected=false,direction=north,type=normal")); | ||||
|         modelRegistration.setModel(this, GridType.CRAFTING.getId(), new ModelResourceLocation(info.getId(), "connected=false,direction=north,type=crafting")); | ||||
| @@ -80,19 +57,19 @@ public class BlockGrid extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getStateFromMeta(int meta) { | ||||
|     public BlockState getStateFromMeta(int meta) { | ||||
|         return getDefaultState().withProperty(TYPE, meta == 0 ? GridType.NORMAL : (meta == 1 ? GridType.CRAFTING : (meta == 2 ? GridType.PATTERN : GridType.FLUID))); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int getMetaFromState(IBlockState state) { | ||||
|     public int getMetaFromState(BlockState state) { | ||||
|         return state.getValue(TYPE) == GridType.NORMAL ? 0 : (state.getValue(TYPE) == GridType.CRAFTING ? 1 : (state.getValue(TYPE) == GridType.PATTERN ? 2 : 3)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(player, world, pos, side, () -> API.instance().getGridManager().openGrid(NetworkNodeGrid.FACTORY_ID, (ServerPlayerEntity) player, pos)); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,32 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsImporter; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileImporter; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockImporter extends BlockCable { | ||||
|     public BlockImporter() { | ||||
|         super(createBuilder("importer").tileEntity(TileImporter::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -40,7 +23,7 @@ public class BlockImporter extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         List<CollisionGroup> groups = super.getCollisions(tile, state); | ||||
|  | ||||
|         switch (state.getValue(getDirection().getProperty())) { | ||||
| @@ -68,11 +51,11 @@ public class BlockImporter extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         return openNetworkGui(RSGui.IMPORTER, player, world, pos, side); | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,35 +1,24 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileInterface; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockInterface extends BlockNode { | ||||
|     public BlockInterface() { | ||||
|         super(BlockInfoBuilder.forId("interface").tileEntity(TileInterface::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.INTERFACE, player, world, pos, side, Permission.MODIFY, Permission.INSERT, Permission.EXTRACT); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,19 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockMachineCasing extends BlockBase { | ||||
|     public BlockMachineCasing() { | ||||
|         super(BlockInfoBuilder.forId("machine_casing").create()); | ||||
|     } | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|     } | ||||
|     } */ | ||||
| } | ||||
|   | ||||
| @@ -1,22 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileNetworkReceiver; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockNetworkReceiver extends BlockNode { | ||||
|     public BlockNetworkReceiver() { | ||||
|         super(BlockInfoBuilder.forId("network_receiver").tileEntity(TileNetworkReceiver::new).create()); | ||||
|     } | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -26,7 +19,7 @@ public class BlockNetworkReceiver extends BlockNode { | ||||
|     @Override | ||||
|     public BlockRenderLayer getRenderLayer() { | ||||
|         return BlockRenderLayer.CUTOUT; | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,29 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileNetworkTransmitter; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockNetworkTransmitter extends BlockNode { | ||||
|     public BlockNetworkTransmitter() { | ||||
|         super(BlockInfoBuilder.forId("network_transmitter").tileEntity(TileNetworkTransmitter::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -36,9 +23,9 @@ public class BlockNetworkTransmitter extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.NETWORK_TRANSMITTER, player, world, pos, side); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,31 +1,17 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode; | ||||
| import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager; | ||||
| import com.raoulvdberge.refinedstorage.api.util.Action; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.API; | ||||
| import com.raoulvdberge.refinedstorage.block.info.IBlockInfo; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileNode; | ||||
| import net.minecraft.block.properties.PropertyBool; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraft.state.BooleanProperty; | ||||
|  | ||||
| public abstract class BlockNode extends BlockNodeProxy { | ||||
|     public static final PropertyBool CONNECTED = PropertyBool.create("connected"); | ||||
|     public static final BooleanProperty CONNECTED = BooleanProperty.create("connected"); | ||||
|  | ||||
|     public BlockNode(IBlockInfo info) { | ||||
|         super(info); | ||||
|     } | ||||
|  | ||||
| /* TODO | ||||
|     @Override | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase placer, ItemStack stack) { | ||||
|         super.onBlockPlacedBy(world, pos, state, placer, stack); | ||||
|  | ||||
|         if (!world.isRemote) { | ||||
| @@ -40,7 +26,7 @@ public abstract class BlockNode extends BlockNodeProxy { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void breakBlock(World world, BlockPos pos, IBlockState state) { | ||||
|     public void breakBlock(World world, BlockPos pos, BlockState state) { | ||||
|         INetworkNodeManager manager = API.instance().getNetworkNodeManager(world); | ||||
|  | ||||
|         INetworkNode node = manager.getNode(pos); | ||||
| @@ -74,7 +60,7 @@ public abstract class BlockNode extends BlockNodeProxy { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|     public BlockState getActualState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         state = super.getActualState(state, world, pos); | ||||
|  | ||||
|         if (hasConnectedState()) { | ||||
| @@ -86,7 +72,7 @@ public abstract class BlockNode extends BlockNodeProxy { | ||||
|         } | ||||
|  | ||||
|         return state; | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     public boolean hasConnectedState() { | ||||
|         return false; | ||||
|   | ||||
| @@ -1,30 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode; | ||||
| import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.ICoverable; | ||||
| import com.raoulvdberge.refinedstorage.block.info.IBlockInfo; | ||||
| import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileBase; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileNode; | ||||
| import com.raoulvdberge.refinedstorage.util.WorldUtils; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.entity.Entity; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
|  | ||||
| public abstract class BlockNodeProxy extends BlockBase { | ||||
|     public BlockNodeProxy(IBlockInfo info) { | ||||
|         super(info); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) { | ||||
|     public boolean canEntityDestroy(BlockState state, IBlockAccess world, BlockPos pos, Entity entity) { | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|         if (tile != null && tile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, null)) { | ||||
| @@ -39,11 +24,11 @@ public abstract class BlockNodeProxy extends BlockBase { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) { | ||||
|     public boolean rotateBlock(World world, BlockPos pos, Direction axis) { | ||||
|         if (!world.isRemote && getDirection() != null) { | ||||
|             TileBase tile = (TileBase) world.getTileEntity(pos); | ||||
|  | ||||
|             EnumFacing newDirection = getDirection().cycle(tile.getDirection()); | ||||
|             Direction newDirection = getDirection().cycle(tile.getDirection()); | ||||
|  | ||||
|             if (tile instanceof TileNode && ((TileNode) tile).getNode() instanceof ICoverable && ((ICoverable) ((TileNode) tile).getNode()).getCoverManager().hasCover(newDirection)) { | ||||
|                 return false; | ||||
| @@ -53,19 +38,19 @@ public abstract class BlockNodeProxy extends BlockBase { | ||||
|         return super.rotateBlock(world, pos, axis); | ||||
|     } | ||||
|  | ||||
|     protected boolean openNetworkGui(int guiId, PlayerEntity player, World world, BlockPos pos, EnumFacing facing) { | ||||
|     protected boolean openNetworkGui(int guiId, PlayerEntity player, World world, BlockPos pos, Direction facing) { | ||||
|         return openNetworkGui(guiId, player, world, pos, facing, Permission.MODIFY); | ||||
|     } | ||||
|  | ||||
|     protected boolean openNetworkGui(int guiId, PlayerEntity player, World world, BlockPos pos, EnumFacing facing, Permission... permissions) { | ||||
|     protected boolean openNetworkGui(int guiId, PlayerEntity player, World world, BlockPos pos, Direction facing, Permission... permissions) { | ||||
|         return openNetworkGui(player, world, pos, facing, () -> player.openGui(info.getModObject(), guiId, world, pos.getX(), pos.getY(), pos.getZ()), permissions); | ||||
|     } | ||||
|  | ||||
|     protected boolean openNetworkGui(PlayerEntity player, World world, BlockPos pos, EnumFacing facing, Runnable action) { | ||||
|     protected boolean openNetworkGui(PlayerEntity player, World world, BlockPos pos, Direction facing, Runnable action) { | ||||
|         return openNetworkGui(player, world, pos, facing, action, Permission.MODIFY); | ||||
|     } | ||||
|  | ||||
|     protected boolean openNetworkGui(PlayerEntity player, World world, BlockPos pos, EnumFacing facing, Runnable action, Permission... permissions) { | ||||
|     protected boolean openNetworkGui(PlayerEntity player, World world, BlockPos pos, Direction facing, Runnable action, Permission... permissions) { | ||||
|         if (world.isRemote) { | ||||
|             return true; | ||||
|         } | ||||
| @@ -90,5 +75,5 @@ public abstract class BlockNodeProxy extends BlockBase { | ||||
|         action.run(); | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,54 +1,24 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.API; | ||||
| import com.raoulvdberge.refinedstorage.block.enums.PortableGridDiskState; | ||||
| import com.raoulvdberge.refinedstorage.block.enums.PortableGridType; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockPortableGrid; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsPortableGrid; | ||||
| import com.raoulvdberge.refinedstorage.render.meshdefinition.ItemMeshDefinitionPortableGrid; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid; | ||||
| import net.minecraft.block.properties.PropertyBool; | ||||
| import net.minecraft.block.properties.PropertyEnum; | ||||
| import net.minecraft.block.state.BlockFaceShape; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.statemap.StateMap; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.entity.player.ServerPlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.NonNullList; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import net.minecraft.state.BooleanProperty; | ||||
| import net.minecraft.state.EnumProperty; | ||||
|  | ||||
| public class BlockPortableGrid extends BlockBase { | ||||
|     public static final PropertyEnum TYPE = PropertyEnum.create("type", PortableGridType.class); | ||||
|     public static final PropertyEnum DISK_STATE = PropertyEnum.create("disk_state", PortableGridDiskState.class); | ||||
|     public static final PropertyBool CONNECTED = PropertyBool.create("connected"); | ||||
|     public static final EnumProperty TYPE = EnumProperty.create("type", PortableGridType.class); | ||||
|     public static final EnumProperty DISK_STATE = EnumProperty.create("disk_state", PortableGridDiskState.class); | ||||
|     public static final BooleanProperty CONNECTED = BooleanProperty.create("connected"); | ||||
|  | ||||
|     public BlockPortableGrid() { | ||||
|         super(BlockInfoBuilder.forId("portable_grid").tileEntity(TilePortableGrid::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setStateMapper(this, new StateMap.Builder().ignore(TYPE).build()); | ||||
|         modelRegistration.setModelMeshDefinition(this, new ItemMeshDefinitionPortableGrid()); | ||||
| @@ -71,24 +41,24 @@ public class BlockPortableGrid extends BlockBase { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         return Collections.singletonList(ConstantsPortableGrid.COLLISION); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isOpaqueCube(IBlockState state) { | ||||
|     public boolean isOpaqueCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isFullCube(IBlockState state) { | ||||
|     public boolean isFullCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase placer, ItemStack stack) { | ||||
|         super.onBlockPlacedBy(world, pos, state, placer, stack); | ||||
|  | ||||
|         if (!world.isRemote) { | ||||
| @@ -97,12 +67,12 @@ public class BlockPortableGrid extends BlockBase { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { | ||||
|         drops.add(((TilePortableGrid) world.getTileEntity(pos)).getAsItem()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { | ||||
|     public BlockState getActualState(BlockState state, IBlockAccess world, BlockPos pos) { | ||||
|         TilePortableGrid portableGrid = (TilePortableGrid) world.getTileEntity(pos); | ||||
|  | ||||
|         return super.getActualState(state, world, pos) | ||||
| @@ -120,17 +90,17 @@ public class BlockPortableGrid extends BlockBase { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getStateFromMeta(int meta) { | ||||
|     public BlockState getStateFromMeta(int meta) { | ||||
|         return getDefaultState().withProperty(TYPE, meta == 0 ? PortableGridType.NORMAL : PortableGridType.CREATIVE); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int getMetaFromState(IBlockState state) { | ||||
|     public int getMetaFromState(BlockState state) { | ||||
|         return state.getValue(TYPE) == PortableGridType.NORMAL ? 0 : 1; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!world.isRemote) { | ||||
|             API.instance().getGridManager().openGrid(TilePortableGrid.FACTORY_ID, (ServerPlayerEntity) player, pos); | ||||
|  | ||||
| @@ -142,7 +112,7 @@ public class BlockPortableGrid extends BlockBase { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { | ||||
|         return BlockFaceShape.UNDEFINED; | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,19 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockQuartzEnrichedIron extends BlockBase { | ||||
|     public BlockQuartzEnrichedIron() { | ||||
|         super(BlockInfoBuilder.forId("quartz_enriched_iron_block").create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,36 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSBlocks; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeReader; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileReader; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockReader extends BlockCable { | ||||
|     public BlockReader() { | ||||
|         super(createBuilder("reader").tileEntity(TileReader::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -44,12 +23,12 @@ public class BlockReader extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         return RSBlocks.CONSTRUCTOR.getCollisions(tile, state); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|         } | ||||
| @@ -74,11 +53,11 @@ public class BlockReader extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { | ||||
|     public boolean canConnectRedstone(BlockState state, IBlockAccess world, BlockPos pos, Direction side) { | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|         return tile instanceof TileReader && side == ((TileReader) tile).getDirection().getOpposite(); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,29 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileRelay; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| public class BlockRelay extends BlockNode { | ||||
|     public BlockRelay() { | ||||
|         super(BlockInfoBuilder.forId("relay").tileEntity(TileRelay::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -36,9 +23,9 @@ public class BlockRelay extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.RELAY, player, world, pos, side); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,33 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.security.Permission; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileSecurityManager; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| public class BlockSecurityManager extends BlockNode { | ||||
|     public BlockSecurityManager() { | ||||
|         super(BlockInfoBuilder.forId("security_manager").tileEntity(TileSecurityManager::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -53,7 +36,7 @@ public class BlockSecurityManager extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!world.isRemote) { | ||||
|             if (player.getGameProfile().getId().equals(((TileSecurityManager) world.getTileEntity(pos)).getNode().getOwner())) { | ||||
|                 player.openGui(RS.INSTANCE, RSGui.SECURITY_MANAGER, world, pos.getX(), pos.getY(), pos.getZ()); | ||||
| @@ -63,7 +46,7 @@ public class BlockSecurityManager extends BlockNode { | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,40 +1,20 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.storage.NetworkNodeStorage; | ||||
| import com.raoulvdberge.refinedstorage.block.enums.ItemStorageType; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.item.itemblock.ItemBlockStorage; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileStorage; | ||||
| import net.minecraft.block.properties.PropertyEnum; | ||||
| import net.minecraft.block.state.BlockStateContainer; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.creativetab.CreativeTabs; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.nbt.CompoundNBT; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.NonNullList; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
| import net.minecraft.state.EnumProperty; | ||||
|  | ||||
| public class BlockStorage extends BlockNode { | ||||
|     public static final PropertyEnum TYPE = PropertyEnum.create("type", ItemStorageType.class); | ||||
|     public static final EnumProperty TYPE = EnumProperty.create("type", ItemStorageType.class); | ||||
|  | ||||
|     public BlockStorage() { | ||||
|         super(BlockInfoBuilder.forId("storage").tileEntity(TileStorage::new).hardness(5.8F).create()); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, ItemStorageType.TYPE_1K.getId(), new ModelResourceLocation(info.getId(), "type=1k")); | ||||
|         modelRegistration.setModel(this, ItemStorageType.TYPE_4K.getId(), new ModelResourceLocation(info.getId(), "type=4k")); | ||||
| @@ -58,17 +38,17 @@ public class BlockStorage extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public IBlockState getStateFromMeta(int meta) { | ||||
|     public BlockState getStateFromMeta(int meta) { | ||||
|         return getDefaultState().withProperty(TYPE, ItemStorageType.getById(meta)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int getMetaFromState(IBlockState state) { | ||||
|     public int getMetaFromState(BlockState state) { | ||||
|         return ((ItemStorageType) state.getValue(TYPE)).getId(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.STORAGE, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
| @@ -78,7 +58,7 @@ public class BlockStorage extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { | ||||
|     public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, EntityLivingBase player, ItemStack stack) { | ||||
|         if (!world.isRemote) { | ||||
|             NetworkNodeStorage storage = ((TileStorage) world.getTileEntity(pos)).getNode(); | ||||
|  | ||||
| @@ -94,7 +74,7 @@ public class BlockStorage extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { | ||||
|     public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { | ||||
|         TileStorage storage = (TileStorage) world.getTileEntity(pos); | ||||
|  | ||||
|         ItemStack stack = new ItemStack(this, 1, getMetaFromState(state)); | ||||
| @@ -103,5 +83,5 @@ public class BlockStorage extends BlockNode { | ||||
|         stack.getTagCompound().setUniqueId(NetworkNodeStorage.NBT_ID, storage.getNode().getStorageId()); | ||||
|  | ||||
|         drops.add(stack); | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -1,34 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeStorageMonitor; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.tesr.TileEntitySpecialRendererStorageMonitor; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.util.math.RayTraceResult; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.common.ForgeHooks; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| public class BlockStorageMonitor extends BlockNode { | ||||
|     public BlockStorageMonitor() { | ||||
|         super(BlockInfoBuilder.forId("storage_monitor").tileEntity(TileStorageMonitor::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north")); | ||||
|  | ||||
| @@ -42,7 +24,7 @@ public class BlockStorageMonitor extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!world.isRemote) { | ||||
|             ItemStack held = player.inventory.getCurrentItem(); | ||||
|  | ||||
| @@ -75,7 +57,7 @@ public class BlockStorageMonitor extends BlockNode { | ||||
|  | ||||
|             ((TileStorageMonitor) world.getTileEntity(pos)).getNode().extract(player, rayResult.sideHit); | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,46 +1,16 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeCable; | ||||
| import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder; | ||||
| import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.render.constants.ConstantsWirelessTransmitter; | ||||
| import com.raoulvdberge.refinedstorage.render.model.baked.BakedModelFullbright; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileWirelessTransmitter; | ||||
| import net.minecraft.block.Block; | ||||
| import net.minecraft.block.state.BlockFaceShape; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.client.resources.I18n; | ||||
| import net.minecraft.client.util.ITooltipFlag; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.BlockRenderLayer; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.util.text.TextFormatting; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockWirelessTransmitter extends BlockNode { | ||||
|     public BlockWirelessTransmitter() { | ||||
|         super(BlockInfoBuilder.forId("wireless_transmitter").tileEntity(TileWirelessTransmitter::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "inventory")); | ||||
|  | ||||
| @@ -48,13 +18,13 @@ public class BlockWirelessTransmitter extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         return openNetworkGui(RSGui.WIRELESS_TRANSMITTER, player, world, pos, side); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { | ||||
|     public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { | ||||
|         if (!canPlaceBlockAt(world, pos) && world.getBlockState(pos).getBlock() == this) { | ||||
|             dropBlockAsItem(world, pos, state, 0); | ||||
|  | ||||
| @@ -63,35 +33,35 @@ public class BlockWirelessTransmitter extends BlockNode { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         return Collections.singletonList(ConstantsWirelessTransmitter.COLLISION); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isOpaqueCube(IBlockState state) { | ||||
|     public boolean isOpaqueCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean isFullCube(IBlockState state) { | ||||
|     public boolean isFullCube(BlockState state) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean canPlaceBlockAt(World world, BlockPos pos) { | ||||
|         TileEntity tile = world.getTileEntity(pos.offset(EnumFacing.DOWN)); | ||||
|         TileEntity tile = world.getTileEntity(pos.offset(Direction.DOWN)); | ||||
|  | ||||
|         if (tile != null && tile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, EnumFacing.UP)) { | ||||
|             INetworkNodeProxy proxy = tile.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, EnumFacing.UP); | ||||
|         if (tile != null && tile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, Direction.UP)) { | ||||
|             INetworkNodeProxy proxy = tile.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, Direction.UP); | ||||
|  | ||||
|             if (proxy != null && proxy.getNode() instanceof INetworkNodeCable) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return world.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock() instanceof BlockCable; // Make sure we still detect stuff like importers/exporters/etc. | ||||
|         return world.getBlockState(pos.offset(Direction.DOWN)).getBlock() instanceof BlockCable; // Make sure we still detect stuff like importers/exporters/etc. | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -113,7 +83,7 @@ public class BlockWirelessTransmitter extends BlockNode { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { | ||||
|     public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { | ||||
|         return BlockFaceShape.UNDEFINED; | ||||
|     } | ||||
|     } */ | ||||
| } | ||||
|   | ||||
| @@ -1,37 +1,15 @@ | ||||
| package com.raoulvdberge.refinedstorage.block; | ||||
|  | ||||
| import com.raoulvdberge.refinedstorage.RS; | ||||
| import com.raoulvdberge.refinedstorage.RSBlocks; | ||||
| import com.raoulvdberge.refinedstorage.RSGui; | ||||
| import com.raoulvdberge.refinedstorage.api.network.readerwriter.IReaderWriterChannel; | ||||
| import com.raoulvdberge.refinedstorage.api.network.readerwriter.IWriter; | ||||
| import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeWriter; | ||||
| import com.raoulvdberge.refinedstorage.block.info.BlockDirection; | ||||
| import com.raoulvdberge.refinedstorage.render.IModelRegistration; | ||||
| import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup; | ||||
| import com.raoulvdberge.refinedstorage.tile.TileWriter; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.entity.player.PlayerEntity; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.EnumHand; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
| import net.minecraft.world.IBlockAccess; | ||||
| import net.minecraft.world.World; | ||||
| import net.minecraftforge.fml.relauncher.Side; | ||||
| import net.minecraftforge.fml.relauncher.SideOnly; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.List; | ||||
|  | ||||
| public class BlockWriter extends BlockCable { | ||||
|     public BlockWriter() { | ||||
|         super(createBuilder("writer").tileEntity(TileWriter::new).create()); | ||||
|     } | ||||
|  | ||||
|     /* TODO | ||||
|     @Override | ||||
|     @SideOnly(Side.CLIENT) | ||||
|     @OnlyIn(Dist.CLIENT) | ||||
|     public void registerModels(IModelRegistration modelRegistration) { | ||||
|         modelRegistration.setModel(this, 0, new ModelResourceLocation(info.getId(), "connected=false,direction=north,down=false,east=true,north=false,south=false,up=false,west=true")); | ||||
|  | ||||
| @@ -45,12 +23,12 @@ public class BlockWriter extends BlockCable { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) { | ||||
|     public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) { | ||||
|         return RSBlocks.CONSTRUCTOR.getCollisions(tile, state); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, PlayerEntity player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { | ||||
|     public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, EnumHand hand, Direction side, float hitX, float hitY, float hitZ) { | ||||
|         if (!canAccessGui(state, world, pos, hitX, hitY, hitZ)) { | ||||
|             return false; | ||||
|         } | ||||
| @@ -76,7 +54,7 @@ public class BlockWriter extends BlockCable { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { | ||||
|     public int getWeakPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) { | ||||
|         IWriter writer = ((TileWriter) world.getTileEntity(pos)).getNode(); | ||||
|  | ||||
|         return side == writer.getDirection().getOpposite() ? writer.getRedstoneStrength() : 0; | ||||
| @@ -84,22 +62,22 @@ public class BlockWriter extends BlockCable { | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { | ||||
|     public int getStrongPower(BlockState state, IBlockAccess world, BlockPos pos, Direction side) { | ||||
|         return getWeakPower(state, world, pos, side); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @SuppressWarnings("deprecation") | ||||
|     public boolean canProvidePower(IBlockState state) { | ||||
|     public boolean canProvidePower(BlockState state) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { | ||||
|     public boolean canConnectRedstone(BlockState state, IBlockAccess world, BlockPos pos, Direction side) { | ||||
|         TileEntity tile = world.getTileEntity(pos); | ||||
|  | ||||
|         return tile instanceof TileWriter && side == ((TileWriter) tile).getDirection().getOpposite(); | ||||
|     } | ||||
|     }*/ | ||||
|  | ||||
|     @Override | ||||
|     public boolean hasConnectedState() { | ||||
|   | ||||
| @@ -1,33 +1,34 @@ | ||||
| package com.raoulvdberge.refinedstorage.block.info; | ||||
|  | ||||
| import net.minecraft.block.properties.PropertyDirection; | ||||
| import net.minecraft.entity.EntityLivingBase; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import com.raoulvdberge.refinedstorage.util.DirectionUtils; | ||||
| import net.minecraft.entity.LivingEntity; | ||||
| import net.minecraft.state.DirectionProperty; | ||||
| import net.minecraft.util.Direction; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
|  | ||||
| import java.util.Arrays; | ||||
|  | ||||
| public enum BlockDirection { | ||||
|     ANY(EnumFacing.VALUES), | ||||
|     ANY_FACE_PLAYER(EnumFacing.VALUES), | ||||
|     HORIZONTAL(EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST); | ||||
|     ANY(Direction.values()), | ||||
|     ANY_FACE_PLAYER(Direction.values()), | ||||
|     HORIZONTAL(Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST); | ||||
|  | ||||
|     private final PropertyDirection property; | ||||
|     private final DirectionProperty property; | ||||
|  | ||||
|     BlockDirection(EnumFacing... allowed) { | ||||
|         this.property = PropertyDirection.create("direction", Arrays.asList(allowed)); | ||||
|     BlockDirection(Direction... allowed) { | ||||
|         this.property = DirectionProperty.create("direction", Arrays.asList(allowed)); | ||||
|     } | ||||
|  | ||||
|     public PropertyDirection getProperty() { | ||||
|     public DirectionProperty getProperty() { | ||||
|         return property; | ||||
|     } | ||||
|  | ||||
|     public EnumFacing getFrom(EnumFacing facing, BlockPos pos, EntityLivingBase entity) { | ||||
|     public Direction getFrom(Direction facing, BlockPos pos, LivingEntity entity) { | ||||
|         switch (this) { | ||||
|             case ANY: | ||||
|                 return facing.getOpposite(); | ||||
|             case ANY_FACE_PLAYER: | ||||
|                 return EnumFacing.getDirectionFromEntityLiving(pos, entity); | ||||
|                 return DirectionUtils.getFacingFromEntity(pos, entity); | ||||
|             case HORIZONTAL: | ||||
|                 return entity.getHorizontalFacing().getOpposite(); | ||||
|             default: | ||||
| @@ -35,11 +36,11 @@ public enum BlockDirection { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public EnumFacing cycle(EnumFacing previous) { | ||||
|     public Direction cycle(Direction previous) { | ||||
|         switch (this) { | ||||
|             case ANY: | ||||
|             case ANY_FACE_PLAYER: | ||||
|                 return previous.ordinal() + 1 >= EnumFacing.VALUES.length ? EnumFacing.VALUES[0] : EnumFacing.VALUES[previous.ordinal() + 1]; | ||||
|                 return previous.ordinal() + 1 >= Direction.values().length ? Direction.values()[0] : Direction.values()[previous.ordinal() + 1]; | ||||
|             case HORIZONTAL: | ||||
|                 return previous.rotateYCCW(); | ||||
|             default: | ||||
|   | ||||
| @@ -1,12 +1,10 @@ | ||||
| package com.raoulvdberge.refinedstorage.render; | ||||
|  | ||||
| import net.minecraft.block.Block; | ||||
| import net.minecraft.client.renderer.ItemMeshDefinition; | ||||
| import net.minecraft.client.renderer.block.model.IBakedModel; | ||||
| import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||||
| import net.minecraft.client.renderer.block.statemap.IStateMapper; | ||||
| import net.minecraft.client.renderer.color.IItemColor; | ||||
| import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; | ||||
| import net.minecraft.client.renderer.model.IBakedModel; | ||||
| import net.minecraft.client.renderer.model.ModelResourceLocation; | ||||
| import net.minecraft.client.renderer.tileentity.TileEntityRenderer; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.tileentity.TileEntity; | ||||
| import net.minecraft.util.ResourceLocation; | ||||
| @@ -24,14 +22,10 @@ public interface IModelRegistration { | ||||
|  | ||||
|     void setModelVariants(Item item, ResourceLocation... variants); | ||||
|  | ||||
|     void setModelMeshDefinition(Block block, ItemMeshDefinition meshDefinition); | ||||
|  | ||||
|     // Supplier needed to avoid server crash. | ||||
|     void addModelLoader(Supplier<ICustomModelLoader> modelLoader); | ||||
|  | ||||
|     void setStateMapper(Block block, IStateMapper stateMapper); | ||||
|  | ||||
|     void setTesr(Class<? extends TileEntity> tile, TileEntitySpecialRenderer tesr); | ||||
|     <T extends TileEntity> void setTesr(Class<T> tile, TileEntityRenderer<T> tesr); | ||||
|  | ||||
|     void addItemColor(Item item, IItemColor itemColor); | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| package com.raoulvdberge.refinedstorage.render.collision; | ||||
|  | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.Direction; | ||||
| import net.minecraft.util.math.AxisAlignedBB; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| @@ -11,7 +11,7 @@ public class CollisionGroup { | ||||
|     private List<AxisAlignedBB> items = new ArrayList<>(); | ||||
|     private boolean canAccessGui; | ||||
|     @Nullable | ||||
|     private EnumFacing direction; | ||||
|     private Direction direction; | ||||
|  | ||||
|     public CollisionGroup addItem(AxisAlignedBB item) { | ||||
|         items.add(item); | ||||
| @@ -33,14 +33,14 @@ public class CollisionGroup { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     public CollisionGroup setDirection(EnumFacing direction) { | ||||
|     public CollisionGroup setDirection(Direction direction) { | ||||
|         this.direction = direction; | ||||
|  | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Nullable | ||||
|     public EnumFacing getDirection() { | ||||
|     public Direction getDirection() { | ||||
|         return direction; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,17 +1,18 @@ | ||||
| package com.raoulvdberge.refinedstorage.render.model.baked; | ||||
|  | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.client.renderer.block.model.BakedQuad; | ||||
| import net.minecraft.client.renderer.block.model.IBakedModel; | ||||
| import net.minecraft.client.renderer.block.model.ItemCameraTransforms; | ||||
| import net.minecraft.client.renderer.block.model.ItemOverrideList; | ||||
| import net.minecraft.block.BlockState; | ||||
| import net.minecraft.client.renderer.model.BakedQuad; | ||||
| import net.minecraft.client.renderer.model.IBakedModel; | ||||
| import net.minecraft.client.renderer.model.ItemCameraTransforms; | ||||
| import net.minecraft.client.renderer.model.ItemOverrideList; | ||||
| import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.Direction; | ||||
| import org.apache.commons.lang3.tuple.Pair; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import javax.vecmath.Matrix4f; | ||||
| import java.util.List; | ||||
| import java.util.Random; | ||||
|  | ||||
| public class BakedModelDelegate implements IBakedModel { | ||||
|     protected final IBakedModel base; | ||||
| @@ -21,7 +22,7 @@ public class BakedModelDelegate implements IBakedModel { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { | ||||
|     public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) { | ||||
|         return base.getQuads(state, side, rand); | ||||
|     } | ||||
|  | ||||
| @@ -31,7 +32,7 @@ public class BakedModelDelegate implements IBakedModel { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean isAmbientOcclusion(IBlockState state) { | ||||
|     public boolean isAmbientOcclusion(BlockState state) { | ||||
|         return base.isAmbientOcclusion(state); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -4,15 +4,15 @@ import com.google.common.cache.CacheBuilder; | ||||
| import com.google.common.cache.CacheLoader; | ||||
| import com.google.common.cache.LoadingCache; | ||||
| import com.raoulvdberge.refinedstorage.util.RenderUtils; | ||||
| import net.minecraft.block.state.IBlockState; | ||||
| import net.minecraft.block.BlockState; | ||||
| import net.minecraft.client.Minecraft; | ||||
| import net.minecraft.client.renderer.block.model.BakedQuad; | ||||
| import net.minecraft.client.renderer.block.model.IBakedModel; | ||||
| import net.minecraft.client.renderer.model.BakedQuad; | ||||
| import net.minecraft.client.renderer.model.IBakedModel; | ||||
| import net.minecraft.client.renderer.vertex.VertexFormat; | ||||
| import net.minecraft.util.EnumFacing; | ||||
| import net.minecraft.util.Direction; | ||||
| import net.minecraft.util.ResourceLocation; | ||||
| import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; | ||||
| import net.minecraftforge.client.model.pipeline.VertexLighterFlat; | ||||
| import net.minecraftforge.common.property.IExtendedBlockState; | ||||
|  | ||||
| import javax.annotation.Nullable; | ||||
| import java.util.*; | ||||
| @@ -20,11 +20,11 @@ import java.util.*; | ||||
| public class BakedModelFullbright extends BakedModelDelegate { | ||||
|     private class CacheKey { | ||||
|         private IBakedModel base; | ||||
|         private Set<String> textures; | ||||
|         private IBlockState state; | ||||
|         private EnumFacing side; | ||||
|         private Set<ResourceLocation> textures; | ||||
|         private BlockState state; | ||||
|         private Direction side; | ||||
|  | ||||
|         public CacheKey(IBakedModel base, Set<String> textures, IBlockState state, EnumFacing side) { | ||||
|         public CacheKey(IBakedModel base, Set<ResourceLocation> textures, BlockState state, Direction side) { | ||||
|             this.base = base; | ||||
|             this.textures = textures; | ||||
|             this.state = state; | ||||
| @@ -63,14 +63,14 @@ public class BakedModelFullbright extends BakedModelDelegate { | ||||
|     private static final LoadingCache<CacheKey, List<BakedQuad>> CACHE = CacheBuilder.newBuilder().build(new CacheLoader<CacheKey, List<BakedQuad>>() { | ||||
|         @Override | ||||
|         public List<BakedQuad> load(CacheKey key) { | ||||
|             return transformQuads(key.base.getQuads(key.state, key.side, 0), key.textures); | ||||
|             return transformQuads(key.base.getQuads(key.state, key.side, new Random()), key.textures); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     private Set<String> textures; | ||||
|     private Set<ResourceLocation> textures; | ||||
|     private boolean cacheDisabled = false; | ||||
|  | ||||
|     public BakedModelFullbright(IBakedModel base, String... textures) { | ||||
|     public BakedModelFullbright(IBakedModel base, ResourceLocation... textures) { | ||||
|         super(base); | ||||
|  | ||||
|         this.textures = new HashSet<>(Arrays.asList(textures)); | ||||
| @@ -83,25 +83,25 @@ public class BakedModelFullbright extends BakedModelDelegate { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { | ||||
|     public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) { | ||||
|         if (state == null) { | ||||
|             return base.getQuads(state, side, rand); | ||||
|         } | ||||
|  | ||||
|         if (cacheDisabled) { | ||||
|             return transformQuads(base.getQuads(state, side, 0), textures); | ||||
|             return transformQuads(base.getQuads(state, side, rand), textures); | ||||
|         } | ||||
|  | ||||
|         return CACHE.getUnchecked(new CacheKey(base, textures, state instanceof IExtendedBlockState ? ((IExtendedBlockState) state).getClean() : state, side)); | ||||
|         return CACHE.getUnchecked(new CacheKey(base, textures, state, side)); | ||||
|     } | ||||
|  | ||||
|     private static List<BakedQuad> transformQuads(List<BakedQuad> oldQuads, Set<String> textures) { | ||||
|     private static List<BakedQuad> transformQuads(List<BakedQuad> oldQuads, Set<ResourceLocation> textures) { | ||||
|         List<BakedQuad> quads = new ArrayList<>(oldQuads); | ||||
|  | ||||
|         for (int i = 0; i < quads.size(); ++i) { | ||||
|             BakedQuad quad = quads.get(i); | ||||
|  | ||||
|             if (textures.contains(quad.getSprite().getIconName())) { | ||||
|             if (textures.contains(quad.getSprite().getName())) { | ||||
|                 quads.set(i, transformQuad(quad, 0.007F)); | ||||
|             } | ||||
|         } | ||||
| @@ -118,7 +118,7 @@ public class BakedModelFullbright extends BakedModelDelegate { | ||||
|  | ||||
|         UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(newFormat); | ||||
|  | ||||
|         VertexLighterFlat trans = new VertexLighterFlat(Minecraft.getMinecraft().getBlockColors()) { | ||||
|         VertexLighterFlat trans = new VertexLighterFlat(Minecraft.getInstance().getBlockColors()) { | ||||
|             @Override | ||||
|             protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) { | ||||
|                 lightmap[0] = light; | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| package com.raoulvdberge.refinedstorage.util; | ||||
|  | ||||
| import net.minecraft.entity.LivingEntity; | ||||
| import net.minecraft.util.Direction; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
|  | ||||
| public final class DirectionUtils { | ||||
|     public static Direction getFacingFromEntity(BlockPos clickedBlock, LivingEntity entity) { | ||||
|         return Direction.getFacingFromVector((float) (entity.posX - clickedBlock.getX()), (float) (entity.posY - clickedBlock.getY()), (float) (entity.posZ - clickedBlock.getZ())); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 raoulvdberge
					raoulvdberge