Merge branch 'master' of https://github.com/calclavia/Resonant-Induction
This commit is contained in:
commit
daa52ba109
5 changed files with 303 additions and 235 deletions
|
@ -2,6 +2,6 @@ dir.development=./
|
||||||
dir.mcp=${dir.development}forge/mcp
|
dir.mcp=${dir.development}forge/mcp
|
||||||
version.minecraft=1.6.2
|
version.minecraft=1.6.2
|
||||||
version.mod.major=0
|
version.mod.major=0
|
||||||
version.mod.minor=0
|
version.mod.minor=1
|
||||||
version.mod.revis=1
|
version.mod.revis=0
|
||||||
version.universalelectricity=2.0.0
|
version.universalelectricity=2.0.0
|
|
@ -91,7 +91,7 @@ public class ResonantInduction
|
||||||
* Settings
|
* Settings
|
||||||
*/
|
*/
|
||||||
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
|
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), NAME + ".cfg"));
|
||||||
public static float POWER_PER_COAL = 8;
|
public static float POWER_PER_COAL = 5;
|
||||||
public static boolean SOUND_FXS = true;
|
public static boolean SOUND_FXS = true;
|
||||||
|
|
||||||
/** Block ID by Jyzarc */
|
/** Block ID by Jyzarc */
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||||
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.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.api.IBattery;
|
import resonantinduction.api.IBattery;
|
||||||
import resonantinduction.base.ItemBase;
|
import resonantinduction.base.ItemBase;
|
||||||
|
|
||||||
|
@ -31,7 +32,13 @@ public class ItemCapacitor extends ItemBase implements IBattery
|
||||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||||
{
|
{
|
||||||
double energyStored = this.getEnergyStored(itemStack);
|
double energyStored = this.getEnergyStored(itemStack);
|
||||||
par3List.add("Energy: " + (int)energyStored + " KJ");
|
par3List.add("Energy: " + (int) energyStored + "/" + (int) this.getMaxEnergyStored(itemStack) + " KJ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||||
|
{
|
||||||
|
this.setEnergyStored(par1ItemStack, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,7 +76,7 @@ public class ItemCapacitor extends ItemBase implements IBattery
|
||||||
@Override
|
@Override
|
||||||
public float getMaxEnergyStored(ItemStack itemStack)
|
public float getMaxEnergyStored(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
return 10;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -153,7 +153,8 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
{
|
{
|
||||||
setInventorySlotContents(slotID, ItemStack.loadItemStackFromNBT(tagCompound));
|
setInventorySlotContents(slotID, ItemStack.loadItemStackFromNBT(tagCompound));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
setInventorySlotContents(slotID + 1, ItemStack.loadItemStackFromNBT(tagCompound));
|
setInventorySlotContents(slotID + 1, ItemStack.loadItemStackFromNBT(tagCompound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +316,8 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return clientMaxEnergy;
|
return clientMaxEnergy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +341,8 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
|
|
||||||
return energy;
|
return energy;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return clientEnergy;
|
return clientEnergy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +350,8 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
@Override
|
@Override
|
||||||
public void handle(ByteArrayDataInput input)
|
public void handle(ByteArrayDataInput input)
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
structure.isMultiblock = input.readBoolean();
|
structure.isMultiblock = input.readBoolean();
|
||||||
|
|
||||||
clientEnergy = input.readFloat();
|
clientEnergy = input.readFloat();
|
||||||
|
@ -357,7 +361,10 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
structure.height = input.readInt();
|
structure.height = input.readInt();
|
||||||
structure.length = input.readInt();
|
structure.length = input.readInt();
|
||||||
structure.width = input.readInt();
|
structure.width = input.readInt();
|
||||||
} catch(Exception e) {}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -395,11 +402,13 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
{
|
{
|
||||||
return ListUtil.getTop(structure.inventory);
|
return ListUtil.getTop(structure.inventory);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return structure.tempStack;
|
return structure.tempStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return structure.visibleInventory[i - 1];
|
return structure.visibleInventory[i - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,7 +426,8 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
setInventorySlotContents(slotID, null);
|
setInventorySlotContents(slotID, null);
|
||||||
return tempStack;
|
return tempStack;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
tempStack = getStackInSlot(slotID).splitStack(amount);
|
tempStack = getStackInSlot(slotID).splitStack(amount);
|
||||||
|
|
||||||
if (getStackInSlot(slotID).stackSize == 0)
|
if (getStackInSlot(slotID).stackSize == 0)
|
||||||
|
@ -428,7 +438,8 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
return tempStack;
|
return tempStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,18 +465,21 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
{
|
{
|
||||||
structure.inventory.remove(ListUtil.getTop(structure.inventory));
|
structure.inventory.remove(ListUtil.getTop(structure.inventory));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
structure.tempStack = null;
|
structure.tempStack = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (worldObj.isRemote)
|
if (worldObj.isRemote)
|
||||||
{
|
{
|
||||||
structure.tempStack = itemstack;
|
structure.tempStack = itemstack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
structure.visibleInventory[i - 1] = itemstack;
|
structure.visibleInventory[i - 1] = itemstack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,10 +509,14 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openChest() {}
|
public void openChest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeChest() {}
|
public void closeChest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||||
|
@ -515,6 +533,6 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
@Override
|
@Override
|
||||||
public boolean canReceive(TileEntity transferTile)
|
public boolean canReceive(TileEntity transferTile)
|
||||||
{
|
{
|
||||||
return true;
|
return this.getMaxEnergyStored() - this.getEnergyStored() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@ package resonantinduction.multimeter;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
@ -29,9 +32,49 @@ public class BlockMultimeter extends BlockBase implements ITileEntityProvider
|
||||||
this.func_111022_d(ResonantInduction.PREFIX + "machine");
|
this.func_111022_d(ResonantInduction.PREFIX + "machine");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||||
|
{
|
||||||
|
int metadata = par1World.getBlockMetadata(par2, par3, par4) & 7;
|
||||||
|
float thickness = 0.15f;
|
||||||
|
System.out.println(metadata);
|
||||||
|
if (metadata == 0)
|
||||||
|
{
|
||||||
|
this.setBlockBounds(0, 0, 0, 1, thickness, 1);
|
||||||
|
}
|
||||||
|
else if (metadata == 1)
|
||||||
|
{
|
||||||
|
this.setBlockBounds(0, 1 - thickness, 0, 1, 1, 1);
|
||||||
|
}
|
||||||
|
else if (metadata == 2)
|
||||||
|
{
|
||||||
|
this.setBlockBounds(0, 0, 0, 1, 1, thickness);
|
||||||
|
}
|
||||||
|
else if (metadata == 3)
|
||||||
|
{
|
||||||
|
this.setBlockBounds(0, 0, 1 - thickness, 1, 1, 1);
|
||||||
|
}
|
||||||
|
else if (metadata == 4)
|
||||||
|
{
|
||||||
|
this.setBlockBounds(0, 0, 0, thickness, 1, 1);
|
||||||
|
}
|
||||||
|
else if (metadata == 5)
|
||||||
|
{
|
||||||
|
this.setBlockBounds(1 - thickness, 0, 0, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY,
|
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY,
|
||||||
* hitZ, block metadata
|
* hi@OverridetZ, block metadata
|
||||||
*/
|
*/
|
||||||
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int side, float hitX, float hitY, float hitZ, int metadata)
|
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue