Added code formatter
This commit is contained in:
parent
710f9c04e7
commit
b9448d5d90
444 changed files with 32383 additions and 26254 deletions
|
@ -1,5 +1,11 @@
|
|||
package techreborn.parts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mcmultipart.MCMultiPartMod;
|
||||
import mcmultipart.microblock.IMicroblock;
|
||||
import mcmultipart.multipart.IMultipartContainer;
|
||||
|
@ -7,7 +13,6 @@ import mcmultipart.multipart.INormallyOccludingPart;
|
|||
import mcmultipart.multipart.ISlottedPart;
|
||||
import mcmultipart.multipart.Multipart;
|
||||
import mcmultipart.multipart.MultipartHelper;
|
||||
import mcmultipart.multipart.OcclusionHelper;
|
||||
import mcmultipart.multipart.PartSlot;
|
||||
import mcmultipart.raytrace.PartMOP;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -44,408 +49,474 @@ import techreborn.init.ModSounds;
|
|||
import techreborn.power.TRPowerNet;
|
||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 02/03/2016.
|
||||
*/
|
||||
public abstract class CableMultipart extends Multipart implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType {
|
||||
public abstract class CableMultipart extends Multipart
|
||||
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType
|
||||
{
|
||||
|
||||
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
||||
public float center = 0.6F;
|
||||
public float offset = 0.10F;
|
||||
public Map<EnumFacing, BlockPos> connectedSides;
|
||||
public int ticks = 0;
|
||||
public ItemStack stack;
|
||||
public TRPowerNet mergeWith = null;
|
||||
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
||||
public float center = 0.6F;
|
||||
public float offset = 0.10F;
|
||||
public Map<EnumFacing, BlockPos> connectedSides;
|
||||
public int ticks = 0;
|
||||
public ItemStack stack;
|
||||
public TRPowerNet mergeWith = null;
|
||||
|
||||
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
||||
public static final IUnlistedProperty<Boolean> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
|
||||
public static final IUnlistedProperty<Boolean> NORTH = Properties.toUnlisted(PropertyBool.create("north"));
|
||||
public static final IUnlistedProperty<Boolean> EAST = Properties.toUnlisted(PropertyBool.create("east"));
|
||||
public static final IUnlistedProperty<Boolean> SOUTH = Properties.toUnlisted(PropertyBool.create("south"));
|
||||
public static final IUnlistedProperty<Boolean> WEST = Properties.toUnlisted(PropertyBool.create("west"));
|
||||
public static final IProperty<EnumCableType> TYPE = PropertyEnum.create("type", EnumCableType.class);
|
||||
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
||||
public static final IUnlistedProperty<Boolean> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
|
||||
public static final IUnlistedProperty<Boolean> NORTH = Properties.toUnlisted(PropertyBool.create("north"));
|
||||
public static final IUnlistedProperty<Boolean> EAST = Properties.toUnlisted(PropertyBool.create("east"));
|
||||
public static final IUnlistedProperty<Boolean> SOUTH = Properties.toUnlisted(PropertyBool.create("south"));
|
||||
public static final IUnlistedProperty<Boolean> WEST = Properties.toUnlisted(PropertyBool.create("west"));
|
||||
public static final IProperty<EnumCableType> TYPE = PropertyEnum.create("type", EnumCableType.class);
|
||||
|
||||
public CableMultipart() {
|
||||
connectedSides = new HashMap<>();
|
||||
refreshBounding();
|
||||
}
|
||||
public CableMultipart()
|
||||
{
|
||||
connectedSides = new HashMap<>();
|
||||
refreshBounding();
|
||||
}
|
||||
|
||||
public void refreshBounding() {
|
||||
float centerFirst = center - offset;
|
||||
double w = (getCableType().cableThickness / 16) - 0.5;
|
||||
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w,
|
||||
centerFirst - w, centerFirst + w, centerFirst + w, centerFirst
|
||||
+ w);
|
||||
public void refreshBounding()
|
||||
{
|
||||
float centerFirst = center - offset;
|
||||
double w = (getCableType().cableThickness / 16) - 0.5;
|
||||
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w,
|
||||
centerFirst + w, centerFirst + w);
|
||||
|
||||
int i = 0;
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
|
||||
int i = 0;
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
|
||||
double yMin1 = (dir.getFrontOffsetY() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double yMax1 = (dir.getFrontOffsetY() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
|
||||
double zMin1 = (dir.getFrontOffsetZ() < 0 ? 0.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double zMax1 = (dir.getFrontOffsetZ() > 0 ? 1.0
|
||||
: (dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1,
|
||||
yMax1, zMax1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
|
||||
@Override
|
||||
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
|
||||
{
|
||||
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir) && mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
super.addCollisionBoxes(mask, list, collidingEntity);
|
||||
}
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
if (connectedSides.containsKey(dir)
|
||||
&& mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
if (mask.intersectsWith(boundingBoxes[6].toAABB()))
|
||||
{
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
super.addCollisionBoxes(mask, list, collidingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionBoxes(List<AxisAlignedBB> list) {
|
||||
@Override
|
||||
public void addSelectionBoxes(List<AxisAlignedBB> list)
|
||||
{
|
||||
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
super.addSelectionBoxes(list);
|
||||
}
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
super.addSelectionBoxes(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved() {
|
||||
super.onRemoved();
|
||||
removeFromNetwork();
|
||||
for(EnumFacing dir : EnumFacing.VALUES){
|
||||
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if(multipart != null){
|
||||
multipart.nearByChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRemoved()
|
||||
{
|
||||
super.onRemoved();
|
||||
removeFromNetwork();
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (multipart != null)
|
||||
{
|
||||
multipart.nearByChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnloaded() {
|
||||
super.onUnloaded();
|
||||
removeFromNetwork();
|
||||
}
|
||||
@Override
|
||||
public void onUnloaded()
|
||||
{
|
||||
super.onUnloaded();
|
||||
removeFromNetwork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
@Override
|
||||
public void addOcclusionBoxes(List<AxisAlignedBB> list)
|
||||
{
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(Block block) {
|
||||
super.onNeighborBlockChange(block);
|
||||
nearByChange();
|
||||
@Override
|
||||
public void onNeighborBlockChange(Block block)
|
||||
{
|
||||
super.onNeighborBlockChange(block);
|
||||
nearByChange();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void nearByChange() {
|
||||
if(network == null){
|
||||
findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
checkConnectedSides();
|
||||
for (EnumFacing direction : EnumFacing.VALUES) {
|
||||
BlockPos blockPos = getPos().offset(direction);
|
||||
WorldUtils.updateBlock(getWorld(), blockPos);
|
||||
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
|
||||
if (part != null) {
|
||||
part.checkConnectedSides();
|
||||
}
|
||||
}
|
||||
TRPowerNet.buildEndpoint(network);
|
||||
}
|
||||
public void nearByChange()
|
||||
{
|
||||
if (network == null)
|
||||
{
|
||||
findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
checkConnectedSides();
|
||||
for (EnumFacing direction : EnumFacing.VALUES)
|
||||
{
|
||||
BlockPos blockPos = getPos().offset(direction);
|
||||
WorldUtils.updateBlock(getWorld(), blockPos);
|
||||
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
|
||||
if (part != null)
|
||||
{
|
||||
part.checkConnectedSides();
|
||||
}
|
||||
}
|
||||
TRPowerNet.buildEndpoint(network);
|
||||
}
|
||||
|
||||
public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side) {
|
||||
if(world == null || pos == null){
|
||||
return null;
|
||||
}
|
||||
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
|
||||
if (side != null && container != null) {
|
||||
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
|
||||
if (slottedPart instanceof IMicroblock.IFaceMicroblock && !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
if (world == null || pos == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
|
||||
if (side != null && container != null)
|
||||
{
|
||||
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
|
||||
if (slottedPart instanceof IMicroblock.IFaceMicroblock
|
||||
&& !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (container == null) {
|
||||
return null;
|
||||
}
|
||||
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
|
||||
if (part instanceof CableMultipart) {
|
||||
return (CableMultipart) part;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (container == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
|
||||
if (part instanceof CableMultipart)
|
||||
{
|
||||
return (CableMultipart) part;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
nearByChange();
|
||||
}
|
||||
@Override
|
||||
public void onAdded()
|
||||
{
|
||||
nearByChange();
|
||||
}
|
||||
|
||||
public boolean shouldConnectTo(EnumFacing dir) {
|
||||
if (dir != null) {
|
||||
if (internalShouldConnectTo(dir)) {
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
TileEntity tile = getNeighbourTile(dir);
|
||||
public boolean shouldConnectTo(EnumFacing dir)
|
||||
{
|
||||
if (dir != null)
|
||||
{
|
||||
if (internalShouldConnectTo(dir))
|
||||
{
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
TileEntity tile = getNeighbourTile(dir);
|
||||
|
||||
if (tile instanceof IEnergyInterfaceTile) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (tile instanceof IEnergyInterfaceTile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean internalShouldConnectTo(EnumFacing dir) {
|
||||
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
|
||||
if (part instanceof IMicroblock.IFaceMicroblock) {
|
||||
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean internalShouldConnectTo(EnumFacing dir)
|
||||
{
|
||||
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
|
||||
if (part instanceof IMicroblock.IFaceMicroblock)
|
||||
{
|
||||
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 1.9 boken
|
||||
// if (!OcclusionHelper.occlusionTest(this, boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
||||
// return false;
|
||||
// }
|
||||
// TODO 1.9 boken
|
||||
// if (!OcclusionHelper.occlusionTest(this,
|
||||
// boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
||||
|
||||
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (cableMultipart != null && cableMultipart.getCableType() == getCableType())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntity getNeighbourTile(EnumFacing side) {
|
||||
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
|
||||
}
|
||||
public TileEntity getNeighbourTile(EnumFacing side)
|
||||
{
|
||||
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
|
||||
}
|
||||
|
||||
public void checkConnectedSides() {
|
||||
refreshBounding();
|
||||
connectedSides = new HashMap<>();
|
||||
for (EnumFacing dir : EnumFacing.values()) {
|
||||
int d = Functions.getIntDirFromDirection(dir);
|
||||
if (getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (shouldConnectTo(dir)) {
|
||||
connectedSides.put(dir, te.getPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void checkConnectedSides()
|
||||
{
|
||||
refreshBounding();
|
||||
connectedSides = new HashMap<>();
|
||||
for (EnumFacing dir : EnumFacing.values())
|
||||
{
|
||||
int d = Functions.getIntDirFromDirection(dir);
|
||||
if (getWorld() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (shouldConnectTo(dir))
|
||||
{
|
||||
connectedSides.put(dir, te.getPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<PartSlot> getSlotMask() {
|
||||
return EnumSet.of(PartSlot.CENTER);
|
||||
}
|
||||
@Override
|
||||
public EnumSet<PartSlot> getSlotMask()
|
||||
{
|
||||
return EnumSet.of(PartSlot.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (getWorld() != null) {
|
||||
if (getWorld().getTotalWorldTime() % 80 == 0) {
|
||||
checkConnectedSides();
|
||||
}
|
||||
}
|
||||
if (network == null) {
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
} else {
|
||||
if(mergeWith != null){
|
||||
getNetwork().merge(network);
|
||||
mergeWith = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (getWorld() != null)
|
||||
{
|
||||
if (getWorld().getTotalWorldTime() % 80 == 0)
|
||||
{
|
||||
checkConnectedSides();
|
||||
}
|
||||
}
|
||||
if (network == null)
|
||||
{
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
} else
|
||||
{
|
||||
if (mergeWith != null)
|
||||
{
|
||||
getNetwork().merge(network);
|
||||
mergeWith = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state) {
|
||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||
return extendedBlockState
|
||||
.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
|
||||
.withProperty(UP, shouldConnectTo(EnumFacing.UP))
|
||||
.withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
|
||||
.withProperty(SOUTH, shouldConnectTo(EnumFacing.SOUTH))
|
||||
.withProperty(WEST, shouldConnectTo(EnumFacing.WEST))
|
||||
.withProperty(EAST, shouldConnectTo(EnumFacing.EAST))
|
||||
.withProperty(TYPE, getCableType());
|
||||
}
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state)
|
||||
{
|
||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||
return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
|
||||
.withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
|
||||
.withProperty(SOUTH, shouldConnectTo(EnumFacing.SOUTH))
|
||||
.withProperty(WEST, shouldConnectTo(EnumFacing.WEST))
|
||||
.withProperty(EAST, shouldConnectTo(EnumFacing.EAST)).withProperty(TYPE, getCableType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(MCMultiPartMod.multipart,
|
||||
new IProperty[]{
|
||||
TYPE
|
||||
},
|
||||
new IUnlistedProperty[]{
|
||||
DOWN,
|
||||
UP,
|
||||
NORTH,
|
||||
SOUTH,
|
||||
WEST,
|
||||
EAST});
|
||||
}
|
||||
@Override
|
||||
public BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { TYPE },
|
||||
new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST });
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getModelPath() {
|
||||
// return "techreborn:cable";
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public String getModelPath() {
|
||||
// return "techreborn:cable";
|
||||
// }
|
||||
@Override
|
||||
public float getHardness(PartMOP hit)
|
||||
{
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHardness(PartMOP hit) {
|
||||
return 0.5F;
|
||||
}
|
||||
public Material getMaterial()
|
||||
{
|
||||
return Material.cloth;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return Material.cloth;
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getDrops()
|
||||
{
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops() {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()));
|
||||
return list;
|
||||
}
|
||||
@Override
|
||||
public void onEntityCollided(Entity entity)
|
||||
{
|
||||
if (getCableType().canKill && entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (network != null)
|
||||
{
|
||||
if (network.getEnergy() != 0)
|
||||
{
|
||||
if (ConfigTechReborn.UninsulatedElectocutionDamage)
|
||||
{
|
||||
if (getCableType() == EnumCableType.HV)
|
||||
{
|
||||
entity.setFire(1);
|
||||
}
|
||||
network.setEnergy(-1);
|
||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||
}
|
||||
if (ConfigTechReborn.UninsulatedElectocutionSound)
|
||||
{
|
||||
getWorld().playSound(entity.posX, entity.posY, entity.posZ, ModSounds.shock,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F, false);
|
||||
}
|
||||
if (ConfigTechReborn.UninsulatedElectocutionParticle)
|
||||
{
|
||||
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0, 0,
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityStanding(Entity entity)
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onEntityCollided(Entity entity) {
|
||||
if (getCableType().canKill && entity instanceof EntityLivingBase) {
|
||||
if(network != null){
|
||||
if(network.getEnergy() != 0){
|
||||
if(ConfigTechReborn.UninsulatedElectocutionDamage){
|
||||
if(getCableType() == EnumCableType.HV){
|
||||
entity.setFire(1);
|
||||
}
|
||||
network.setEnergy(-1);
|
||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||
}
|
||||
if(ConfigTechReborn.UninsulatedElectocutionSound){
|
||||
getWorld().playSound(entity.posX, entity.posY, entity.posZ, ModSounds.shock, SoundCategory.BLOCKS, 0.6F, 1F, false);
|
||||
}
|
||||
if(ConfigTechReborn.UninsulatedElectocutionParticle){
|
||||
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityStanding(Entity entity) {
|
||||
@Override
|
||||
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit)
|
||||
{
|
||||
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
|
||||
}
|
||||
|
||||
}
|
||||
private TRPowerNet network;
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) {
|
||||
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
|
||||
}
|
||||
public final void findAndJoinNetwork(World world, BlockPos pos)
|
||||
{
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.getCableType() == getCableType())
|
||||
{
|
||||
TRPowerNet net = cableMultipart.getNetwork();
|
||||
if (net != null)
|
||||
{
|
||||
network = net;
|
||||
network.addElement(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (network == null)
|
||||
{
|
||||
network = new TRPowerNet(getCableType());
|
||||
network.addElement(this);
|
||||
}
|
||||
network.endpoints.clear();
|
||||
for (EnumFacing dir : EnumFacing.VALUES)
|
||||
{
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (te != null && te instanceof IEnergyInterfaceTile)
|
||||
{
|
||||
network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TRPowerNet network;
|
||||
public final TRPowerNet getNetwork()
|
||||
{
|
||||
return network;
|
||||
}
|
||||
|
||||
public final void findAndJoinNetwork(World world, BlockPos pos) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
|
||||
TRPowerNet net = cableMultipart.getNetwork();
|
||||
if (net != null) {
|
||||
network = net;
|
||||
network.addElement(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(network == null){
|
||||
network = new TRPowerNet(getCableType());
|
||||
network.addElement(this);
|
||||
}
|
||||
network.endpoints.clear();
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (te != null && te instanceof IEnergyInterfaceTile) {
|
||||
network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
public final void setNetwork(TRPowerNet n)
|
||||
{
|
||||
if (n == null)
|
||||
{
|
||||
} else
|
||||
{
|
||||
network = n;
|
||||
network.addElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final TRPowerNet getNetwork() {
|
||||
return network;
|
||||
}
|
||||
public final void removeFromNetwork()
|
||||
{
|
||||
if (network == null)
|
||||
{
|
||||
} else
|
||||
network.removeElement(this);
|
||||
}
|
||||
|
||||
public final void setNetwork(TRPowerNet n) {
|
||||
if (n == null) {
|
||||
} else {
|
||||
network = n;
|
||||
network.addElement(this);
|
||||
}
|
||||
}
|
||||
public final void rebuildNetwork()
|
||||
{
|
||||
this.removeFromNetwork();
|
||||
this.resetNetwork();
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
|
||||
public final void removeFromNetwork() {
|
||||
if (network == null) {
|
||||
} else
|
||||
network.removeElement(this);
|
||||
}
|
||||
public final void resetNetwork()
|
||||
{
|
||||
if (network != null)
|
||||
{
|
||||
network.removeElement(this);
|
||||
}
|
||||
|
||||
public final void rebuildNetwork() {
|
||||
this.removeFromNetwork();
|
||||
this.resetNetwork();
|
||||
this.findAndJoinNetwork(getWorld(), getPos());
|
||||
}
|
||||
network = null;
|
||||
}
|
||||
|
||||
public final void resetNetwork() {
|
||||
if(network != null){
|
||||
network.removeElement(this);
|
||||
}
|
||||
// @Override
|
||||
// public void addInfo(List<String> info) {
|
||||
// info.add(EnumChatFormatting.GREEN + "EU Transfer: " +
|
||||
// EnumChatFormatting.LIGHT_PURPLE + getCableType().transferRate);
|
||||
// if (getCableType().canKill) {
|
||||
// info.add(EnumChatFormatting.RED + "Damages entity's!");
|
||||
// }
|
||||
// }
|
||||
|
||||
network = null;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getModelPath()
|
||||
{
|
||||
return new ResourceLocation("techreborn:cable");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void addInfo(List<String> info) {
|
||||
// info.add(EnumChatFormatting.GREEN + "EU Transfer: " + EnumChatFormatting.LIGHT_PURPLE + getCableType().transferRate);
|
||||
// if (getCableType().canKill) {
|
||||
// info.add(EnumChatFormatting.RED + "Damages entity's!");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelPath() {
|
||||
return new ResourceLocation("techreborn:cable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockRenderLayer layer)
|
||||
{
|
||||
return layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,36 +11,48 @@ import techreborn.parts.types.InsulatedGoldCable;
|
|||
import techreborn.parts.types.InsulatedHVCable;
|
||||
import techreborn.parts.types.TinCable;
|
||||
|
||||
public enum EnumCableType implements IStringSerializable {
|
||||
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW, CopperCable.class),
|
||||
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM, TinCable.class),
|
||||
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM, GoldCable.class),
|
||||
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH, HVCable.class),
|
||||
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH, GlassFiberCable.class),
|
||||
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW, InsulatedCopperCable.class),
|
||||
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.MEDIUM, InsulatedGoldCable.class),
|
||||
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH, InsulatedHVCable.class);
|
||||
public enum EnumCableType implements IStringSerializable
|
||||
{
|
||||
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW,
|
||||
CopperCable.class), TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM,
|
||||
TinCable.class), GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true,
|
||||
EnumPowerTier.MEDIUM, GoldCable.class), HV("hv", "techreborn:blocks/cables/hv_cable", 2048,
|
||||
12.0, true, EnumPowerTier.HIGH, HVCable.class), GLASSFIBER("glassfiber",
|
||||
"techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false,
|
||||
EnumPowerTier.HIGH, GlassFiberCable.class), ICOPPER("insulatedcopper",
|
||||
"techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false,
|
||||
EnumPowerTier.LOW,
|
||||
InsulatedCopperCable.class), IGOLD("insulatedgold",
|
||||
"techreborn:blocks/cables/gold_insulated_cable", 512, 10.0,
|
||||
false, EnumPowerTier.MEDIUM,
|
||||
InsulatedGoldCable.class), IHV("insulatedhv",
|
||||
"techreborn:blocks/cables/hv_insulated_cable", 2048,
|
||||
10.0, false, EnumPowerTier.HIGH,
|
||||
InsulatedHVCable.class);
|
||||
|
||||
private String friendlyName;
|
||||
public String textureName = "minecraft:blocks/iron_block";
|
||||
public int transferRate = 128;
|
||||
public double cableThickness = 3.0;
|
||||
public boolean canKill = false;
|
||||
public Class<? extends CableMultipart> cableClass;
|
||||
public EnumPowerTier tier;
|
||||
private String friendlyName;
|
||||
public String textureName = "minecraft:blocks/iron_block";
|
||||
public int transferRate = 128;
|
||||
public double cableThickness = 3.0;
|
||||
public boolean canKill = false;
|
||||
public Class<? extends CableMultipart> cableClass;
|
||||
public EnumPowerTier tier;
|
||||
|
||||
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill, EnumPowerTier tier, Class<? extends CableMultipart> cableClass) {
|
||||
this.friendlyName = friendlyName;
|
||||
this.textureName = textureName;
|
||||
this.transferRate = transferRate;
|
||||
this.cableThickness = cableThickness / 2;
|
||||
this.canKill = canKill;
|
||||
this.cableClass = cableClass;
|
||||
this.tier = tier;
|
||||
}
|
||||
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill,
|
||||
EnumPowerTier tier, Class<? extends CableMultipart> cableClass)
|
||||
{
|
||||
this.friendlyName = friendlyName;
|
||||
this.textureName = textureName;
|
||||
this.transferRate = transferRate;
|
||||
this.cableThickness = cableThickness / 2;
|
||||
this.canKill = canKill;
|
||||
this.cableClass = cableClass;
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return friendlyName.toLowerCase();
|
||||
}
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return friendlyName.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,9 @@ package techreborn.parts;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public interface ICableType {
|
||||
public interface ICableType
|
||||
{
|
||||
|
||||
EnumCableType getCableType();
|
||||
EnumCableType getCableType();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.parts;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcmultipart.item.ItemMultiPart;
|
||||
import mcmultipart.multipart.IMultipart;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
|
@ -19,74 +21,86 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 27/02/2016.
|
||||
*/
|
||||
public class ItemCables extends ItemMultiPart implements ITexturedItem {
|
||||
public class ItemCables extends ItemMultiPart implements ITexturedItem
|
||||
{
|
||||
|
||||
public ItemCables() {
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.cable");
|
||||
setNoRepair();
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
ItemStandaloneCables.mcPartCable = this;
|
||||
}
|
||||
public ItemCables()
|
||||
{
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.cable");
|
||||
setNoRepair();
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
ItemStandaloneCables.mcPartCable = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack, EntityPlayer player) {
|
||||
try {
|
||||
return TechRebornParts.multipartHashMap.get(EnumCableType.values()[stack.getItemDamage()]).newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack,
|
||||
EntityPlayer player)
|
||||
{
|
||||
try
|
||||
{
|
||||
return TechRebornParts.multipartHashMap.get(EnumCableType.values()[stack.getItemDamage()]).newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= EnumCableType.values().length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= EnumCableType.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < EnumCableType.values().length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < EnumCableType.values().length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage].getName();
|
||||
}
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
return EnumCableType.values().length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return EnumCableType.values().length;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
|
||||
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
|
||||
if (type.canKill) {
|
||||
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
||||
}
|
||||
tooltip.add(TextFormatting.GREEN + "Tier: " + TextFormatting.LIGHT_PURPLE + type.tier);
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
|
||||
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
|
||||
if (type.canKill)
|
||||
{
|
||||
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
||||
}
|
||||
tooltip.add(TextFormatting.GREEN + "Tier: " + TextFormatting.LIGHT_PURPLE + type.tier);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package techreborn.parts;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -10,76 +13,90 @@ import techreborn.client.TechRebornCreativeTab;
|
|||
import techreborn.items.ItemTextureBase;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 06/03/2016.
|
||||
*/
|
||||
public class ItemStandaloneCables extends ItemTextureBase {
|
||||
public class ItemStandaloneCables extends ItemTextureBase
|
||||
{
|
||||
|
||||
public static Item mcPartCable;
|
||||
public static Item mcPartCable;
|
||||
|
||||
public static ItemStack getCableByName(String name, int count) {
|
||||
for (int i = 0; i < EnumCableType.values().length; i++) {
|
||||
if (EnumCableType.values()[i].getName().equalsIgnoreCase(name)) {
|
||||
return new ItemStack(mcPartCable != null ? mcPartCable : StandalonePartCompact.itemStandaloneCable, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The cable " + name + " could not be found.");
|
||||
}
|
||||
public static ItemStack getCableByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < EnumCableType.values().length; i++)
|
||||
{
|
||||
if (EnumCableType.values()[i].getName().equalsIgnoreCase(name))
|
||||
{
|
||||
return new ItemStack(mcPartCable != null ? mcPartCable : StandalonePartCompact.itemStandaloneCable,
|
||||
count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The cable " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getCableByName(String name) {
|
||||
return getCableByName(name, 1);
|
||||
}
|
||||
public static ItemStack getCableByName(String name)
|
||||
{
|
||||
return getCableByName(name, 1);
|
||||
}
|
||||
|
||||
public ItemStandaloneCables() {
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.cable");
|
||||
setNoRepair();
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
public ItemStandaloneCables()
|
||||
{
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.cable");
|
||||
setNoRepair();
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= EnumCableType.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= EnumCableType.values().length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < EnumCableType.values().length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < EnumCableType.values().length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage].getName();
|
||||
}
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return EnumCableType.values().length;
|
||||
}
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
return EnumCableType.values().length;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
// return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
// }
|
||||
// @Override
|
||||
// public ModelResourceLocation getModel(ItemStack stack, EntityPlayer
|
||||
// player, int useRemaining) {
|
||||
// return new ModelResourceLocation(ModInfo.MOD_ID + ":" +
|
||||
// getUnlocalizedName(stack).substring(5), "inventory");
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
|
||||
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
|
||||
if (type.canKill) {
|
||||
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
|
||||
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
|
||||
if (type.canKill)
|
||||
{
|
||||
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,28 +10,33 @@ import techreborn.compat.ICompatModule;
|
|||
/**
|
||||
* Created by modmuss50 on 06/03/2016.
|
||||
*/
|
||||
public class StandalonePartCompact implements ICompatModule {
|
||||
public class StandalonePartCompact implements ICompatModule
|
||||
{
|
||||
|
||||
public static ItemStandaloneCables itemStandaloneCable;
|
||||
public static ItemStandaloneCables itemStandaloneCable;
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
itemStandaloneCable = new ItemStandaloneCables();
|
||||
GameRegistry.registerItem(itemStandaloneCable, "cables");
|
||||
}
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
itemStandaloneCable = new ItemStandaloneCables();
|
||||
GameRegistry.registerItem(itemStandaloneCable, "cables");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package techreborn.parts;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import mcmultipart.multipart.MultipartRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
|
@ -9,42 +13,44 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
|||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import techreborn.compat.ICompatModule;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 02/03/2016.
|
||||
*/
|
||||
public class TechRebornParts implements ICompatModule {
|
||||
public class TechRebornParts implements ICompatModule
|
||||
{
|
||||
|
||||
@Nullable
|
||||
public static Item cables;
|
||||
@Nullable
|
||||
public static Item cables;
|
||||
|
||||
public static HashMap<EnumCableType, Class<? extends CableMultipart>> multipartHashMap = new HashMap<>();
|
||||
public static HashMap<EnumCableType, Class<? extends CableMultipart>> multipartHashMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
for (EnumCableType cableType : EnumCableType.values()) {
|
||||
multipartHashMap.put(cableType, cableType.cableClass);
|
||||
MultipartRegistry.registerPart(cableType.cableClass, "techreborn:cable." + cableType.name());
|
||||
}
|
||||
cables = new ItemCables();
|
||||
GameRegistry.registerItem(cables, "cables");
|
||||
}
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
for (EnumCableType cableType : EnumCableType.values())
|
||||
{
|
||||
multipartHashMap.put(cableType, cableType.cableClass);
|
||||
MultipartRegistry.registerPart(cableType.cableClass, "techreborn:cable." + cableType.name());
|
||||
}
|
||||
cables = new ItemCables();
|
||||
GameRegistry.registerItem(cables, "cables");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class CopperCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.COPPER;
|
||||
}
|
||||
public class CopperCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.COPPER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class GlassFiberCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.GLASSFIBER;
|
||||
}
|
||||
public class GlassFiberCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.GLASSFIBER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class GoldCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.GOLD;
|
||||
}
|
||||
public class GoldCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.GOLD;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class HVCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.HV;
|
||||
}
|
||||
public class HVCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.HV;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class InsulatedCopperCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.ICOPPER;
|
||||
}
|
||||
public class InsulatedCopperCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.ICOPPER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class InsulatedGoldCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.IGOLD;
|
||||
}
|
||||
public class InsulatedGoldCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.IGOLD;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class InsulatedHVCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.IHV;
|
||||
}
|
||||
public class InsulatedHVCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.IHV;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import techreborn.parts.EnumCableType;
|
|||
/**
|
||||
* Created by modmuss50 on 05/03/2016.
|
||||
*/
|
||||
public class TinCable extends CableMultipart {
|
||||
@Override
|
||||
public EnumCableType getCableType() {
|
||||
return EnumCableType.COPPER;
|
||||
}
|
||||
public class TinCable extends CableMultipart
|
||||
{
|
||||
@Override
|
||||
public EnumCableType getCableType()
|
||||
{
|
||||
return EnumCableType.COPPER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 07/03/2016.
|
||||
*/
|
||||
public interface IPartWaliaProvider {
|
||||
public interface IPartWaliaProvider
|
||||
{
|
||||
|
||||
void addInfo(List<String> info);
|
||||
void addInfo(List<String> info);
|
||||
}
|
||||
|
|
|
@ -12,29 +12,34 @@ import techreborn.compat.ICompatModule;
|
|||
/**
|
||||
* Created by modmuss50 on 07/03/2016.
|
||||
*/
|
||||
public class WailaMcMultiPartCompact implements ICompatModule {
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
public class WailaMcMultiPartCompact implements ICompatModule
|
||||
{
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
FMLInterModComms.sendMessage("Waila", "register", getClass().getName()
|
||||
+ ".callbackRegister");
|
||||
}
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
@Override
|
||||
public void serverStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void callbackRegister(IWailaRegistrar registrar) {
|
||||
registrar.registerBodyProvider(new WaliaPartProvider(), TileMultipartContainer.class);
|
||||
}
|
||||
public static void callbackRegister(IWailaRegistrar registrar)
|
||||
{
|
||||
registrar.registerBodyProvider(new WaliaPartProvider(), TileMultipartContainer.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,56 +23,75 @@ import techreborn.parts.CableMultipart;
|
|||
/**
|
||||
* Created by modmuss50 on 07/03/2016.
|
||||
*/
|
||||
public class WaliaPartProvider implements IWailaDataProvider {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
|
||||
if (mop != null) {
|
||||
if (mop.partHit instanceof CableMultipart) {
|
||||
return mop.partHit.getDrops().get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public class WaliaPartProvider implements IWailaDataProvider
|
||||
{
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
|
||||
if (mop != null)
|
||||
{
|
||||
if (mop.partHit instanceof CableMultipart)
|
||||
{
|
||||
return mop.partHit.getDrops().get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
|
||||
List<String> data = new ArrayList<>();
|
||||
if (mop != null) {
|
||||
if (mop.partHit instanceof IPartWaliaProvider) {
|
||||
((IPartWaliaProvider) mop.partHit).addInfo(data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
PartMOP mop = reTrace(accessor.getWorld(), accessor.getPosition(), accessor.getPlayer());
|
||||
List<String> data = new ArrayList<>();
|
||||
if (mop != null)
|
||||
{
|
||||
if (mop.partHit instanceof IPartWaliaProvider)
|
||||
{
|
||||
((IPartWaliaProvider) mop.partHit).addInfo(data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world,
|
||||
BlockPos pos)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//Stolen from https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
|
||||
private PartMOP reTrace(World world, BlockPos pos, EntityPlayer player) {
|
||||
Vec3d start = RayTraceUtils.getStart(player);
|
||||
Vec3d end = RayTraceUtils.getEnd(player);
|
||||
RayTraceUtils.AdvancedRayTraceResultPart result = getMultipartTile(world, pos).getPartContainer().collisionRayTrace(start, end);
|
||||
return result == null ? null : result.hit;
|
||||
}
|
||||
// Stolen from
|
||||
// https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
|
||||
private PartMOP reTrace(World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
Vec3d start = RayTraceUtils.getStart(player);
|
||||
Vec3d end = RayTraceUtils.getEnd(player);
|
||||
RayTraceUtils.AdvancedRayTraceResultPart result = getMultipartTile(world, pos).getPartContainer()
|
||||
.collisionRayTrace(start, end);
|
||||
return result == null ? null : result.hit;
|
||||
}
|
||||
|
||||
//Stolen from https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
|
||||
private TileMultipartContainer getMultipartTile(IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
return tile instanceof TileMultipartContainer ? (TileMultipartContainer) tile : null;
|
||||
}
|
||||
// Stolen from
|
||||
// https://github.com/amadornes/MCMultiPart/blob/master/src/main/java/mcmultipart/block/BlockMultipart.java
|
||||
private TileMultipartContainer getMultipartTile(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
return tile instanceof TileMultipartContainer ? (TileMultipartContainer) tile : null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue