Worked on battery box

Change rotate with wrench and added shift click pickup support.
This commit is contained in:
DarkGuardsman 2013-12-04 13:49:14 -05:00
parent 1c6be93db8
commit 20d38222bb
3 changed files with 42 additions and 9 deletions

View file

@ -29,14 +29,14 @@ import dark.core.prefab.machine.BlockMachine;
import dark.machines.DarkMain;
/** Handler to make registering all parts of a mod's objects that are loaded into the game by forge
*
*
* @author DarkGuardsman */
public class ModObjectRegistry
{
public static HashMap<Block, String> registredBlocks = new HashMap<Block, String>();
public static HashMap<Item, String> registredItems = new HashMap<Item, String>();
@SidedProxy(clientSide = "dark.core.registration.ClientRegistryProxy", serverSide = "dark.core.registration.RegistryProxy")
@SidedProxy(clientSide = "dark.core.ClientRegistryProxy", serverSide = "dark.core.RegistryProxy")
public static RegistryProxy proxy;
public static Configuration masterBlockConfig = new Configuration(new File(Loader.instance().getConfigDir(), "Dark/EnabledBlocks.cfg"));
@ -128,7 +128,7 @@ public class ModObjectRegistry
}
/** Method to get block via name
*
*
* @param blockName
* @return Block requested */
public static Block getBlock(String blockName)
@ -145,7 +145,7 @@ public class ModObjectRegistry
}
/** Method to get block via id
*
*
* @param blockID
* @return Block requested */
public static Block getBlock(int blockID)
@ -189,7 +189,7 @@ public class ModObjectRegistry
/** Creates a new item using reflection as well runs it threw some check to activate any
* interface methods
*
*
* @param name - name to register the item with
* @param modid - mods that the item comes from
* @param clazz - item class
@ -283,7 +283,7 @@ public class ModObjectRegistry
}
/** Adds a tileEntity to be registered when this block is registered
*
*
* @param name - mod name for the tileEntity, should be unique
* @param class1 - new instance of the TileEntity to register */
public BlockBuildData addTileEntity(String name, Class<? extends TileEntity> class1)

View file

@ -90,7 +90,7 @@ public class DarkMain extends ModPrefab
public static final String MOD_ID = "DarkCore";
public static final String MOD_NAME = "Darks CoreMachine";
@SidedProxy(clientSide = "dark.core.client.ClientProxy", serverSide = "dark.core.common.CommonProxy")
@SidedProxy(clientSide = "dark.machines.client.ClientProxy", serverSide = "dark.machines.CommonProxy")
public static CommonProxy proxy;
public static final String CHANNEL = "DarkPackets";

View file

@ -19,12 +19,13 @@ import universalelectricity.core.vector.Vector3;
import com.builtbroken.common.Pair;
import dark.core.DMCreativeTab;
import dark.core.helpers.ItemWorldHelper;
import dark.core.prefab.machine.BlockMachine;
import dark.machines.CommonProxy;
import dark.machines.DarkMain;
/** Block for energy storage devices
*
*
* @author Rseifert */
public class BlockEnergyStorage extends BlockMachine
{
@ -62,7 +63,39 @@ public class BlockEnergyStorage extends BlockMachine
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
world.setBlockMetadataWithNotify(x, y, z, side, 3);
if (!world.isRemote)
{
int metadata = world.getBlockMetadata(x, y, z);
if (metadata >= 5)
{
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
}
else
{
world.setBlockMetadataWithNotify(x, y, z, metadata + 1, 3);
}
}
return true;
}
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
world.setBlockMetadataWithNotify(x, y, z, side, 3);
}
return true;
}
@Override
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
ItemWorldHelper.dropItemStack(world, new Vector3(x, y, z), ItemBlockEnergyStorage.getWrenchedBatteryBox(world, new Vector3(x, y, z)), false);
world.setBlockToAir(x, y, z);
}
return true;
}