mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-14 01:14:04 +00:00
deleted duplicated check, using callList for rendering shield, cleanup.
This commit is contained in:
1 parent
f2fb61feb0
commit
3fdaf92d12
8 files changed
+60
-86
No files matched your search
@@ -16,31 +16,6 @@ import java.util.Locale;
|
||||
|
||||
public class EMTRandomHelper {
|
||||
|
||||
public static boolean placeTorch(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
|
||||
ItemStack torchStack = player.inventory.mainInventory[i];
|
||||
if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase(Locale.US).contains("torch"))
|
||||
continue;
|
||||
Item item = torchStack.getItem();
|
||||
if (!(item instanceof ItemBlock))
|
||||
continue;
|
||||
int oldMeta = torchStack.getItemDamage();
|
||||
int oldSize = torchStack.stackSize;
|
||||
boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset);
|
||||
if (player.capabilities.isCreativeMode) {
|
||||
torchStack.setItemDamage(oldMeta);
|
||||
torchStack.stackSize = oldSize;
|
||||
}
|
||||
else if (torchStack.stackSize <= 0) {
|
||||
ForgeEventFactory.onPlayerDestroyItem(player, torchStack);
|
||||
player.inventory.mainInventory[i] = null;
|
||||
}
|
||||
if (result)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack getChargedItem(Item item, int charge) {
|
||||
ItemStack stack = new ItemStack(item);
|
||||
ElectricItem.manager.charge(stack, charge, charge, true, false);
|
||||
|
||||
Reference in new issue
Block a user