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