resonant-induction/minecraft/dark/BasicUtilities/Items/ItemOilBucket.java
Rseifert 5787f65148 Reformating, and rebalance of tanks, Final 1.4.5
Did some file changes to make finding things easier
Added: Custom creative tab
Changed: File root system, :p to many files
Changed: Tank liquid trade method to balance out instead of full trade
Changed: the packet update rate of the Tank to try to fix Render Lag
Fixed: Tank Render so Liquid levels can be seen
BugIgnorable: uneven levels of liquid will not show up on tank render
but are present
BugIgnorable: eValve names sometime glitch and call all instances Empty
XXX
TODO: Fix Textures, and add model for eValve
TODO: Finish One way valve
TODO: Finish OIL,STEAM,FUEL liquid/gas blocks
2012-12-23 05:28:26 -05:00

50 lines
No EOL
1.6 KiB
Java

package dark.BasicUtilities.Items;
import dark.BasicUtilities.BasicUtilitiesMain;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import universalelectricity.prefab.UETab;
public class ItemOilBucket extends ItemBucket
{
public ItemOilBucket(int id, int texture)
{
super(id, BasicUtilitiesMain.oilMoving.blockID);
this.setIconIndex(texture);
this.setCreativeTab(UETab.INSTANCE);
this.setContainerItem(Item.bucketEmpty);
this.setItemName("bucketOil");
}
@Override
public String getTextureFile()
{
return BasicUtilitiesMain.ITEM_PNG;
}
@ForgeSubscribe
public void onBucketFill(FillBucketEvent event)
{
if (event.current.itemID == Item.bucketEmpty.shiftedIndex)
{
World worldObj = event.world;
MovingObjectPosition position = event.target;
int blockID = worldObj.getBlockId(position.blockX, position.blockY, position.blockZ);
if ((blockID == BasicUtilitiesMain.oilStill.blockID || blockID == BasicUtilitiesMain.oilMoving.blockID) && worldObj.getBlockMetadata(position.blockX, position.blockY, position.blockZ) == 0)
{
worldObj.setBlockWithNotify(position.blockX, position.blockY, position.blockZ, 0);
event.result = new ItemStack(BasicUtilitiesMain.itemOilBucket);
event.current.stackSize--;
event.setResult(Result.ALLOW);
}
}
}
}