Fix Merge

This commit is contained in:
Stuart Pomeroy 2016-03-28 09:38:59 +01:00
commit 123612acb9
17 changed files with 112 additions and 180 deletions

View file

@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
/** /**
@ -29,6 +30,7 @@ public class ItemTRArmour extends ItemArmor implements ITexturedItem {
setUnlocalizedName(material.name().toLowerCase()+"Leggings"); setUnlocalizedName(material.name().toLowerCase()+"Leggings");
if (slot == EntityEquipmentSlot.FEET) if (slot == EntityEquipmentSlot.FEET)
setUnlocalizedName(material.name().toLowerCase()+"Boots"); setUnlocalizedName(material.name().toLowerCase()+"Boots");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.material = material; this.material = material;
this.slot = slot; this.slot = slot;

View file

@ -16,6 +16,7 @@ import net.minecraft.item.ItemTool;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class ItemTRAxe extends ItemTool implements ITexturedItem { public class ItemTRAxe extends ItemTool implements ITexturedItem {
@ -30,6 +31,7 @@ public class ItemTRAxe extends ItemTool implements ITexturedItem {
this.damageVsEntity = material.getDamageVsEntity() + 5.75F; this.damageVsEntity = material.getDamageVsEntity() + 5.75F;
this.attackSpeed = (material.getDamageVsEntity() + 6.75F) * -0.344444F; this.attackSpeed = (material.getDamageVsEntity() + 6.75F) * -0.344444F;
setUnlocalizedName(material.name().toLowerCase() + "Axe"); setUnlocalizedName(material.name().toLowerCase() + "Axe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.material = material; this.material = material;
} }

View file

@ -5,10 +5,10 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class ItemTRHoe extends ItemHoe implements ITexturedItem public class ItemTRHoe extends ItemHoe implements ITexturedItem
@ -18,6 +18,7 @@ public class ItemTRHoe extends ItemHoe implements ITexturedItem
public ItemTRHoe(ToolMaterial material) { public ItemTRHoe(ToolMaterial material) {
super(material); super(material);
setUnlocalizedName(material.name().toLowerCase()+"Hoe"); setUnlocalizedName(material.name().toLowerCase()+"Hoe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.material=material; this.material=material;
} }

View file

@ -5,10 +5,10 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem
@ -18,6 +18,7 @@ public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem
public ItemTRPickaxe(ToolMaterial material) { public ItemTRPickaxe(ToolMaterial material) {
super(material); super(material);
setUnlocalizedName(material.name().toLowerCase()+"Pickaxe"); setUnlocalizedName(material.name().toLowerCase()+"Pickaxe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.material=material; this.material=material;
} }

View file

@ -5,10 +5,10 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class ItemTRSpade extends ItemSpade implements ITexturedItem public class ItemTRSpade extends ItemSpade implements ITexturedItem
@ -18,6 +18,7 @@ public class ItemTRSpade extends ItemSpade implements ITexturedItem
public ItemTRSpade(ToolMaterial material) { public ItemTRSpade(ToolMaterial material) {
super(material); super(material);
setUnlocalizedName(material.name().toLowerCase()+"Spade"); setUnlocalizedName(material.name().toLowerCase()+"Spade");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.material=material; this.material=material;
} }

View file

@ -5,10 +5,10 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.RebornCore; import reborncore.RebornCore;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class ItemTRSword extends ItemSword implements ITexturedItem public class ItemTRSword extends ItemSword implements ITexturedItem
@ -18,6 +18,7 @@ public class ItemTRSword extends ItemSword implements ITexturedItem
public ItemTRSword(ToolMaterial material) { public ItemTRSword(ToolMaterial material) {
super(material); super(material);
setUnlocalizedName(material.name().toLowerCase()+"Sword"); setUnlocalizedName(material.name().toLowerCase()+"Sword");
setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this); RebornCore.jsonDestroyer.registerObject(this);
this.material=material; this.material=material;
} }

View file

@ -53,8 +53,7 @@ import techreborn.utils.damageSources.ElectrialShockSource;
* Created by modmuss50 on 02/03/2016. * Created by modmuss50 on 02/03/2016.
*/ */
public abstract class CableMultipart extends Multipart public abstract class CableMultipart extends Multipart
implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType {
{
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up")); 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> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
@ -72,51 +71,42 @@ public abstract class CableMultipart extends Multipart
public TRPowerNet mergeWith = null; public TRPowerNet mergeWith = null;
private TRPowerNet network; private TRPowerNet network;
public CableMultipart() public CableMultipart() {
{
connectedSides = new HashMap<>(); connectedSides = new HashMap<>();
refreshBounding(); refreshBounding();
} }
public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side) public static CableMultipart getPartFromWorld(World world, BlockPos pos, EnumFacing side) {
{ if (world == null || pos == null) {
if (world == null || pos == null)
{
return null; return null;
} }
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos); IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
if (side != null && container != null) if (side != null && container != null) {
{
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side)); ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
if (slottedPart instanceof IMicroblock.IFaceMicroblock if (slottedPart instanceof IMicroblock.IFaceMicroblock
&& !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow()) && !((IMicroblock.IFaceMicroblock) slottedPart).isFaceHollow()) {
{
return null; return null;
} }
} }
if (container == null) if (container == null) {
{
return null; return null;
} }
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER); ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
if (part instanceof CableMultipart) if (part instanceof CableMultipart) {
{
return (CableMultipart) part; return (CableMultipart) part;
} }
return null; return null;
} }
public void refreshBounding() public void refreshBounding() {
{
float centerFirst = center - offset; float centerFirst = center - offset;
double w = (getCableType().cableThickness / 16) - 0.5; double w = (getCableType().cableThickness / 16) - 0.5;
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w, boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w,
centerFirst + w, centerFirst + w); centerFirst + w, centerFirst + w);
int i = 0; int i = 0;
for (EnumFacing dir : EnumFacing.VALUES) for (EnumFacing dir : EnumFacing.VALUES) {
{
double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0 double xMin1 = (dir.getFrontOffsetX() < 0 ? 0.0
: (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w)); : (dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0 double xMax1 = (dir.getFrontOffsetX() > 0 ? 1.0
@ -138,28 +128,23 @@ public abstract class CableMultipart extends Multipart
} }
@Override @Override
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
{
for (EnumFacing dir : EnumFacing.VALUES) for (EnumFacing dir : EnumFacing.VALUES) {
{
if (connectedSides.containsKey(dir) if (connectedSides.containsKey(dir)
&& mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) && mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()); list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
} }
if (mask.intersectsWith(boundingBoxes[6].toAABB())) if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
{
list.add(boundingBoxes[6].toAABB()); list.add(boundingBoxes[6].toAABB());
} }
super.addCollisionBoxes(mask, list, collidingEntity); super.addCollisionBoxes(mask, list, collidingEntity);
} }
@Override @Override
public void addSelectionBoxes(List<AxisAlignedBB> list) public void addSelectionBoxes(List<AxisAlignedBB> list) {
{
for (EnumFacing dir : EnumFacing.VALUES) for (EnumFacing dir : EnumFacing.VALUES) {
{
if (connectedSides.containsKey(dir)) if (connectedSides.containsKey(dir))
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()); list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
} }
@ -168,32 +153,26 @@ public abstract class CableMultipart extends Multipart
} }
@Override @Override
public void onRemoved() public void onRemoved() {
{
super.onRemoved(); super.onRemoved();
removeFromNetwork(); removeFromNetwork();
for (EnumFacing dir : EnumFacing.VALUES) for (EnumFacing dir : EnumFacing.VALUES) {
{
CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir); CableMultipart multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
if (multipart != null) if (multipart != null) {
{
multipart.nearByChange(); multipart.nearByChange();
} }
} }
} }
@Override @Override
public void onUnloaded() public void onUnloaded() {
{
super.onUnloaded(); super.onUnloaded();
removeFromNetwork(); removeFromNetwork();
} }
@Override @Override
public void addOcclusionBoxes(List<AxisAlignedBB> list) public void addOcclusionBoxes(List<AxisAlignedBB> list) {
{ for (EnumFacing dir : EnumFacing.VALUES) {
for (EnumFacing dir : EnumFacing.VALUES)
{
if (connectedSides.containsKey(dir)) if (connectedSides.containsKey(dir))
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()); list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
} }
@ -201,27 +180,22 @@ public abstract class CableMultipart extends Multipart
} }
@Override @Override
public void onNeighborBlockChange(Block block) public void onNeighborBlockChange(Block block) {
{
super.onNeighborBlockChange(block); super.onNeighborBlockChange(block);
nearByChange(); nearByChange();
} }
public void nearByChange() public void nearByChange() {
{ if (network == null) {
if (network == null)
{
findAndJoinNetwork(getWorld(), getPos()); findAndJoinNetwork(getWorld(), getPos());
} }
checkConnectedSides(); checkConnectedSides();
for (EnumFacing direction : EnumFacing.VALUES) for (EnumFacing direction : EnumFacing.VALUES) {
{
BlockPos blockPos = getPos().offset(direction); BlockPos blockPos = getPos().offset(direction);
WorldUtils.updateBlock(getWorld(), blockPos); WorldUtils.updateBlock(getWorld(), blockPos);
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction); CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
if (part != null) if (part != null) {
{
part.checkConnectedSides(); part.checkConnectedSides();
} }
} }
@ -229,28 +203,21 @@ public abstract class CableMultipart extends Multipart
} }
@Override @Override
public void onAdded() public void onAdded() {
{
nearByChange(); nearByChange();
} }
public boolean shouldConnectTo(EnumFacing dir) public boolean shouldConnectTo(EnumFacing dir) {
{ if (dir != null) {
if (dir != null) if (internalShouldConnectTo(dir)) {
{
if (internalShouldConnectTo(dir))
{
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir); CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite())) if (cableMultipart != null && cableMultipart.internalShouldConnectTo(dir.getOpposite())) {
{
return true; return true;
} }
} else } else {
{
TileEntity tile = getNeighbourTile(dir); TileEntity tile = getNeighbourTile(dir);
if (tile instanceof IEnergyInterfaceTile) if (tile instanceof IEnergyInterfaceTile) {
{
return true; return true;
} }
} }
@ -258,13 +225,10 @@ public abstract class CableMultipart extends Multipart
return false; return false;
} }
public boolean internalShouldConnectTo(EnumFacing dir) public boolean internalShouldConnectTo(EnumFacing dir) {
{
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir)); ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
if (part instanceof IMicroblock.IFaceMicroblock) if (part instanceof IMicroblock.IFaceMicroblock) {
{ if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow()) {
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow())
{
return false; return false;
} }
} }
@ -277,60 +241,47 @@ public abstract class CableMultipart extends Multipart
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite()); CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
{
return true; return true;
} }
return false; return false;
} }
public TileEntity getNeighbourTile(EnumFacing side) public TileEntity getNeighbourTile(EnumFacing side) {
{
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null; return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
} }
public void checkConnectedSides() public void checkConnectedSides() {
{
refreshBounding(); refreshBounding();
connectedSides = new HashMap<>(); connectedSides = new HashMap<>();
for (EnumFacing dir : EnumFacing.values()) for (EnumFacing dir : EnumFacing.values()) {
{
int d = Functions.getIntDirFromDirection(dir); int d = Functions.getIntDirFromDirection(dir);
if (getWorld() == null) if (getWorld() == null) {
{
return; return;
} }
TileEntity te = getNeighbourTile(dir); TileEntity te = getNeighbourTile(dir);
if (shouldConnectTo(dir)) if (shouldConnectTo(dir)) {
{
connectedSides.put(dir, te.getPos()); connectedSides.put(dir, te.getPos());
} }
} }
} }
@Override @Override
public EnumSet<PartSlot> getSlotMask() public EnumSet<PartSlot> getSlotMask() {
{
return EnumSet.of(PartSlot.CENTER); return EnumSet.of(PartSlot.CENTER);
} }
@Override @Override
public void update() public void update() {
{ if (getWorld() != null) {
if (getWorld() != null) if (getWorld().getTotalWorldTime() % 80 == 0) {
{
if (getWorld().getTotalWorldTime() % 80 == 0)
{
checkConnectedSides(); checkConnectedSides();
} }
} }
if (network == null) if (network == null) {
{
this.findAndJoinNetwork(getWorld(), getPos()); this.findAndJoinNetwork(getWorld(), getPos());
} else } else {
{ if (mergeWith != null) {
if (mergeWith != null)
{
getNetwork().merge(network); getNetwork().merge(network);
mergeWith = null; mergeWith = null;
} }
@ -338,8 +289,7 @@ public abstract class CableMultipart extends Multipart
} }
@Override @Override
public IBlockState getExtendedState(IBlockState state) public IBlockState getExtendedState(IBlockState state) {
{
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state; IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN)) return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
.withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH)) .withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
@ -354,143 +304,119 @@ public abstract class CableMultipart extends Multipart
// } // }
@Override @Override
public BlockStateContainer createBlockState() public BlockStateContainer createBlockState() {
{
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { TYPE }, return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { TYPE },
new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST }); new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST });
} }
@Override @Override
public float getHardness(PartMOP hit) public float getHardness(PartMOP hit) {
{
return 0.5F; return 0.5F;
} }
public Material getMaterial() public Material getMaterial() {
{
return Material.cloth; return Material.cloth;
} }
@Override @Override
public List<ItemStack> getDrops() public List<ItemStack> getDrops() {
{
List<ItemStack> list = new ArrayList<>(); List<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal())); list.add(new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()));
return list; return list;
} }
@Override @Override
public void onEntityCollided(Entity entity) public void onEntityCollided(Entity entity) {
{ if (getCableType().canKill && entity instanceof EntityLivingBase) {
if (getCableType().canKill && entity instanceof EntityLivingBase) if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) {
{
if (network != null) } else {
{ if (network != null) {
if (network.getEnergy() != 0) if (network.getEnergy() != 0) {
{ if (ConfigTechReborn.UninsulatedElectocutionDamage) {
if (ConfigTechReborn.UninsulatedElectocutionDamage) if (getCableType() == EnumCableType.HV) {
{
if (getCableType() == EnumCableType.HV)
{
entity.setFire(1); entity.setFire(1);
} }
network.setEnergy(-1); network.setEnergy(-1);
entity.attackEntityFrom(new ElectrialShockSource(), 1F); entity.attackEntityFrom(new ElectrialShockSource(), 1F);
} }
if (ConfigTechReborn.UninsulatedElectocutionSound) if (ConfigTechReborn.UninsulatedElectocutionSound) {
{ // getWorld().playSound(entity.posX, entity.posY,
// getWorld().playSound(entity.posX, entity.posY, entity.posZ, ModSounds.shock, // entity.posZ, ModSounds.shock,
// SoundCategory.BLOCKS, 0.6F, 1F, false); // SoundCategory.BLOCKS, 0.6F, 1F, false);
} }
if (ConfigTechReborn.UninsulatedElectocutionParticle) if (ConfigTechReborn.UninsulatedElectocutionParticle) {
{ getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0,
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0, 0, 0, 0);
0);
} }
} }
} }
} }
} }
@Override
public void onEntityStanding(Entity entity)
{
} }
@Override @Override
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) public void onEntityStanding(Entity entity) {
{
}
@Override
public ItemStack getPickBlock(EntityPlayer player, PartMOP hit) {
return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal()); return new ItemStack(TechRebornParts.cables, 1, getCableType().ordinal());
} }
public final void findAndJoinNetwork(World world, BlockPos pos) public final void findAndJoinNetwork(World world, BlockPos pos) {
{ for (EnumFacing dir : EnumFacing.VALUES) {
for (EnumFacing dir : EnumFacing.VALUES)
{
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir); CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) if (cableMultipart != null && cableMultipart.getCableType() == getCableType()) {
{
TRPowerNet net = cableMultipart.getNetwork(); TRPowerNet net = cableMultipart.getNetwork();
if (net != null) if (net != null) {
{
network = net; network = net;
network.addElement(this); network.addElement(this);
break; break;
} }
} }
} }
if (network == null) if (network == null) {
{
network = new TRPowerNet(getCableType()); network = new TRPowerNet(getCableType());
network.addElement(this); network.addElement(this);
} }
network.endpoints.clear(); network.endpoints.clear();
for (EnumFacing dir : EnumFacing.VALUES) for (EnumFacing dir : EnumFacing.VALUES) {
{
TileEntity te = getNeighbourTile(dir); TileEntity te = getNeighbourTile(dir);
if (te != null && te instanceof IEnergyInterfaceTile) if (te != null && te instanceof IEnergyInterfaceTile) {
{
network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite()); network.addConnection((IEnergyInterfaceTile) te, dir.getOpposite());
} }
} }
} }
public final TRPowerNet getNetwork() public final TRPowerNet getNetwork() {
{
return network; return network;
} }
public final void setNetwork(TRPowerNet n) public final void setNetwork(TRPowerNet n) {
{ if (n == null) {
if (n == null) } else {
{
} else
{
network = n; network = n;
network.addElement(this); network.addElement(this);
} }
} }
public final void removeFromNetwork() public final void removeFromNetwork() {
{ if (network == null) {
if (network == null)
{
} else } else
network.removeElement(this); network.removeElement(this);
} }
public final void rebuildNetwork() public final void rebuildNetwork() {
{
this.removeFromNetwork(); this.removeFromNetwork();
this.resetNetwork(); this.resetNetwork();
this.findAndJoinNetwork(getWorld(), getPos()); this.findAndJoinNetwork(getWorld(), getPos());
} }
public final void resetNetwork() public final void resetNetwork() {
{ if (network != null) {
if (network != null)
{
network.removeElement(this); network.removeElement(this);
} }
@ -507,14 +433,12 @@ public abstract class CableMultipart extends Multipart
// } // }
@Override @Override
public ResourceLocation getModelPath() public ResourceLocation getModelPath() {
{
return new ResourceLocation("techreborn:cable"); return new ResourceLocation("techreborn:cable");
} }
@Override @Override
public boolean canRenderInLayer(BlockRenderLayer layer) public boolean canRenderInLayer(BlockRenderLayer layer) {
{
return layer == BlockRenderLayer.CUTOUT; return layer == BlockRenderLayer.CUTOUT;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 635 B