mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 23:33:08 +00:00
v5.4.0 Beta #1
Lots of things, too tired to list. Will give full list when this build is released.
This commit is contained in:
1 parent
d58222b028
commit
5cf1654733
66 files changed
+1378
-247
No files matched your search
@@ -3,6 +3,9 @@ package mekanism.common;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
import thermalexpansion.api.core.IDismantleable;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import universalelectricity.prefab.implement.IToolConfigurator;
|
||||
|
||||
@@ -43,7 +46,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class BlockMachine extends BlockContainer
|
||||
public class BlockMachine extends BlockContainer implements IDismantleable
|
||||
{
|
||||
public Random machineRand = new Random();
|
||||
|
||||
@@ -483,31 +486,66 @@ public class BlockMachine extends BlockContainer
|
||||
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().getItem() instanceof IToolConfigurator)
|
||||
if(entityplayer.getCurrentEquippedItem() != null)
|
||||
{
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
((IToolConfigurator)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 3:
|
||||
change = 4;
|
||||
break;
|
||||
case 4:
|
||||
change = 5;
|
||||
break;
|
||||
case 5:
|
||||
change = 2;
|
||||
break;
|
||||
case 2:
|
||||
change = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
return true;
|
||||
if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolConfigurator)
|
||||
{
|
||||
((IToolConfigurator)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 3:
|
||||
change = 5;
|
||||
break;
|
||||
case 5:
|
||||
change = 2;
|
||||
break;
|
||||
case 2:
|
||||
change = 4;
|
||||
break;
|
||||
case 4:
|
||||
change = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
else if(entityplayer.getCurrentEquippedItem().getItem() instanceof IToolWrench)
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(world, x, y, z, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
((IToolWrench)entityplayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityplayer, x, y, z);
|
||||
|
||||
int change = 0;
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
case 3:
|
||||
change = 5;
|
||||
break;
|
||||
case 5:
|
||||
change = 2;
|
||||
break;
|
||||
case 2:
|
||||
change = 4;
|
||||
break;
|
||||
case 4:
|
||||
change = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, blockID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity != null)
|
||||
@@ -572,18 +610,24 @@ public class BlockMachine extends BlockContainer
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, new ItemStack(Mekanism.MachineBlock, 1, world.getBlockMetadata(x, y, z)));
|
||||
|
||||
IItemElectric electricItem = (IItemElectric)entityItem.getEntityItem().getItem();
|
||||
electricItem.setJoules(tileEntity.electricityStored, entityItem.getEntityItem());
|
||||
|
||||
IUpgradeManagement upgrade = (IUpgradeManagement)entityItem.getEntityItem().getItem();
|
||||
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), entityItem.getEntityItem());
|
||||
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), entityItem.getEntityItem());
|
||||
|
||||
IItemElectric electricItem = (IItemElectric)entityItem.getEntityItem().getItem();
|
||||
electricItem.setJoules(tileEntity.electricityStored, entityItem.getEntityItem());
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockWithNotify(x, y, z, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int i, Random random, int j)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
@@ -591,15 +635,51 @@ public class BlockMachine extends BlockContainer
|
||||
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
|
||||
ItemStack itemStack = new ItemStack(Mekanism.MachineBlock, 1, world.getBlockMetadata(x, y, z));
|
||||
|
||||
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
|
||||
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), itemStack);
|
||||
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
|
||||
|
||||
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
|
||||
electricItem.setJoules(tileEntity.electricityStored, itemStack);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
|
||||
{
|
||||
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
|
||||
ItemStack itemStack = new ItemStack(Mekanism.MachineBlock, 1, world.getBlockMetadata(x, y, z));
|
||||
|
||||
IUpgradeManagement upgrade = (IUpgradeManagement)itemStack.getItem();
|
||||
upgrade.setEnergyMultiplier(((IUpgradeManagement)tileEntity).getEnergyMultiplier(), itemStack);
|
||||
upgrade.setSpeedMultiplier(((IUpgradeManagement)tileEntity).getSpeedMultiplier(), itemStack);
|
||||
|
||||
IItemElectric electricItem = (IItemElectric)itemStack.getItem();
|
||||
electricItem.setJoules(tileEntity.electricityStored, itemStack);
|
||||
|
||||
world.setBlockWithNotify(x, y, z, 0);
|
||||
|
||||
if(!returnBlock)
|
||||
{
|
||||
float motion = 0.7F;
|
||||
double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDismantle(World world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum MachineType
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user