Added pick block for BlockBattery

This commit is contained in:
Calclavia 2014-01-05 13:37:55 +08:00
parent 702eda6366
commit b7dfecb966
5 changed files with 24 additions and 0 deletions

View file

@ -6,12 +6,15 @@ package resonantinduction.transport.battery;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import resonantinduction.ResonantInduction;
import resonantinduction.core.base.BlockIOBase;
import resonantinduction.core.render.BlockRenderingHandler;
import universalelectricity.api.CompatibilityModule;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -76,4 +79,24 @@ public class BlockBattery extends BlockIOBase implements ITileEntityProvider
{
return new TileBattery();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
int id = idPicked(world, x, y, z);
if (id == 0)
{
return null;
}
Item item = Item.itemsList[id];
if (item == null)
{
return null;
}
TileBattery battery = (TileBattery) world.getBlockTileEntity(x, y, z);
return CompatibilityModule.getItemWithCharge(new ItemStack(id, 1, getDamageValue(world, x, y, z)), battery.getEnergy(null));
}
}

View file

@ -7,6 +7,7 @@ import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB