A few bug fixes
This commit is contained in:
parent
b89349894e
commit
7d69639a8a
6 changed files with 65 additions and 52 deletions
|
@ -1,6 +1,7 @@
|
||||||
package mekanism.common;
|
package mekanism.common;
|
||||||
|
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
import mekanism.common.multipart.TransmitterType;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,4 +87,26 @@ public final class Tier
|
||||||
guiLocation = gui;
|
guiLocation = gui;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tiers used by Universal Cables and their corresponding values.
|
||||||
|
* @author aidancbrady
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static enum CableTier
|
||||||
|
{
|
||||||
|
BASIC(500, TransmitterType.UNIVERSAL_CABLE_BASIC),
|
||||||
|
ADVANCED(2000, TransmitterType.UNIVERSAL_CABLE_ADVANCED),
|
||||||
|
ELITE(8000, TransmitterType.UNIVERSAL_CABLE_ELITE),
|
||||||
|
ULTIMATE(32000, TransmitterType.UNIVERSAL_CABLE_ULTIMATE);
|
||||||
|
|
||||||
|
public int cableCapacity;
|
||||||
|
public TransmitterType type;
|
||||||
|
|
||||||
|
private CableTier(int capacity, TransmitterType transmitterType)
|
||||||
|
{
|
||||||
|
cableCapacity = capacity;
|
||||||
|
type = transmitterType;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,20 +9,24 @@ import mekanism.common.Mekanism;
|
||||||
import mekanism.common.block.BlockCardboardBox.BlockData;
|
import mekanism.common.block.BlockCardboardBox.BlockData;
|
||||||
import mekanism.common.tile.TileEntityCardboardBox;
|
import mekanism.common.tile.TileEntityCardboardBox;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class ItemBlockCardboardBox extends ItemBlock
|
public class ItemBlockCardboardBox extends ItemBlock
|
||||||
{
|
{
|
||||||
|
private static boolean isMonitoring;
|
||||||
|
|
||||||
public Block metaBlock;
|
public Block metaBlock;
|
||||||
|
|
||||||
public ItemBlockCardboardBox(int id, Block block)
|
public ItemBlockCardboardBox(int id, Block block)
|
||||||
|
@ -30,6 +34,8 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||||
super(id);
|
super(id);
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
metaBlock = block;
|
metaBlock = block;
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,6 +82,8 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||||
data.id = id;
|
data.id = id;
|
||||||
data.meta = meta;
|
data.meta = meta;
|
||||||
|
|
||||||
|
isMonitoring = true;
|
||||||
|
|
||||||
if(world.getBlockTileEntity(x, y, z) != null)
|
if(world.getBlockTileEntity(x, y, z) != null)
|
||||||
{
|
{
|
||||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||||
|
@ -83,21 +91,6 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||||
|
|
||||||
tile.writeToNBT(tag);
|
tile.writeToNBT(tag);
|
||||||
data.tileTag = tag;
|
data.tileTag = tag;
|
||||||
|
|
||||||
if(tile instanceof IInventory)
|
|
||||||
{
|
|
||||||
IInventory inv = (IInventory)tile;
|
|
||||||
|
|
||||||
for(int i = 0; i < inv.getSizeInventory(); i++)
|
|
||||||
{
|
|
||||||
inv.setInventorySlotContents(i, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(tile instanceof IDeepStorageUnit)
|
|
||||||
{
|
|
||||||
((IDeepStorageUnit)tile).setStoredItemCount(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player.capabilities.isCreativeMode)
|
if(!player.capabilities.isCreativeMode)
|
||||||
|
@ -107,6 +100,8 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||||
|
|
||||||
world.setBlock(x, y, z, Mekanism.cardboardBoxID, 1, 3);
|
world.setBlock(x, y, z, Mekanism.cardboardBoxID, 1, 3);
|
||||||
|
|
||||||
|
isMonitoring = false;
|
||||||
|
|
||||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getBlockTileEntity(x, y, z);
|
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
if(tileEntity != null)
|
if(tileEntity != null)
|
||||||
|
@ -163,4 +158,13 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||||
|
|
||||||
return BlockData.read(itemstack.stackTagCompound.getCompoundTag("blockData"));
|
return BlockData.read(itemstack.stackTagCompound.getCompoundTag("blockData"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ForgeSubscribe
|
||||||
|
public void onEntitySpawn(EntityJoinWorldEvent event)
|
||||||
|
{
|
||||||
|
if(event.entity instanceof EntityItem && isMonitoring)
|
||||||
|
{
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ import mekanism.api.transmitters.IGridTransmitter;
|
||||||
import mekanism.api.transmitters.ITransmitterNetwork;
|
import mekanism.api.transmitters.ITransmitterNetwork;
|
||||||
import mekanism.api.transmitters.TransmissionType;
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import mekanism.common.multipart.PartUniversalCable.CableTier;
|
import mekanism.common.Tier;
|
||||||
|
import mekanism.common.Tier.CableTier;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -85,9 +86,9 @@ public class ItemPartTransmitter extends JItemMultiPart
|
||||||
{
|
{
|
||||||
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
{
|
{
|
||||||
if(itemstack.getItemDamage() < CableTier.values().length)
|
if(itemstack.getItemDamage() < Tier.CableTier.values().length)
|
||||||
{
|
{
|
||||||
list.add(EnumColor.INDIGO + "Capacity: " + EnumColor.GREY + CableTier.values()[itemstack.getItemDamage()].cableCapacity + "J/t");
|
list.add(EnumColor.INDIGO + "Capacity: " + EnumColor.GREY + Tier.CableTier.values()[itemstack.getItemDamage()].cableCapacity + "J/t");
|
||||||
}
|
}
|
||||||
|
|
||||||
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for details.");
|
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for details.");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package mekanism.common.multipart;
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
import mekanism.common.multipart.PartUniversalCable.CableTier;
|
import mekanism.common.Tier;
|
||||||
|
import mekanism.common.Tier.CableTier;
|
||||||
import codechicken.multipart.MultiPartRegistry;
|
import codechicken.multipart.MultiPartRegistry;
|
||||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||||
import codechicken.multipart.MultipartGenerator;
|
import codechicken.multipart.MultipartGenerator;
|
||||||
|
@ -40,23 +40,23 @@ public class MultipartMekanism implements IPartFactory
|
||||||
{
|
{
|
||||||
if(name.equals("mekanism:universal_cable"))
|
if(name.equals("mekanism:universal_cable"))
|
||||||
{
|
{
|
||||||
return new PartUniversalCable(CableTier.BASIC);
|
return new PartUniversalCable(Tier.CableTier.BASIC);
|
||||||
}
|
}
|
||||||
else if(name.equals("mekanism:universal_cable_basic"))
|
else if(name.equals("mekanism:universal_cable_basic"))
|
||||||
{
|
{
|
||||||
return new PartUniversalCable(CableTier.BASIC);
|
return new PartUniversalCable(Tier.CableTier.BASIC);
|
||||||
}
|
}
|
||||||
else if(name.equals("mekanism:universal_cable_advanced"))
|
else if(name.equals("mekanism:universal_cable_advanced"))
|
||||||
{
|
{
|
||||||
return new PartUniversalCable(CableTier.ADVANCED);
|
return new PartUniversalCable(Tier.CableTier.ADVANCED);
|
||||||
}
|
}
|
||||||
else if(name.equals("mekanism:universal_cable_elite"))
|
else if(name.equals("mekanism:universal_cable_elite"))
|
||||||
{
|
{
|
||||||
return new PartUniversalCable(CableTier.ELITE);
|
return new PartUniversalCable(Tier.CableTier.ELITE);
|
||||||
}
|
}
|
||||||
else if(name.equals("mekanism:universal_cable_ultimate"))
|
else if(name.equals("mekanism:universal_cable_ultimate"))
|
||||||
{
|
{
|
||||||
return new PartUniversalCable(CableTier.ULTIMATE);
|
return new PartUniversalCable(Tier.CableTier.ULTIMATE);
|
||||||
}
|
}
|
||||||
else if(name.equals("mekanism:mechanical_pipe"))
|
else if(name.equals("mekanism:mechanical_pipe"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,8 +18,9 @@ import mekanism.client.render.RenderPartTransmitter;
|
||||||
import mekanism.common.IConfigurable;
|
import mekanism.common.IConfigurable;
|
||||||
import mekanism.common.ITileNetwork;
|
import mekanism.common.ITileNetwork;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.Tier;
|
||||||
|
import mekanism.common.Tier.CableTier;
|
||||||
import mekanism.common.item.ItemConfigurator;
|
import mekanism.common.item.ItemConfigurator;
|
||||||
import mekanism.common.multipart.PartUniversalCable.CableTier;
|
|
||||||
import mekanism.common.multipart.TransmitterType.Size;
|
import mekanism.common.multipart.TransmitterType.Size;
|
||||||
import net.minecraft.client.particle.EffectRenderer;
|
import net.minecraft.client.particle.EffectRenderer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -97,13 +98,13 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case UNIVERSAL_CABLE_BASIC:
|
case UNIVERSAL_CABLE_BASIC:
|
||||||
return new PartUniversalCable(CableTier.BASIC);
|
return new PartUniversalCable(Tier.CableTier.BASIC);
|
||||||
case UNIVERSAL_CABLE_ADVANCED:
|
case UNIVERSAL_CABLE_ADVANCED:
|
||||||
return new PartUniversalCable(CableTier.ADVANCED);
|
return new PartUniversalCable(Tier.CableTier.ADVANCED);
|
||||||
case UNIVERSAL_CABLE_ELITE:
|
case UNIVERSAL_CABLE_ELITE:
|
||||||
return new PartUniversalCable(CableTier.ELITE);
|
return new PartUniversalCable(Tier.CableTier.ELITE);
|
||||||
case UNIVERSAL_CABLE_ULTIMATE:
|
case UNIVERSAL_CABLE_ULTIMATE:
|
||||||
return new PartUniversalCable(CableTier.ULTIMATE);
|
return new PartUniversalCable(Tier.CableTier.ULTIMATE);
|
||||||
case MECHANICAL_PIPE:
|
case MECHANICAL_PIPE:
|
||||||
return new PartMechanicalPipe();
|
return new PartMechanicalPipe();
|
||||||
case PRESSURIZED_TUBE:
|
case PRESSURIZED_TUBE:
|
||||||
|
|
|
@ -14,6 +14,7 @@ import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.client.render.RenderPartTransmitter;
|
import mekanism.client.render.RenderPartTransmitter;
|
||||||
import mekanism.common.EnergyNetwork;
|
import mekanism.common.EnergyNetwork;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.Tier;
|
||||||
import mekanism.common.util.CableUtils;
|
import mekanism.common.util.CableUtils;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
@ -33,7 +34,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implements IStrictEnergyAcceptor, IEnergySink, IEnergyHandler, IPowerReceptor
|
public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implements IStrictEnergyAcceptor, IEnergySink, IEnergyHandler, IPowerReceptor
|
||||||
{
|
{
|
||||||
public CableTier tier;
|
public Tier.CableTier tier;
|
||||||
|
|
||||||
/** A fake power handler used to initiate energy transfer calculations. */
|
/** A fake power handler used to initiate energy transfer calculations. */
|
||||||
public PowerHandler powerHandler;
|
public PowerHandler powerHandler;
|
||||||
|
@ -45,7 +46,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
||||||
public double cacheEnergy = 0;
|
public double cacheEnergy = 0;
|
||||||
public double lastWrite = 0;
|
public double lastWrite = 0;
|
||||||
|
|
||||||
public PartUniversalCable(CableTier cableTier)
|
public PartUniversalCable(Tier.CableTier cableTier)
|
||||||
{
|
{
|
||||||
tier = cableTier;
|
tier = cableTier;
|
||||||
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
powerHandler = new PowerHandler(this, PowerHandler.Type.STORAGE);
|
||||||
|
@ -96,7 +97,7 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
||||||
super.load(nbtTags);
|
super.load(nbtTags);
|
||||||
|
|
||||||
cacheEnergy = nbtTags.getDouble("cacheEnergy");
|
cacheEnergy = nbtTags.getDouble("cacheEnergy");
|
||||||
tier = CableTier.values()[nbtTags.getInteger("tier")];
|
tier = Tier.CableTier.values()[nbtTags.getInteger("tier")];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -396,21 +397,4 @@ public class PartUniversalCable extends PartTransmitter<EnergyNetwork> implement
|
||||||
reconfigure();
|
reconfigure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum CableTier
|
|
||||||
{
|
|
||||||
BASIC(500, TransmitterType.UNIVERSAL_CABLE_BASIC),
|
|
||||||
ADVANCED(2000, TransmitterType.UNIVERSAL_CABLE_ADVANCED),
|
|
||||||
ELITE(8000, TransmitterType.UNIVERSAL_CABLE_ELITE),
|
|
||||||
ULTIMATE(32000, TransmitterType.UNIVERSAL_CABLE_ULTIMATE);
|
|
||||||
|
|
||||||
int cableCapacity;
|
|
||||||
TransmitterType type;
|
|
||||||
|
|
||||||
private CableTier(int capacity, TransmitterType transmitterType)
|
|
||||||
{
|
|
||||||
cableCapacity = capacity;
|
|
||||||
type = transmitterType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue