mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Added wand clicking to the Crafty Crate.
This commit is contained in:
1 parent
987160bd80
commit
9e7043b14b
4 files changed
+28
-9
No files matched your search
@@ -13,7 +13,6 @@ package vazkii.botania.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -26,14 +25,16 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.tile.TileCraftCrate;
|
||||
import vazkii.botania.common.block.tile.TileOpenCrate;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BlockOpenCrate extends BlockModContainer implements ILexiconable {
|
||||
public class BlockOpenCrate extends BlockModContainer implements ILexiconable, IWandable {
|
||||
|
||||
IIcon iconSide;
|
||||
IIcon iconBottom;
|
||||
@@ -94,4 +95,10 @@ public class BlockOpenCrate extends BlockModContainer implements ILexiconable {
|
||||
return LexiconData.openCrate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
|
||||
TileOpenCrate crate = (TileOpenCrate) world.getTileEntity(x, y, z);
|
||||
return crate.onWanded(player, stack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,12 +40,12 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(!worldObj.isRemote && craft() && canEject())
|
||||
if(!worldObj.isRemote && craft(true) && canEject())
|
||||
ejectAll();
|
||||
}
|
||||
|
||||
boolean craft() {
|
||||
if(!isFull())
|
||||
boolean craft(boolean fullCheck) {
|
||||
if(fullCheck && !isFull())
|
||||
return false;
|
||||
|
||||
InventoryCrafting craft = new InventoryCrafting(new Container() {
|
||||
@@ -56,11 +56,10 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
}, 3, 3);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
if(stack == null)
|
||||
return false; // Should never get here, but just in case.
|
||||
|
||||
if(stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
|
||||
if(stack == null || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
|
||||
continue;
|
||||
|
||||
craft.setInventorySlotContents(i, stack.copy());
|
||||
}
|
||||
|
||||
@@ -99,4 +98,11 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onWanded(EntityPlayer player, ItemStack stack) {
|
||||
craft(false);
|
||||
ejectAll();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -63,4 +64,9 @@ public class TileOpenCrate extends TileSimpleInventory {
|
||||
if(!worldObj.isRemote)
|
||||
worldObj.spawnEntityInWorld(item);
|
||||
}
|
||||
|
||||
|
||||
public boolean onWanded(EntityPlayer player, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,7 @@ item.botania:laputaShard.name=Shard of Laputa
|
||||
item.botania:virus0.name=Necrodermal Virus
|
||||
item.botania:virus1.name=Nullodermal Virus
|
||||
item.botania:skyDirtRod.name=Rod of the Highlands
|
||||
item.botania:placeholder.name=Placeholder
|
||||
item.botania:placeholder.name=Crafting Placeholder
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania, %s Edition's Index - Pick which category you would like to study:
|
||||
|
||||
Reference in new issue
Block a user