temp remove ids, broken
This commit is contained in:
parent
bc74b3a29d
commit
1713ca7f96
114 changed files with 589 additions and 1731 deletions
|
@ -1497,8 +1497,6 @@ public class Client implements IThreadListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int meta = 0;
|
|
||||||
boolean flag1 = false;
|
|
||||||
Item item = null;
|
Item item = null;
|
||||||
|
|
||||||
if (this.pointed.type == HitPosition.ObjectType.BLOCK)
|
if (this.pointed.type == HitPosition.ObjectType.BLOCK)
|
||||||
|
@ -1519,8 +1517,7 @@ public class Client implements IThreadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block1 = item instanceof ItemBlock && !block.isPickStrict() ? item.getBlock() : block;
|
Block block1 = item instanceof ItemBlock && !block.isPickStrict() ? item.getBlock() : block;
|
||||||
meta = block1.getDamageValue(this.world, blockpos);
|
// meta = block1.getDamageValue(this.world, blockpos); TODO: data
|
||||||
flag1 = item.getHasSubtypes();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1535,9 +1532,9 @@ public class Client implements IThreadListener {
|
||||||
|
|
||||||
InventoryPlayer inventoryplayer = this.player.inventory;
|
InventoryPlayer inventoryplayer = this.player.inventory;
|
||||||
|
|
||||||
inventoryplayer.setCurrentItem(item, meta, flag1);
|
inventoryplayer.setCurrentItem(item);
|
||||||
if(this.itemCheat) {
|
if(this.itemCheat) {
|
||||||
this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item, 1, meta), inventoryplayer.currentItem, this.ctrl()));
|
this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item), inventoryplayer.currentItem, this.ctrl()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1957,7 +1954,7 @@ public class Client implements IThreadListener {
|
||||||
(((EntityLiving)entity).deathTime != 0 ? "Tod: " + ((EntityLiving)entity).deathTime + "t, " : "") + "Rüstung: " + ((EntityLiving)entity).getTotalArmorValue() + ", Pfeile: " + ((EntityLiving)entity).getArrowCountInEntity()
|
(((EntityLiving)entity).deathTime != 0 ? "Tod: " + ((EntityLiving)entity).deathTime + "t, " : "") + "Rüstung: " + ((EntityLiving)entity).getTotalArmorValue() + ", Pfeile: " + ((EntityLiving)entity).getArrowCountInEntity()
|
||||||
: "Rüstung: n/a, Pfeile: n/a") + "\n" +
|
: "Rüstung: n/a, Pfeile: n/a") + "\n" +
|
||||||
(held != null ?
|
(held != null ?
|
||||||
"Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size + " (" + held.getMetadata() + ")" : "Gegens.: n/a") + "\n" +
|
"Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size : "Gegens.: n/a") + "\n" +
|
||||||
"Eigens.: " + (entity.dead ? "D" : "") + (entity.noClip ? "N" : "") + (entity.onGround ? "G" : "")
|
"Eigens.: " + (entity.dead ? "D" : "") + (entity.noClip ? "N" : "") + (entity.onGround ? "G" : "")
|
||||||
+ (entity.canBeCollidedWith() ? "C" : "") + (entity.canBePushed() ? "P" : "")
|
+ (entity.canBeCollidedWith() ? "C" : "") + (entity.canBePushed() ? "P" : "")
|
||||||
+ (entity.isBurning() ? "B" : "") + (entity.isPlayer() ? "S" : "")
|
+ (entity.isBurning() ? "B" : "") + (entity.isPlayer() ? "S" : "")
|
||||||
|
|
|
@ -150,7 +150,7 @@ public abstract class RenderRegistry {
|
||||||
map.put(EntityBoat.class, new RenderBoat(mgr));
|
map.put(EntityBoat.class, new RenderBoat(mgr));
|
||||||
map.put(EntityHook.class, new RenderFish(mgr));
|
map.put(EntityHook.class, new RenderFish(mgr));
|
||||||
map.put(EntityHorse.class, new RenderHorse(mgr, new ModelHorse()));
|
map.put(EntityHorse.class, new RenderHorse(mgr, new ModelHorse()));
|
||||||
map.put(EntityDynamite.class, new RenderDynamite(mgr, Items.dynamite, ritem));
|
map.put(EntityDynamite.class, new RenderDynamite(mgr, ritem));
|
||||||
map.put(EntityNuke.class, new RenderBlockEntity(mgr, Blocks.nuke.getState()));
|
map.put(EntityNuke.class, new RenderBlockEntity(mgr, Blocks.nuke.getState()));
|
||||||
map.put(EntityMouse.class, new RenderMouse(mgr, new ModelMouse()));
|
map.put(EntityMouse.class, new RenderMouse(mgr, new ModelMouse()));
|
||||||
map.put(EntityDie.class, new RenderDie(mgr));
|
map.put(EntityDie.class, new RenderDie(mgr));
|
||||||
|
|
|
@ -517,7 +517,7 @@ public class ClientPlayer implements IClientPlayer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i), 1, 0);
|
player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setPositionAndRotation(x, y, z, yaw, pitch);
|
player.setPositionAndRotation(x, y, z, yaw, pitch);
|
||||||
|
|
|
@ -32,19 +32,13 @@ public class ItemModelMesher
|
||||||
|
|
||||||
public TextureAtlasSprite getParticleIcon(Item item)
|
public TextureAtlasSprite getParticleIcon(Item item)
|
||||||
{
|
{
|
||||||
return this.getParticleIcon(item, 0);
|
return this.getItemModel(new ItemStack(item)).getBaseTexture();
|
||||||
}
|
|
||||||
|
|
||||||
public TextureAtlasSprite getParticleIcon(Item item, int meta)
|
|
||||||
{
|
|
||||||
return this.getItemModel(new ItemStack(item, 1, meta)).getBaseTexture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBakedModel getItemModel(ItemStack stack)
|
public IBakedModel getItemModel(ItemStack stack)
|
||||||
{
|
{
|
||||||
Item item = stack.getItem();
|
Item item = stack.getItem();
|
||||||
IBakedModel ibakedmodel = this.simpleShapesCache.get(Integer.valueOf(this.getIndex(item,
|
IBakedModel ibakedmodel = this.simpleShapesCache.get(this.getIndex(item));
|
||||||
stack.isItemStackDamageable() ? 0 : stack.getMetadata())));
|
|
||||||
|
|
||||||
if (ibakedmodel == null)
|
if (ibakedmodel == null)
|
||||||
{
|
{
|
||||||
|
@ -64,9 +58,9 @@ public class ItemModelMesher
|
||||||
return ibakedmodel;
|
return ibakedmodel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getIndex(Item item, int meta)
|
private int getIndex(Item item)
|
||||||
{
|
{
|
||||||
return ItemRegistry.getIdFromItem(item) << 16 | meta;
|
return ItemRegistry.getIdFromItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void register(Item item, int meta, ResourceLocation location)
|
// public void register(Item item, int meta, ResourceLocation location)
|
||||||
|
@ -122,9 +116,9 @@ public class ItemModelMesher
|
||||||
continue;
|
continue;
|
||||||
item.getRenderItems(item, stacks);
|
item.getRenderItems(item, stacks);
|
||||||
for(ItemStack stack : stacks) {
|
for(ItemStack stack : stacks) {
|
||||||
this.simpleShapesCache.put(this.getIndex(item, stack.getMetadata()),
|
this.simpleShapesCache.put(this.getIndex(item),
|
||||||
this.modelManager.getModel("item/" +
|
this.modelManager.getModel("item/" +
|
||||||
ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory"));
|
ItemRegistry.getNameFromItem(item).toString() + '#' + "inventory"));
|
||||||
}
|
}
|
||||||
stacks.clear();
|
stacks.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,8 +144,8 @@ public abstract class ModelBakery
|
||||||
// {
|
// {
|
||||||
item.getRenderItems(item, stacks);
|
item.getRenderItems(item, stacks);
|
||||||
for(ItemStack stack : stacks) {
|
for(ItemStack stack : stacks) {
|
||||||
String resourcelocation = "item/" + ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory";
|
String resourcelocation = "item/" + ItemRegistry.getNameFromItem(item).toString() + '#' + "inventory";
|
||||||
models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString(), stack.getMetadata()));
|
models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString()));
|
||||||
itemLocations.add(resourcelocation);
|
itemLocations.add(resourcelocation);
|
||||||
}
|
}
|
||||||
stacks.clear();
|
stacks.clear();
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package client.renderer.entity;
|
package client.renderer.entity;
|
||||||
|
|
||||||
import common.entity.projectile.EntityDynamite;
|
import common.entity.projectile.EntityDynamite;
|
||||||
import common.item.Item;
|
import common.init.ItemRegistry;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
|
|
||||||
public class RenderDynamite extends RenderItemEntity<EntityDynamite> {
|
public class RenderDynamite extends RenderItemEntity<EntityDynamite> {
|
||||||
public RenderDynamite(RenderManager renderManagerIn, Item itemIn, RenderItem renderItemIn) {
|
public RenderDynamite(RenderManager renderManagerIn, RenderItem renderItemIn) {
|
||||||
super(renderManagerIn, itemIn, renderItemIn);
|
super(renderManagerIn, null, renderItemIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStack(EntityDynamite entityIn)
|
public ItemStack getStack(EntityDynamite entityIn)
|
||||||
{
|
{
|
||||||
return new ItemStack(this.item, 1, entityIn.explosionSize);
|
return new ItemStack(ItemRegistry.getRegisteredItem("dynamite" + (entityIn.explosionSize <= 0 || entityIn.explosionSize >= 8 ? "" : "_" + entityIn.explosionSize)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class RenderItemEntity<T extends Entity> extends Render<T>
|
||||||
|
|
||||||
public ItemStack getStack(T entityIn)
|
public ItemStack getStack(T entityIn)
|
||||||
{
|
{
|
||||||
return new ItemStack(this.item, 1, 0);
|
return new ItemStack(this.item);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getEntityTexture(Entity entity)
|
protected String getEntityTexture(Entity entity)
|
||||||
|
|
|
@ -10,14 +10,9 @@ import common.world.World;
|
||||||
|
|
||||||
public class EntityBreakingFX extends EntityFX
|
public class EntityBreakingFX extends EntityFX
|
||||||
{
|
{
|
||||||
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_)
|
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_)
|
||||||
{
|
{
|
||||||
this(worldIn, posXIn, posYIn, posZIn, p_i1195_8_, 0);
|
this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_);
|
||||||
}
|
|
||||||
|
|
||||||
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_, int p_i1197_15_)
|
|
||||||
{
|
|
||||||
this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_, p_i1197_15_);
|
|
||||||
this.motionX *= 0.10000000149011612D;
|
this.motionX *= 0.10000000149011612D;
|
||||||
this.motionY *= 0.10000000149011612D;
|
this.motionY *= 0.10000000149011612D;
|
||||||
this.motionZ *= 0.10000000149011612D;
|
this.motionZ *= 0.10000000149011612D;
|
||||||
|
@ -26,10 +21,10 @@ public class EntityBreakingFX extends EntityFX
|
||||||
this.motionZ += zSpeedIn;
|
this.motionZ += zSpeedIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_)
|
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_)
|
||||||
{
|
{
|
||||||
super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
|
super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
|
||||||
this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_));
|
this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_));
|
||||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||||
this.particleGravity = 1.0F; // Blocks.snow.particleGravity;
|
this.particleGravity = 1.0F; // Blocks.snow.particleGravity;
|
||||||
this.particleScale /= 2.0F;
|
this.particleScale /= 2.0F;
|
||||||
|
@ -75,8 +70,7 @@ public class EntityBreakingFX extends EntityFX
|
||||||
{
|
{
|
||||||
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
|
||||||
{
|
{
|
||||||
int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
|
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0]));
|
||||||
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0]), i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,8 +189,7 @@ public class PlayerController {
|
||||||
|
|
||||||
if(this.stack != null && stack != null) {
|
if(this.stack != null && stack != null) {
|
||||||
flag = stack.getItem() == this.stack.getItem()
|
flag = stack.getItem() == this.stack.getItem()
|
||||||
&& ItemStack.areItemStackTagsEqual(stack, this.stack)
|
&& ItemStack.areItemStackTagsEqual(stack, this.stack);
|
||||||
&& (stack.isItemStackDamageable() || stack.getMetadata() == this.stack.getMetadata());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos.equals(this.position) && flag;
|
return pos.equals(this.position) && flag;
|
||||||
|
|
|
@ -653,7 +653,7 @@ public class WorldClient extends AWorldClient
|
||||||
|
|
||||||
for (int i1 = 0; i1 < 8; ++i1)
|
for (int i1 = 0; i1 < 8; ++i1)
|
||||||
{
|
{
|
||||||
this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.getShouldIgnoreRange(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, new int[] {ItemRegistry.getIdFromItem(Items.potion), data});
|
this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.getShouldIgnoreRange(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, new int[] {ItemRegistry.getIdFromItem(Items.potion)});
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleType enumparticletypes = ParticleType.WATER_SPLASH;
|
ParticleType enumparticletypes = ParticleType.WATER_SPLASH;
|
||||||
|
|
|
@ -64,14 +64,14 @@ public class EntityAIShareItems extends EntityAIWatchClosest2
|
||||||
{
|
{
|
||||||
int l = itemstack.size / 2;
|
int l = itemstack.size / 2;
|
||||||
itemstack.size -= l;
|
itemstack.size -= l;
|
||||||
itemstack1 = new ItemStack(item, l, itemstack.getMetadata());
|
itemstack1 = new ItemStack(item, l);
|
||||||
}
|
}
|
||||||
else if (item == Items.wheats && itemstack.size > 5)
|
else if (item == Items.wheats && itemstack.size > 5)
|
||||||
{
|
{
|
||||||
int j = itemstack.size / 2 / 3 * 3;
|
int j = itemstack.size / 2 / 3 * 3;
|
||||||
int k = j / 3;
|
int k = j / 3;
|
||||||
itemstack.size -= j;
|
itemstack.size -= j;
|
||||||
itemstack1 = new ItemStack(Items.bread, k, 0);
|
itemstack1 = new ItemStack(Items.bread, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.size <= 0)
|
if (itemstack.size <= 0)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.block.Block;
|
||||||
import common.collect.Maps;
|
import common.collect.Maps;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.init.ItemRegistry;
|
import common.item.Item;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.BlockPos;
|
||||||
|
@ -17,45 +17,12 @@ import common.world.World;
|
||||||
|
|
||||||
public class EntityAITakePlace extends EntityAIBase
|
public class EntityAITakePlace extends EntityAIBase
|
||||||
{
|
{
|
||||||
private static class StackKey {
|
|
||||||
public String item;
|
|
||||||
public int meta;
|
|
||||||
|
|
||||||
public StackKey(String str) {
|
|
||||||
String[] tok = str.split(":", 2);
|
|
||||||
this.item = tok[0];
|
|
||||||
this.meta = tok.length > 1 ? Integer.parseInt(tok[1]) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StackKey(ItemStack stack) {
|
|
||||||
this.item = ItemRegistry.getNameFromItem(stack.getItem()).toString();
|
|
||||||
this.meta = stack.getItem().getMaxDamage() <= 0 ? stack.getMetadata() : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public boolean isSame(ItemStack stack) {
|
|
||||||
// return this.item.equals(ItemRegistry.getNameFromItem(stack.getItem()).toString()) &&
|
|
||||||
// (stack.getItem().getMaxDamage() > 0 || stack.getMetadata() == this.meta);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
|
||||||
return other instanceof StackKey && ((StackKey)other).item.equals(this.item) && ((StackKey)other).meta == this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode() {
|
|
||||||
return this.item.hashCode() ^ (this.meta << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return this.item + (this.meta == -1 ? "" : (":" + this.meta));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<State, ItemStack> STEALABLE = Maps.newHashMap();
|
private static final Map<State, ItemStack> STEALABLE = Maps.newHashMap();
|
||||||
private static final Map<StackKey, State> PLACEABLE = Maps.newHashMap();
|
private static final Map<Item, State> PLACEABLE = Maps.newHashMap();
|
||||||
|
|
||||||
private static void addPlaceable(State state, ItemStack stack) {
|
private static void addPlaceable(State state, ItemStack stack) {
|
||||||
STEALABLE.put(state, stack);
|
STEALABLE.put(state, stack);
|
||||||
PLACEABLE.put(new StackKey(stack), state);
|
PLACEABLE.put(stack.getItem(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addPlaceable(Block block) {
|
private static void addPlaceable(Block block) {
|
||||||
|
@ -85,7 +52,7 @@ public class EntityAITakePlace extends EntityAIBase
|
||||||
this.place = false;
|
this.place = false;
|
||||||
return this.entity.getRNG().chance(20);
|
return this.entity.getRNG().chance(20);
|
||||||
}
|
}
|
||||||
else if(this.entity.getRNG().chance(200) && PLACEABLE.containsKey(new StackKey(this.entity.getHeldItem()))) {
|
else if(this.entity.getRNG().chance(200) && PLACEABLE.containsKey(this.entity.getHeldItem().getItem())) {
|
||||||
this.place = this.entity.getRNG().rarity(10);
|
this.place = this.entity.getRNG().rarity(10);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -102,11 +69,11 @@ public class EntityAITakePlace extends EntityAIBase
|
||||||
BlockPos blockpos = new BlockPos(i, j, k);
|
BlockPos blockpos = new BlockPos(i, j, k);
|
||||||
if(this.place) {
|
if(this.place) {
|
||||||
ItemStack stack = this.entity.getHeldItem();
|
ItemStack stack = this.entity.getHeldItem();
|
||||||
if(stack == null || !PLACEABLE.containsKey(new StackKey(this.entity.getHeldItem())))
|
if(stack == null || !PLACEABLE.containsKey(this.entity.getHeldItem().getItem()))
|
||||||
return;
|
return;
|
||||||
Block replace = world.getState(blockpos).getBlock();
|
Block replace = world.getState(blockpos).getBlock();
|
||||||
Block below = world.getState(blockpos.down()).getBlock();
|
Block below = world.getState(blockpos.down()).getBlock();
|
||||||
State state = PLACEABLE.get(new StackKey(this.entity.getHeldItem()));
|
State state = PLACEABLE.get(this.entity.getHeldItem().getItem());
|
||||||
if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace == Blocks.air &&
|
if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace == Blocks.air &&
|
||||||
below != Blocks.air && below.isFullCube())
|
below != Blocks.air && below.isFullCube())
|
||||||
{
|
{
|
||||||
|
|
|
@ -852,14 +852,9 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack createStackedBlock(State state) {
|
public ItemStack createStackedBlock(State state) {
|
||||||
int i = 0;
|
|
||||||
Item item = ItemRegistry.getItemFromBlock(this);
|
Item item = ItemRegistry.getItemFromBlock(this);
|
||||||
|
// TODO: data
|
||||||
if(item != null && item.getHasSubtypes()) {
|
return new ItemStack(item);
|
||||||
i = this.getMetaFromState(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ItemStack(item, 1, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int quantityDroppedWithBonus(int fortune, Random random) {
|
public int quantityDroppedWithBonus(int fortune, Random random) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class BlockHay extends BlockRotatedPillar
|
||||||
|
|
||||||
public ItemStack createStackedBlock(State state)
|
public ItemStack createStackedBlock(State state)
|
||||||
{
|
{
|
||||||
return new ItemStack(ItemRegistry.getItemFromBlock(this), 1, 0);
|
return new ItemStack(ItemRegistry.getItemFromBlock(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -169,7 +169,7 @@ public class BlockCocoa extends BlockDirectional implements IGrowable
|
||||||
|
|
||||||
for (int k = 0; k < j; ++k)
|
for (int k = 0; k < j; ++k)
|
||||||
{
|
{
|
||||||
spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, DyeColor.BROWN.getDyeDamage()));
|
spawnAsEntity(worldIn, pos, new ItemStack(Items.cocoa));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
{
|
{
|
||||||
if (worldIn.rand.zrange(15) <= i)
|
if (worldIn.rand.zrange(15) <= i)
|
||||||
{
|
{
|
||||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0));
|
spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class BlockDeadBush extends BlockBush
|
||||||
if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears)
|
if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears)
|
||||||
{
|
{
|
||||||
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
||||||
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
|
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -425,7 +425,7 @@ public class BlockVine extends Block
|
||||||
if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears)
|
if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears)
|
||||||
{
|
{
|
||||||
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
||||||
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0));
|
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,11 +130,6 @@ public class BlockOre extends Block
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int damageDropped(State state)
|
|
||||||
{
|
|
||||||
return this.dropItem == null ? 0 : this.dropItem.getMetadata(); // this == Blocks.lapis_ore ? EnumDyeColor.BLUE.getDyeDamage() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isXrayVisible()
|
public boolean isXrayVisible()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class BlockSnow extends Block
|
||||||
|
|
||||||
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
||||||
{
|
{
|
||||||
spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0));
|
spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1));
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,7 +492,7 @@ public class BlockCauldron extends Block
|
||||||
int i = ((Integer)state.getValue(LEVEL)).intValue();
|
int i = ((Integer)state.getValue(LEVEL)).intValue();
|
||||||
Item item = itemstack.getItem();
|
Item item = itemstack.getItem();
|
||||||
|
|
||||||
if (item == Items.water_bucket && FluidRegistry.getStaticBlock(itemstack.getMetadata()) == Blocks.water)
|
if (item == Items.water_bucket)
|
||||||
{
|
{
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
{
|
{
|
||||||
|
@ -513,7 +513,7 @@ public class BlockCauldron extends Block
|
||||||
{
|
{
|
||||||
// if (!playerIn.creative)
|
// if (!playerIn.creative)
|
||||||
// {
|
// {
|
||||||
ItemStack itemstack2 = new ItemStack(Items.potion, 1, 0);
|
ItemStack itemstack2 = new ItemStack(Items.potion);
|
||||||
|
|
||||||
if (!playerIn.inventory.addItemStackToInventory(itemstack2))
|
if (!playerIn.inventory.addItemStackToInventory(itemstack2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class BlockBanner extends BlockContainer
|
||||||
|
|
||||||
if (tileentity instanceof TileEntityBanner)
|
if (tileentity instanceof TileEntityBanner)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
|
ItemStack itemstack = new ItemStack(Items.banner);
|
||||||
TagObject tag = new TagObject();
|
TagObject tag = new TagObject();
|
||||||
tileentity.writeTags(tag);
|
tileentity.writeTags(tag);
|
||||||
tag.remove("x");
|
tag.remove("x");
|
||||||
|
@ -147,7 +147,7 @@ public class BlockBanner extends BlockContainer
|
||||||
if (te instanceof TileEntityBanner)
|
if (te instanceof TileEntityBanner)
|
||||||
{
|
{
|
||||||
TileEntityBanner tileentitybanner = (TileEntityBanner)te;
|
TileEntityBanner tileentitybanner = (TileEntityBanner)te;
|
||||||
ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor());
|
ItemStack itemstack = new ItemStack(Items.banner);
|
||||||
TagObject tag = new TagObject();
|
TagObject tag = new TagObject();
|
||||||
TileEntityBanner.setBaseColorAndPatterns(tag, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns());
|
TileEntityBanner.setBaseColorAndPatterns(tag, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns());
|
||||||
itemstack.setTagInfo("BlockEntityTag", tag);
|
itemstack.setTagInfo("BlockEntityTag", tag);
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ public abstract class Entity
|
||||||
|
|
||||||
public EntityItem dropItemWithOffset(Item itemIn, int size, float offsetY)
|
public EntityItem dropItemWithOffset(Item itemIn, int size, float offsetY)
|
||||||
{
|
{
|
||||||
return this.entityDropItem(new ItemStack(itemIn, size, 0), offsetY);
|
return this.entityDropItem(new ItemStack(itemIn, size), offsetY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class EntityCow extends EntityAnimal
|
||||||
}
|
}
|
||||||
else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket)))
|
else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket)))
|
||||||
{
|
{
|
||||||
player.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), false);
|
player.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import common.init.SoundEvent;
|
||||||
import common.inventory.Container;
|
import common.inventory.Container;
|
||||||
import common.inventory.InventoryCrafting;
|
import common.inventory.InventoryCrafting;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
|
import common.item.ItemDye;
|
||||||
import common.item.ItemShears;
|
import common.item.ItemShears;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.pathfinding.PathNavigateGround;
|
import common.pathfinding.PathNavigateGround;
|
||||||
|
@ -75,8 +76,6 @@ public class EntitySheep extends EntityAnimal
|
||||||
this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
|
this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
|
||||||
this.tasks.addTask(7, new EntityAIWatchClosest(this, null, 6.0F));
|
this.tasks.addTask(7, new EntityAIWatchClosest(this, null, 6.0F));
|
||||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||||
this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.dye, 1, 0));
|
|
||||||
this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.dye, 1, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateAITasks()
|
protected void updateAITasks()
|
||||||
|
@ -350,28 +349,25 @@ public class EntitySheep extends EntityAnimal
|
||||||
return livingdata;
|
return livingdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to mix both parent sheep to come up with a mixed dye color.
|
|
||||||
*/
|
|
||||||
private DyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
|
private DyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother)
|
||||||
{
|
{
|
||||||
int i = ((EntitySheep)father).getFleeceColor().getDyeDamage();
|
DyeColor i = ((EntitySheep)father).getFleeceColor();
|
||||||
int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage();
|
DyeColor j = ((EntitySheep)mother).getFleeceColor();
|
||||||
this.inventoryCrafting.getStackInSlot(0).setItemDamage(i);
|
this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(ItemDye.getByColor(i)));
|
||||||
this.inventoryCrafting.getStackInSlot(1).setItemDamage(j);
|
this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(ItemDye.getByColor(j)));
|
||||||
ItemStack itemstack = CraftingRegistry.getMatching(this.inventoryCrafting, ((EntitySheep)father).worldObj);
|
ItemStack itemstack = CraftingRegistry.getMatching(this.inventoryCrafting, ((EntitySheep)father).worldObj);
|
||||||
int k;
|
DyeColor k;
|
||||||
|
|
||||||
if (itemstack != null && itemstack.getItem() == Items.dye)
|
if (itemstack != null && itemstack.getItem() instanceof ItemDye dye)
|
||||||
{
|
{
|
||||||
k = itemstack.getMetadata();
|
k = dye.getColor();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
k = this.worldObj.rand.chance() ? i : j;
|
k = this.worldObj.rand.chance() ? i : j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DyeColor.byDyeDamage(k);
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getEyeHeight()
|
public float getEyeHeight()
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class EntitySquid extends EntityWaterMob
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j)
|
for (int j = 0; j < i; ++j)
|
||||||
{
|
{
|
||||||
this.entityDropItem(new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), 0.0F);
|
this.entityDropItem(new ItemStack(Items.ink_sack), 0.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import common.entity.types.EntityTameable;
|
||||||
import common.init.Items;
|
import common.init.Items;
|
||||||
import common.init.SoundEvent;
|
import common.init.SoundEvent;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
|
import common.item.ItemDye;
|
||||||
import common.item.ItemFood;
|
import common.item.ItemFood;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.model.ParticleType;
|
import common.model.ParticleType;
|
||||||
|
@ -380,9 +381,9 @@ public class EntityWolf extends EntityTameable
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itemstack.getItem() == Items.dye)
|
else if (itemstack.getItem() instanceof ItemDye dye)
|
||||||
{
|
{
|
||||||
DyeColor enumdyecolor = DyeColor.byDyeDamage(itemstack.getMetadata());
|
DyeColor enumdyecolor = dye.getColor();
|
||||||
|
|
||||||
if (enumdyecolor != this.getCollarColor())
|
if (enumdyecolor != this.getCollarColor())
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class EntityItem extends Entity
|
||||||
// for(int z = 0; z < 8; z++) {
|
// for(int z = 0; z < 8; z++) {
|
||||||
((AWorldServer)this.worldObj).spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ,
|
((AWorldServer)this.worldObj).spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ,
|
||||||
8, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, 0.1f,
|
8, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, 0.1f,
|
||||||
ItemRegistry.getIdFromItem(this.getEntityItem().getItem()), this.getEntityItem().getMetadata());
|
ItemRegistry.getIdFromItem(this.getEntityItem().getItem()));
|
||||||
// }
|
// }
|
||||||
this.worldObj.playAuxSFX(1023, this.getPosition(), 0);
|
this.worldObj.playAuxSFX(1023, this.getPosition(), 0);
|
||||||
this.setDead();
|
this.setDead();
|
||||||
|
@ -233,10 +233,6 @@ public class EntityItem extends Entity
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (itemstack1.getItem().getHasSubtypes() && itemstack1.getMetadata() != itemstack.getMetadata())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (itemstack1.size < itemstack.size)
|
else if (itemstack1.size < itemstack.size)
|
||||||
{
|
{
|
||||||
return other.combineItems(this);
|
return other.combineItems(this);
|
||||||
|
@ -465,7 +461,7 @@ public class EntityItem extends Entity
|
||||||
return this.getCustomNameTag();
|
return this.getCustomNameTag();
|
||||||
String comp = super.getTypeName();
|
String comp = super.getTypeName();
|
||||||
comp += " (" + this.getEntityItem().size + " * " +
|
comp += " (" + this.getEntityItem().size + " * " +
|
||||||
ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ":" + this.getEntityItem().getMetadata() + ")";
|
ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ")";
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class EntityHuman extends EntityNPC {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBreedingItem(ItemStack stack) {
|
public boolean isBreedingItem(ItemStack stack) {
|
||||||
return stack.getItem() == Items.golden_apple && stack.getMetadata() == 0;
|
return stack.getItem() == Items.golden_apple;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateAITasks() {
|
protected void updateAITasks() {
|
||||||
|
|
|
@ -1393,7 +1393,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
flag = itemsword.getDamageVsEntity() > itemsword1.getDamageVsEntity();
|
flag = itemsword.getDamageVsEntity() > itemsword1.getDamageVsEntity();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
flag = stack.getMetadata() > old.getMetadata() || stack.hasTagCompound() && !old.hasTagCompound();
|
flag = stack.getItemDamage() > old.getItemDamage() || stack.hasTagCompound() && !old.hasTagCompound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(stack.getItem() instanceof ItemBow && old.getItem() instanceof ItemBow) {
|
else if(stack.getItem() instanceof ItemBow && old.getItem() instanceof ItemBow) {
|
||||||
|
@ -1420,7 +1420,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
flag = itemarmor.damageReduceAmount > itemarmor1.damageReduceAmount;
|
flag = itemarmor.damageReduceAmount > itemarmor1.damageReduceAmount;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
flag = stack.getMetadata() > old.getMetadata() || stack.hasTagCompound() && !old.hasTagCompound();
|
flag = stack.getItemDamage() > old.getItemDamage() || stack.hasTagCompound() && !old.hasTagCompound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import common.entity.npc.EntityNPC;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.entity.types.EntityThrowable;
|
import common.entity.types.EntityThrowable;
|
||||||
import common.entity.types.IObjectData;
|
import common.entity.types.IObjectData;
|
||||||
|
import common.init.ItemRegistry;
|
||||||
import common.init.Items;
|
import common.init.Items;
|
||||||
import common.init.SoundEvent;
|
import common.init.SoundEvent;
|
||||||
import common.item.ItemDie;
|
import common.item.ItemDie;
|
||||||
|
@ -125,8 +126,16 @@ public class EntityDie extends EntityThrowable implements IObjectData
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasStackMeta() {
|
||||||
|
for(int z = 0; z < ItemDie.DIE_SIDES.length; z++) {
|
||||||
|
if(this.sides == ItemDie.DIE_SIDES[z])
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
return new ItemStack(Items.die, 1, this.getStackMeta());
|
return new ItemStack(this.hasStackMeta() ? ItemRegistry.getRegisteredItem("die_" + this.sides) : Items.die_6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean interactFirst(EntityNPC player)
|
public boolean interactFirst(EntityNPC player)
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class EntityDynamite extends EntityThrowable implements IObjectData
|
||||||
|
|
||||||
for (int k = 0; k < 8; ++k)
|
for (int k = 0; k < 8; ++k)
|
||||||
{
|
{
|
||||||
this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getIdFromItem(Items.dynamite), this.explosionSize);
|
this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getIdFromItem(ItemRegistry.getRegisteredItem("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.worldObj.client)
|
if (!this.worldObj.client)
|
||||||
|
|
|
@ -74,10 +74,10 @@ public class EntityPotion extends EntityThrowable implements IObjectData
|
||||||
{
|
{
|
||||||
if (this.potionDamage == null)
|
if (this.potionDamage == null)
|
||||||
{
|
{
|
||||||
this.potionDamage = new ItemStack(Items.potion, 1, 0);
|
this.potionDamage = new ItemStack(Items.potion);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.potionDamage.setItemDamage(potionId);
|
this.potionDamage.setMetadata(potionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +87,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData
|
||||||
{
|
{
|
||||||
if (this.potionDamage == null)
|
if (this.potionDamage == null)
|
||||||
{
|
{
|
||||||
this.potionDamage = new ItemStack(Items.potion, 1, 0);
|
this.potionDamage = new ItemStack(Items.potion);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.potionDamage.getMetadata();
|
return this.potionDamage.getMetadata();
|
||||||
|
|
|
@ -13,7 +13,7 @@ public abstract class FishConstants {
|
||||||
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.potion), 10),
|
new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.potion), 10),
|
||||||
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F),
|
new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F),
|
||||||
new RngFishable(new ItemStack(Items.bowl), 10), new RngFishable(new ItemStack(Items.stick), 5),
|
new RngFishable(new ItemStack(Items.bowl), 10), new RngFishable(new ItemStack(Items.stick), 5),
|
||||||
new RngFishable(new ItemStack(Items.dye, 10, DyeColor.BLACK.getDyeDamage()), 1),
|
new RngFishable(new ItemStack(Items.ink_sack, 10), 1),
|
||||||
new RngFishable(new ItemStack(Blocks.tripwire_hook), 10), new RngFishable(new ItemStack(Items.rotten_flesh), 10));
|
new RngFishable(new ItemStack(Blocks.tripwire_hook), 10), new RngFishable(new ItemStack(Items.rotten_flesh), 10));
|
||||||
public static final WeightedList<RngFishable> FISHING_TREASURE = new WeightedList<RngFishable>(
|
public static final WeightedList<RngFishable> FISHING_TREASURE = new WeightedList<RngFishable>(
|
||||||
new RngFishable(new ItemStack(Blocks.waterlily), 1), new RngFishable(new ItemStack(Items.name_tag), 1),
|
new RngFishable(new ItemStack(Blocks.waterlily), 1), new RngFishable(new ItemStack(Items.name_tag), 1),
|
||||||
|
@ -22,8 +22,8 @@ public abstract class FishConstants {
|
||||||
(new RngFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
(new RngFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(),
|
||||||
(new RngFishable(new ItemStack(Items.book), 1)).setEnchantable());
|
(new RngFishable(new ItemStack(Items.book), 1)).setEnchantable());
|
||||||
public static final WeightedList<RngFishable> FISH_TYPES = new WeightedList<RngFishable>(
|
public static final WeightedList<RngFishable> FISH_TYPES = new WeightedList<RngFishable>(
|
||||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 60),
|
new RngFishable(new ItemStack(Items.cod), 60),
|
||||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.SALMON.getMetadata()), 25),
|
new RngFishable(new ItemStack(Items.salmon), 25),
|
||||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.CLOWNFISH.getMetadata()), 2),
|
new RngFishable(new ItemStack(Items.clownfish), 2),
|
||||||
new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.PUFFERFISH.getMetadata()), 13));
|
new RngFishable(new ItemStack(Items.pufferfish), 13));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public abstract class CraftingRegistry
|
||||||
};
|
};
|
||||||
private static final Object[][] COMPRESSED = new Object[][] {
|
private static final Object[][] COMPRESSED = new Object[][] {
|
||||||
{Blocks.emerald_block, new ItemStack(Items.emerald, 9)},
|
{Blocks.emerald_block, new ItemStack(Items.emerald, 9)},
|
||||||
{Blocks.lapis_block, new ItemStack(Items.dye, 9, DyeColor.BLUE.getDyeDamage())},
|
{Blocks.lapis_block, new ItemStack(Items.lapis_lazuli, 9)},
|
||||||
{Blocks.redstone_block, new ItemStack(Items.redstone, 9)},
|
{Blocks.redstone_block, new ItemStack(Items.redstone, 9)},
|
||||||
{Blocks.coal_block, new ItemStack(Items.coal, 9, 0)},
|
{Blocks.coal_block, new ItemStack(Items.coal, 9, 0)},
|
||||||
{Blocks.hay_block, new ItemStack(Items.wheats, 9)},
|
{Blocks.hay_block, new ItemStack(Items.wheats, 9)},
|
||||||
|
@ -291,7 +291,7 @@ public abstract class CraftingRegistry
|
||||||
add(new ItemStack(Items.sugar, 1), "#", '#', Items.reeds);
|
add(new ItemStack(Items.sugar, 1), "#", '#', Items.reeds);
|
||||||
|
|
||||||
add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', Items.coal, '#', Items.stick);
|
add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', Items.coal, '#', Items.stick);
|
||||||
add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', new ItemStack(Items.coal, 1, 1), '#', Items.stick);
|
add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', Items.charcoal, '#', Items.stick);
|
||||||
add(new ItemStack(Items.glass_bottle, 3), "# #", " # ", '#', Blocks.glass);
|
add(new ItemStack(Items.glass_bottle, 3), "# #", " # ", '#', Blocks.glass);
|
||||||
add(new ItemStack(Blocks.rail, 16), "X X", "X#X", "X X", 'X', Items.iron_ingot, '#', Items.stick);
|
add(new ItemStack(Blocks.rail, 16), "X X", "X#X", "X X", 'X', Items.iron_ingot, '#', Items.stick);
|
||||||
add(new ItemStack(Blocks.golden_rail, 6), "X X", "X#X", "XRX", 'X', Items.gold_ingot, 'R', Items.redstone, '#', Items.stick);
|
add(new ItemStack(Blocks.golden_rail, 6), "X X", "X#X", "XRX", 'X', Items.gold_ingot, 'R', Items.redstone, '#', Items.stick);
|
||||||
|
@ -337,7 +337,7 @@ public abstract class CraftingRegistry
|
||||||
add(new ItemStack(Blocks.anvil, 1), "III", " i ", "iii", 'I', Blocks.iron_block, 'i', Items.iron_ingot);
|
add(new ItemStack(Blocks.anvil, 1), "III", " i ", "iii", 'I', Blocks.iron_block, 'i', Items.iron_ingot);
|
||||||
addShapeless(new ItemStack(Items.charged_orb, 1), Items.orb, Items.blaze_powder);
|
addShapeless(new ItemStack(Items.charged_orb, 1), Items.orb, Items.blaze_powder);
|
||||||
addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, Items.coal);
|
addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, Items.coal);
|
||||||
addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, new ItemStack(Items.coal, 1, 1));
|
addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, Items.charcoal);
|
||||||
add(new ItemStack(Blocks.hopper), "I I", "ICI", " I ", 'I', Items.iron_ingot, 'C', Blocks.chest);
|
add(new ItemStack(Blocks.hopper), "I I", "ICI", " I ", 'I', Items.iron_ingot, 'C', Blocks.chest);
|
||||||
|
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ public abstract class CraftingRegistry
|
||||||
}
|
}
|
||||||
else if (recipeComponents[i + 1] instanceof Block)
|
else if (recipeComponents[i + 1] instanceof Block)
|
||||||
{
|
{
|
||||||
itemstack = new ItemStack((Block)recipeComponents[i + 1], 1, 32767);
|
itemstack = new ItemStack((Block)recipeComponents[i + 1]);
|
||||||
}
|
}
|
||||||
else if (recipeComponents[i + 1] instanceof ItemStack)
|
else if (recipeComponents[i + 1] instanceof ItemStack)
|
||||||
{
|
{
|
||||||
|
@ -608,9 +608,9 @@ public abstract class CraftingRegistry
|
||||||
{
|
{
|
||||||
ItemStack itemstack2 = inv.getStackInSlot(j);
|
ItemStack itemstack2 = inv.getStackInSlot(j);
|
||||||
|
|
||||||
if (itemstack2 != null && itemstack2.getItem() == Items.dye)
|
if (itemstack2 != null && itemstack2.getItem() instanceof ItemDye dye)
|
||||||
{
|
{
|
||||||
k = itemstack2.getMetadata();
|
k = dye.getColor().getDyeDamage();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,7 +713,7 @@ public abstract class CraftingRegistry
|
||||||
}
|
}
|
||||||
else if (p_179533_1_.getSizeInventory() == tileentitybanner$enumbannerpattern.getCraftingLayers().length * tileentitybanner$enumbannerpattern.getCraftingLayers()[0].length())
|
else if (p_179533_1_.getSizeInventory() == tileentitybanner$enumbannerpattern.getCraftingLayers().length * tileentitybanner$enumbannerpattern.getCraftingLayers()[0].length())
|
||||||
{
|
{
|
||||||
int j = -1;
|
DyeColor j = null;
|
||||||
|
|
||||||
for (int k = 0; k < p_179533_1_.getSizeInventory() && flag; ++k)
|
for (int k = 0; k < p_179533_1_.getSizeInventory() && flag; ++k)
|
||||||
{
|
{
|
||||||
|
@ -723,13 +723,13 @@ public abstract class CraftingRegistry
|
||||||
|
|
||||||
if (itemstack1 != null && itemstack1.getItem() != Items.banner)
|
if (itemstack1 != null && itemstack1.getItem() != Items.banner)
|
||||||
{
|
{
|
||||||
if (itemstack1.getItem() != Items.dye)
|
if (!(itemstack1.getItem() instanceof ItemDye dye))
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j != -1 && j != itemstack1.getMetadata())
|
if (j != null && j != dye.getColor())
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
break;
|
break;
|
||||||
|
@ -741,7 +741,7 @@ public abstract class CraftingRegistry
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
j = itemstack1.getMetadata();
|
j = dye.getColor();
|
||||||
}
|
}
|
||||||
else if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) != 32)
|
else if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) != 32)
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ public abstract class CraftingRegistry
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int j = TileEntityBanner.getBaseColor(itemstack2);
|
DyeColor j = TileEntityBanner.getBaseColor(itemstack2);
|
||||||
boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0;
|
boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0;
|
||||||
|
|
||||||
if (itemstack != null)
|
if (itemstack != null)
|
||||||
|
@ -1004,9 +1004,9 @@ public abstract class CraftingRegistry
|
||||||
|
|
||||||
if (itemstack2 != null)
|
if (itemstack2 != null)
|
||||||
{
|
{
|
||||||
if (itemstack2.getItem() == Items.dye)
|
if (itemstack2.getItem() instanceof ItemDye dye)
|
||||||
{
|
{
|
||||||
list.add(ItemDye.dyeColors[itemstack2.getMetadata() & 15]);
|
list.add(ItemDye.dyeColors[dye.getColor().getDyeDamage()]);
|
||||||
}
|
}
|
||||||
else if (itemstack2.getItem() == Items.glowstone_dust)
|
else if (itemstack2.getItem() == Items.glowstone_dust)
|
||||||
{
|
{
|
||||||
|
@ -1058,9 +1058,9 @@ public abstract class CraftingRegistry
|
||||||
|
|
||||||
if (itemstack1 != null)
|
if (itemstack1 != null)
|
||||||
{
|
{
|
||||||
if (itemstack1.getItem() == Items.dye)
|
if (itemstack1.getItem() instanceof ItemDye dye)
|
||||||
{
|
{
|
||||||
list1.add(ItemDye.dyeColors[itemstack1.getMetadata() & 15]);
|
list1.add(ItemDye.dyeColors[dye.getColor().getDyeDamage()]);
|
||||||
}
|
}
|
||||||
else if (itemstack1.getItem() == Items.firework_charge)
|
else if (itemstack1.getItem() == Items.firework_charge)
|
||||||
{
|
{
|
||||||
|
@ -1223,7 +1223,9 @@ public abstract class CraftingRegistry
|
||||||
i1 = 0;
|
i1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ItemStack(itemstack2.getItem(), 1, i1);
|
ItemStack stack = new ItemStack(itemstack2.getItem());
|
||||||
|
stack.setItemDamage(i1);
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,12 +1349,12 @@ public abstract class CraftingRegistry
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (itemstack1.getItem() != Items.dye)
|
if (!(itemstack1.getItem() instanceof ItemDye dye))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
float[] afloat = EntitySheep.getDyeRgb(DyeColor.byDyeDamage(itemstack1.getMetadata()));
|
float[] afloat = EntitySheep.getDyeRgb(dye.getColor());
|
||||||
int l1 = (int)(afloat[0] * 255.0F);
|
int l1 = (int)(afloat[0] * 255.0F);
|
||||||
int i2 = (int)(afloat[1] * 255.0F);
|
int i2 = (int)(afloat[1] * 255.0F);
|
||||||
int j2 = (int)(afloat[2] * 255.0F);
|
int j2 = (int)(afloat[2] * 255.0F);
|
||||||
|
@ -1524,11 +1526,6 @@ public abstract class CraftingRegistry
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getMetadata() != 32767 && stack.getMetadata() != ingredient.getMetadata())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1621,7 +1618,7 @@ public abstract class CraftingRegistry
|
||||||
|
|
||||||
for (ItemStack itemstack1 : list)
|
for (ItemStack itemstack1 : list)
|
||||||
{
|
{
|
||||||
if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata()))
|
if (itemstack.getItem() == itemstack1.getItem())
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
list.remove(itemstack1);
|
list.remove(itemstack1);
|
||||||
|
|
|
@ -62,29 +62,33 @@ public abstract class DispenserRegistry {
|
||||||
return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ());
|
return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
REGISTRY.putObject(Items.die, new BehaviorProjectileDispense()
|
for(final int sides : ItemDie.DIE_SIDES) {
|
||||||
{
|
REGISTRY.putObject(ItemRegistry.getRegisteredItem("die_" + sides), new BehaviorProjectileDispense()
|
||||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
{
|
||||||
{
|
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||||
return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(),
|
{
|
||||||
ItemDie.DIE_SIDES[ExtMath.clampi(item.getMetadata(), 0, ItemDie.DIE_SIDES.length - 1)]);
|
return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(), sides);
|
||||||
}
|
}
|
||||||
protected float getInaccuracy()
|
protected float getInaccuracy()
|
||||||
{
|
{
|
||||||
return super.getInaccuracy() * 5.0F;
|
return super.getInaccuracy() * 5.0F;
|
||||||
}
|
}
|
||||||
protected float getVelocity()
|
protected float getVelocity()
|
||||||
{
|
{
|
||||||
return super.getVelocity() * 0.25F;
|
return super.getVelocity() * 0.25F;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
REGISTRY.putObject(Items.dynamite, new BehaviorProjectileDispense()
|
}
|
||||||
{
|
for(int z = 0; z < 8; z++) {
|
||||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
final int power = z;
|
||||||
{
|
REGISTRY.putObject(ItemRegistry.getRegisteredItem("dynamite" + (power == 0 ? "" : "_" + power)), new BehaviorProjectileDispense()
|
||||||
return new EntityDynamite(worldIn, position.getX(), position.getY(), position.getZ(), item.getMetadata());
|
{
|
||||||
}
|
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||||
});
|
{
|
||||||
|
return new EntityDynamite(worldIn, position.getX(), position.getY(), position.getZ(), power);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
REGISTRY.putObject(Items.snowball, new BehaviorProjectileDispense()
|
REGISTRY.putObject(Items.snowball, new BehaviorProjectileDispense()
|
||||||
{
|
{
|
||||||
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item)
|
||||||
|
@ -307,7 +311,7 @@ public abstract class DispenserRegistry {
|
||||||
}
|
}
|
||||||
else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(new ItemStack(item)) < 0)
|
else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(new ItemStack(item)) < 0)
|
||||||
{
|
{
|
||||||
this.field_150840_b.dispense(source, new ItemStack(item, 1, 0));
|
this.field_150840_b.dispense(source, new ItemStack(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
|
@ -315,7 +319,7 @@ public abstract class DispenserRegistry {
|
||||||
});
|
});
|
||||||
REGISTRY.putObject(Items.flint_and_steel, new BehaviorDefaultDispenseItem()
|
REGISTRY.putObject(Items.flint_and_steel, new BehaviorDefaultDispenseItem()
|
||||||
{
|
{
|
||||||
private boolean field_150839_b = true;
|
private boolean success = true;
|
||||||
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||||
{
|
{
|
||||||
World world = source.getWorld();
|
World world = source.getWorld();
|
||||||
|
@ -329,22 +333,24 @@ public abstract class DispenserRegistry {
|
||||||
{
|
{
|
||||||
stack.size = 0;
|
stack.size = 0;
|
||||||
}
|
}
|
||||||
|
this.success = true;
|
||||||
}
|
}
|
||||||
else if (world.getState(blockpos).getBlock() == Blocks.tnt)
|
else if (world.getState(blockpos).getBlock() == Blocks.tnt)
|
||||||
{
|
{
|
||||||
Blocks.tnt.onBlockDestroyedByPlayer(world, blockpos, Blocks.tnt.getState().withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
|
Blocks.tnt.onBlockDestroyedByPlayer(world, blockpos, Blocks.tnt.getState().withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
|
||||||
world.setBlockToAir(blockpos);
|
world.setBlockToAir(blockpos);
|
||||||
|
this.success = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.field_150839_b = false;
|
this.success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
protected void playDispenseSound(IBlockSource source)
|
protected void playDispenseSound(IBlockSource source)
|
||||||
{
|
{
|
||||||
if (this.field_150839_b)
|
if (this.success)
|
||||||
{
|
{
|
||||||
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||||
}
|
}
|
||||||
|
@ -354,59 +360,56 @@ public abstract class DispenserRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
REGISTRY.putObject(Items.dye, new BehaviorDefaultDispenseItem()
|
REGISTRY.putObject(ItemDye.getByColor(DyeColor.WHITE), new BehaviorDefaultDispenseItem()
|
||||||
{
|
|
||||||
private boolean field_150838_b = true;
|
|
||||||
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
|
||||||
{
|
|
||||||
if (DyeColor.WHITE == DyeColor.byDyeDamage(stack.getMetadata()))
|
|
||||||
{
|
|
||||||
World world = source.getWorld();
|
|
||||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
|
||||||
|
|
||||||
if (ItemDye.applyBonemeal(stack, world, blockpos))
|
|
||||||
{
|
|
||||||
if (!world.client)
|
|
||||||
{
|
|
||||||
world.playAuxSFX(2005, blockpos, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.field_150838_b = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return super.dispenseStack(source, stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected void playDispenseSound(IBlockSource source)
|
|
||||||
{
|
|
||||||
if (this.field_150838_b)
|
|
||||||
{
|
|
||||||
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
REGISTRY.putObject(ItemRegistry.getItemFromBlock(Blocks.tnt), new BehaviorDefaultDispenseItem()
|
|
||||||
{
|
{
|
||||||
|
private boolean success = true;
|
||||||
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||||
{
|
{
|
||||||
World world = source.getWorld();
|
World world = source.getWorld();
|
||||||
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||||
EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, stack.getMetadata());
|
|
||||||
world.spawnEntityInWorld(entitytntprimed);
|
if (ItemDye.applyBonemeal(stack, world, blockpos))
|
||||||
world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F);
|
{
|
||||||
--stack.size;
|
if (!world.client)
|
||||||
|
{
|
||||||
|
world.playAuxSFX(2005, blockpos, 0);
|
||||||
|
}
|
||||||
|
this.success = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.success = false;
|
||||||
|
}
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
protected void playDispenseSound(IBlockSource source)
|
||||||
|
{
|
||||||
|
if (this.success)
|
||||||
|
{
|
||||||
|
source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
for(int z = 0; z < 8; z++) {
|
||||||
|
final int power = z;
|
||||||
|
REGISTRY.putObject(ItemRegistry.getRegisteredItem("tnt" + (power == 0 ? "" : "_" + power)), new BehaviorDefaultDispenseItem()
|
||||||
|
{
|
||||||
|
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||||
|
{
|
||||||
|
World world = source.getWorld();
|
||||||
|
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
|
||||||
|
EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, power);
|
||||||
|
world.spawnEntityInWorld(entitytntprimed);
|
||||||
|
world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F);
|
||||||
|
--stack.size;
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ import common.item.ItemCarrotOnAStick;
|
||||||
import common.item.ItemChargedOrb;
|
import common.item.ItemChargedOrb;
|
||||||
import common.item.ItemChest;
|
import common.item.ItemChest;
|
||||||
import common.item.ItemCloth;
|
import common.item.ItemCloth;
|
||||||
import common.item.ItemCoal;
|
|
||||||
import common.item.ItemColored;
|
import common.item.ItemColored;
|
||||||
import common.item.ItemDie;
|
import common.item.ItemDie;
|
||||||
import common.item.ItemDispenser;
|
import common.item.ItemDispenser;
|
||||||
|
@ -156,25 +155,10 @@ public abstract class ItemRegistry {
|
||||||
public static ItemStack getFromIdName(String name, ItemStack def) {
|
public static ItemStack getFromIdName(String name, ItemStack def) {
|
||||||
if(name == null)
|
if(name == null)
|
||||||
return def;
|
return def;
|
||||||
String[] tok = name.split(":");
|
Item item = REGISTRY.getObject(name);
|
||||||
if(tok.length < 1 || tok.length > 2)
|
|
||||||
return def;
|
|
||||||
Item item = REGISTRY.getObject(tok[0]);
|
|
||||||
if(item == null)
|
if(item == null)
|
||||||
return def;
|
return def;
|
||||||
short data = 0;
|
return new ItemStack(item);
|
||||||
if(tok.length == 2) {
|
|
||||||
try {
|
|
||||||
int i = Integer.parseUnsignedInt(tok[1]);
|
|
||||||
if(i >= 32768)
|
|
||||||
return def;
|
|
||||||
data = (short)i;
|
|
||||||
}
|
|
||||||
catch(NumberFormatException e) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new ItemStack(item, 1, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ItemBlock registerFlat(Block block) {
|
private static ItemBlock registerFlat(Block block) {
|
||||||
|
@ -328,7 +312,7 @@ public abstract class ItemRegistry {
|
||||||
}
|
}
|
||||||
})).setDisplay("Bruchsteinmauer"));
|
})).setDisplay("Bruchsteinmauer"));
|
||||||
// registerBlock(Blocks.wooden_button, new ItemButton(Blocks.wooden_button));
|
// registerBlock(Blocks.wooden_button, new ItemButton(Blocks.wooden_button));
|
||||||
registerBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setDisplay("Amboss"));
|
registerBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setDisplay("Amboss")); // ; , new String[] {"Amboss", "Leicht beschädigter Amboss", "Stark beschädigter Amboss"});
|
||||||
registerBlock(Blocks.trapped_chest, new ItemChest(Blocks.trapped_chest));
|
registerBlock(Blocks.trapped_chest, new ItemChest(Blocks.trapped_chest));
|
||||||
registerBlock(Blocks.light_weighted_pressure_plate, new ItemPressurePlate(Blocks.light_weighted_pressure_plate));
|
registerBlock(Blocks.light_weighted_pressure_plate, new ItemPressurePlate(Blocks.light_weighted_pressure_plate));
|
||||||
registerBlock(Blocks.heavy_weighted_pressure_plate, new ItemPressurePlate(Blocks.heavy_weighted_pressure_plate));
|
registerBlock(Blocks.heavy_weighted_pressure_plate, new ItemPressurePlate(Blocks.heavy_weighted_pressure_plate));
|
||||||
|
@ -401,13 +385,13 @@ public abstract class ItemRegistry {
|
||||||
.setColor(TextColor.RED));
|
.setColor(TextColor.RED));
|
||||||
for(EntityInfo egg : EntityRegistry.SPAWN_EGGS.values()) {
|
for(EntityInfo egg : EntityRegistry.SPAWN_EGGS.values()) {
|
||||||
registerItem(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id()))
|
registerItem(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id()))
|
||||||
.setDisplay("Spawner").setMaxStackSize(ItemStack.MAX_SIZE));
|
.setDisplay("Spawner").setMaxAmount(ItemStack.MAX_SIZE));
|
||||||
}
|
}
|
||||||
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
||||||
for(CharacterInfo charinfo : species.chars) {
|
for(CharacterInfo charinfo : species.chars) {
|
||||||
if(charinfo.spawner)
|
if(charinfo.spawner)
|
||||||
registerItem(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner")
|
registerItem(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner")
|
||||||
.setMaxStackSize(ItemStack.MAX_SIZE));
|
.setMaxAmount(ItemStack.MAX_SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,8 +399,8 @@ public abstract class ItemRegistry {
|
||||||
registerItem("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug"));
|
registerItem("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug"));
|
||||||
registerItem("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter"));
|
registerItem("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter"));
|
||||||
registerItem("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.TOOLS));
|
registerItem("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.TOOLS));
|
||||||
registerItem("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxStackSize(128));
|
registerItem("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxAmount(128));
|
||||||
registerItem("die", (new ItemDie()).setDisplay("Würfel").setMaxStackSize(128));
|
registerItem("die", (new ItemDie()).setDisplay("Würfel").setMaxAmount(128));
|
||||||
registerItem("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
|
registerItem("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
|
||||||
registerItem("magnet", (new ItemMagnet(false)).setDisplay("Magnet"));
|
registerItem("magnet", (new ItemMagnet(false)).setDisplay("Magnet"));
|
||||||
registerItem("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS));
|
registerItem("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS));
|
||||||
|
@ -428,23 +412,24 @@ public abstract class ItemRegistry {
|
||||||
registerItem("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug"));
|
registerItem("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug"));
|
||||||
registerItem("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele"));
|
registerItem("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele"));
|
||||||
registerItem("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug"));
|
registerItem("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug"));
|
||||||
registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxStackSize(128));
|
registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(128));
|
||||||
registerItem("bow", (new ItemBow()).setDisplay("Bogen"));
|
registerItem("bow", (new ItemBow()).setDisplay("Bogen"));
|
||||||
registerItem("boltgun", (new ItemBoltgun()).setDisplay("Bolter"));
|
registerItem("boltgun", (new ItemBoltgun()).setDisplay("Bolter"));
|
||||||
registerItem("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition"));
|
registerItem("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition"));
|
||||||
registerItem("arrow", (new Item()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxStackSize(128));
|
registerItem("arrow", (new Item()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxAmount(128));
|
||||||
Item coal = (new ItemCoal()).setDisplay("Kohle");
|
Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS);
|
||||||
registerItem("coal", coal);
|
registerItem("coal", coal);
|
||||||
registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
registerItem("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS));
|
||||||
|
registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
|
registerItem("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
|
||||||
registerItem("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
|
registerItem("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
|
||||||
registerItem((new ItemSmallBlock(Blocks.string)).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxStackSize(1024));
|
registerItem((new ItemSmallBlock(Blocks.string)).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(1024));
|
||||||
registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxStackSize(512));
|
registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(512));
|
||||||
registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem((new ItemSeeds(Blocks.wheat, Blocks.farmland)).setDisplay("Weizenkörner").setMaxStackSize(256));
|
registerItem((new ItemSeeds(Blocks.wheat, Blocks.farmland)).setDisplay("Weizenkörner").setMaxAmount(256));
|
||||||
registerItem("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
registerItem("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(128));
|
||||||
registerItem("bread", (new ItemFood(5, false)).setDisplay("Brot"));
|
registerItem("bread", (new ItemFood(5, false)).setDisplay("Brot"));
|
||||||
registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(128));
|
||||||
registerItem("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
|
registerItem("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
|
||||||
registerItem("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch"));
|
registerItem("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch"));
|
||||||
registerItem("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
|
registerItem("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
|
||||||
|
@ -455,52 +440,52 @@ public abstract class ItemRegistry {
|
||||||
// registerItem("lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(bucket));
|
// registerItem("lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(bucket));
|
||||||
registerItem("saddle", (new ItemSaddle()).setDisplay("Sattel"));
|
registerItem("saddle", (new ItemSaddle()).setDisplay("Sattel"));
|
||||||
// registerItem("iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron"));
|
// registerItem("iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron"));
|
||||||
registerItem((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxStackSize(256));
|
registerItem((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(256));
|
||||||
registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxStackSize(128));
|
registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128));
|
||||||
registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS));
|
registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS));
|
||||||
registerItem("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS));
|
registerItem("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS));
|
||||||
registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(128));
|
||||||
registerItem((new ItemSmallBlock(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxStackSize(128));
|
registerItem((new ItemSmallBlock(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(128));
|
||||||
registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC));
|
registerItem("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC));
|
||||||
registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128));
|
||||||
registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxStackSize(128));
|
registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128));
|
||||||
registerItem("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS));
|
registerItem("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS));
|
||||||
registerItem("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer").setTab(CheatTab.TOOLS));
|
registerItem("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer").setTab(CheatTab.TOOLS));
|
||||||
registerItem("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
|
registerItem("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
|
||||||
registerItem("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
|
registerItem("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
|
||||||
.setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
.setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem("fish", (new ItemFishFood(false)).setDisplay("Fisch").setHasSubtypes(true));
|
registerItem("fish", (new ItemFishFood(false)).setDisplay("Fisch"));
|
||||||
registerItem("cooked_fish", (new ItemFishFood(true)).setDisplay("Fisch").setHasSubtypes(true));
|
registerItem("cooked_fish", (new ItemFishFood(true)).setDisplay("Fisch"));
|
||||||
Item dye = (new ItemDye()).setDisplay("Farbstoff").setMaxStackSize(512);
|
Item dye = (new ItemDye()).setDisplay("Farbstoff").setMaxAmount(512);
|
||||||
registerItem("dye", dye);
|
registerItem("dye", dye);
|
||||||
registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128));
|
||||||
registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(512));
|
registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512));
|
||||||
registerItem((new ItemSmallBlock(Blocks.cake)).setMaxStackSize(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
registerItem((new ItemSmallBlock(Blocks.cake)).setMaxAmount(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||||
registerItem((new ItemSmallBlock(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.TECHNOLOGY));
|
registerItem((new ItemSmallBlock(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.TECHNOLOGY));
|
||||||
registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxStackSize(128));
|
registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(128));
|
||||||
registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone"));
|
registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone"));
|
||||||
registerItem((new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setDisplay("Kürbiskerne").setMaxStackSize(256));
|
registerItem((new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setDisplay("Kürbiskerne").setMaxAmount(256));
|
||||||
registerItem((new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setDisplay("Melonenkerne").setMaxStackSize(256));
|
registerItem((new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setDisplay("Melonenkerne").setMaxAmount(256));
|
||||||
registerItem("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch"));
|
registerItem("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch"));
|
||||||
registerItem("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak"));
|
registerItem("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak"));
|
||||||
registerItem("chicken", (new ItemFood(2, true)).setDisplay("Rohes Hühnchen"));
|
registerItem("chicken", (new ItemFood(2, true)).setDisplay("Rohes Hühnchen"));
|
||||||
registerItem("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
|
registerItem("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
|
||||||
registerItem("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
|
registerItem("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
|
||||||
registerItem("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.TOOLS));
|
registerItem("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.TOOLS));
|
||||||
registerItem("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
registerItem("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem("ghast_tear", (new ItemTiny()).setDisplay("Ghastträne").setPotionEffect(PotionHelper.ghastTearEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
registerItem("ghast_tear", (new ItemTiny()).setDisplay("Ghastträne").setPotionEffect(PotionHelper.ghastTearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxStackSize(256));
|
registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256));
|
||||||
registerItem((new ItemSeeds(Blocks.soul_wart, Blocks.soul_sand)).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxStackSize(128));
|
registerItem((new ItemSeeds(Blocks.soul_wart, Blocks.soul_sand)).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(128));
|
||||||
registerItem("potion", (new ItemPotion()).setDisplay("Trank"));
|
registerItem("potion", (new ItemPotion()).setDisplay("Trank"));
|
||||||
registerItem("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
|
registerItem("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
|
||||||
registerItem("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
|
registerItem("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
|
||||||
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxStackSize(128));
|
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(128));
|
||||||
registerItem("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge")
|
registerItem("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge")
|
||||||
.setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxStackSize(128));
|
.setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(128));
|
||||||
registerItem("blaze_powder", (new Item()).setDisplay("Lohenstaub").setPotionEffect(PotionHelper.blazePowderEffect)
|
registerItem("blaze_powder", (new Item()).setDisplay("Lohenstaub").setPotionEffect(PotionHelper.blazePowderEffect)
|
||||||
.setTab(CheatTab.MATERIALS).setMaxStackSize(256));
|
.setTab(CheatTab.MATERIALS).setMaxAmount(256));
|
||||||
registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(128));
|
registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128));
|
||||||
registerItem((new ItemSmallBlock(Blocks.brewing_stand)).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
|
registerItem((new ItemSmallBlock(Blocks.brewing_stand)).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
|
||||||
registerItem((new ItemSmallBlock(Blocks.cauldron)).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
|
registerItem((new ItemSmallBlock(Blocks.cauldron)).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
|
||||||
registerItem("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
|
registerItem("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
|
||||||
|
@ -513,10 +498,10 @@ public abstract class ItemRegistry {
|
||||||
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS);
|
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS);
|
||||||
registerItem("emerald", emerald);
|
registerItem("emerald", emerald);
|
||||||
registerItem((new ItemSmallBlock(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION));
|
registerItem((new ItemSmallBlock(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION));
|
||||||
registerItem((new ItemSeedFood(3, Blocks.carrot, Blocks.farmland)).setDisplay("Karotte").setMaxStackSize(128));
|
registerItem((new ItemSeedFood(3, Blocks.carrot, Blocks.farmland)).setDisplay("Karotte").setMaxAmount(128));
|
||||||
registerItem((new ItemSeedFood(1, Blocks.potato, Blocks.farmland)).setDisplay("Kartoffel").setMaxStackSize(128));
|
registerItem((new ItemSeedFood(1, Blocks.potato, Blocks.farmland)).setDisplay("Kartoffel").setMaxAmount(128));
|
||||||
registerItem("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxStackSize(128));
|
registerItem("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(128));
|
||||||
registerItem("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxStackSize(128));
|
registerItem("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(128));
|
||||||
registerItem("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
|
registerItem("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
|
||||||
.setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.MISC));
|
.setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.MISC));
|
||||||
registerItem((new ItemSmallBlock(Blocks.skull)).setDisplay("Schädel").setTab(CheatTab.DECORATION));
|
registerItem((new ItemSmallBlock(Blocks.skull)).setDisplay("Schädel").setTab(CheatTab.DECORATION));
|
||||||
|
@ -525,7 +510,7 @@ public abstract class ItemRegistry {
|
||||||
registerItem("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.MISC));
|
registerItem("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.MISC));
|
||||||
registerItem("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete"));
|
registerItem("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete"));
|
||||||
registerItem("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS));
|
registerItem("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS));
|
||||||
registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC));
|
registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC));
|
||||||
registerItem((new ItemSmallBlock(Blocks.comparator)).setDisplay("Redstone-Komparator").setTab(CheatTab.TECHNOLOGY));
|
registerItem((new ItemSmallBlock(Blocks.comparator)).setDisplay("Redstone-Komparator").setTab(CheatTab.TECHNOLOGY));
|
||||||
registerItem("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
|
registerItem("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
|
||||||
registerItem("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS));
|
registerItem("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS));
|
||||||
|
@ -533,7 +518,7 @@ public abstract class ItemRegistry {
|
||||||
registerItem("quartz", quartz);
|
registerItem("quartz", quartz);
|
||||||
Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS);
|
Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS);
|
||||||
registerItem("black_quartz", bquartz);
|
registerItem("black_quartz", bquartz);
|
||||||
registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxStackSize(128));
|
registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(128));
|
||||||
registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild"));
|
registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild"));
|
||||||
registerItem((new ItemBanner()).setDisplay("Banner"));
|
registerItem((new ItemBanner()).setDisplay("Banner"));
|
||||||
// registerItem("spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce"));
|
// registerItem("spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce"));
|
||||||
|
@ -541,7 +526,9 @@ public abstract class ItemRegistry {
|
||||||
// registerItem("jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle"));
|
// registerItem("jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle"));
|
||||||
// registerItem("acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia"));
|
// registerItem("acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia"));
|
||||||
// registerItem("dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak"));
|
// registerItem("dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak"));
|
||||||
registerItem("dynamite", (new ItemDynamite()).setDisplay("Dynamit").setColor(TextColor.RED));
|
for(int z = 0; z < 8; z++) {
|
||||||
|
registerItem("dynamite", (new ItemDynamite(z)).setDisplay("Dynamit").setColor(TextColor.RED));
|
||||||
|
}
|
||||||
// registerItem("cherry_door", (new ItemDoor(Blocks.cherry_door)).setUnlocalizedName("doorCherry"));
|
// registerItem("cherry_door", (new ItemDoor(Blocks.cherry_door)).setUnlocalizedName("doorCherry"));
|
||||||
// registerItem("maple_door", (new ItemDoor(Blocks.maple_door)).setUnlocalizedName("doorMaple"));
|
// registerItem("maple_door", (new ItemDoor(Blocks.maple_door)).setUnlocalizedName("doorMaple"));
|
||||||
registerItem("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.MATERIALS));
|
registerItem("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.MATERIALS));
|
||||||
|
@ -591,7 +578,7 @@ public abstract class ItemRegistry {
|
||||||
registerItem(new ItemDoor(door)); // .setDisplay(door.getDisplay()));
|
registerItem(new ItemDoor(door)); // .setDisplay(door.getDisplay()));
|
||||||
}
|
}
|
||||||
for(DyeColor color : BlockBed.COLORS) {
|
for(DyeColor color : BlockBed.COLORS) {
|
||||||
registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxStackSize(1).setDisplay(color.getSubject(0) + " Bett"));
|
registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxAmount(1).setDisplay(color.getSubject(0) + " Bett"));
|
||||||
}
|
}
|
||||||
|
|
||||||
registerItem("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee"));
|
registerItem("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee"));
|
||||||
|
@ -611,7 +598,7 @@ public abstract class ItemRegistry {
|
||||||
|
|
||||||
((BlockOre)BlockRegistry.getRegisteredBlock("coal_ore")).setDropItem(new ItemStack(coal), 0);
|
((BlockOre)BlockRegistry.getRegisteredBlock("coal_ore")).setDropItem(new ItemStack(coal), 0);
|
||||||
((BlockOre)BlockRegistry.getRegisteredBlock("emerald_ore")).setDropItem(new ItemStack(emerald), 3);
|
((BlockOre)BlockRegistry.getRegisteredBlock("emerald_ore")).setDropItem(new ItemStack(emerald), 3);
|
||||||
((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(dye, 4, DyeColor.BLUE.getDyeDamage()), 4, 2);
|
((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(lapis, 4), 4, 2);
|
||||||
((BlockOre)BlockRegistry.getRegisteredBlock("quartz_ore")).setDropItem(new ItemStack(quartz), 2);
|
((BlockOre)BlockRegistry.getRegisteredBlock("quartz_ore")).setDropItem(new ItemStack(quartz), 2);
|
||||||
((BlockOre)BlockRegistry.getRegisteredBlock("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3);
|
((BlockOre)BlockRegistry.getRegisteredBlock("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3);
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,8 @@ public abstract class Items {
|
||||||
public static final ItemArmor cloth_chestplate = get("cloth_chestplate");
|
public static final ItemArmor cloth_chestplate = get("cloth_chestplate");
|
||||||
public static final ItemArmor cloth_helmet = get("cloth_helmet");
|
public static final ItemArmor cloth_helmet = get("cloth_helmet");
|
||||||
public static final ItemArmor cloth_leggings = get("cloth_leggings");
|
public static final ItemArmor cloth_leggings = get("cloth_leggings");
|
||||||
public static final ItemCoal coal = get("coal");
|
public static final Item coal = get("coal");
|
||||||
|
public static final Item charcoal = get("charcoal");
|
||||||
public static final ItemBlock coal_block = get("coal_block");
|
public static final ItemBlock coal_block = get("coal_block");
|
||||||
public static final ItemBlock coal_ore = get("coal_ore");
|
public static final ItemBlock coal_ore = get("coal_ore");
|
||||||
public static final ItemMetalBlock cobalt_block = get("cobalt_block");
|
public static final ItemMetalBlock cobalt_block = get("cobalt_block");
|
||||||
|
|
|
@ -20,7 +20,7 @@ public abstract class SmeltingRegistry
|
||||||
|
|
||||||
private static boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
private static boolean compareItemStacks(ItemStack stack1, ItemStack stack2)
|
||||||
{
|
{
|
||||||
return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata());
|
return stack2.getItem() == stack1.getItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void register()
|
static void register()
|
||||||
|
@ -35,10 +35,10 @@ public abstract class SmeltingRegistry
|
||||||
// addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F);
|
// addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F);
|
||||||
// addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F);
|
// addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F);
|
||||||
add(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F);
|
add(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F);
|
||||||
add(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 0.1F);
|
add(new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stonebrick_cracked), 0.1F);
|
||||||
add(Items.clay_ball, new ItemStack(Items.brick), 0.3F);
|
add(Items.clay_ball, new ItemStack(Items.brick), 0.3F);
|
||||||
add(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F);
|
add(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F);
|
||||||
add(Blocks.cactus, new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage()), 0.2F);
|
add(Blocks.cactus, new ItemStack(Items.cactus_green), 0.2F);
|
||||||
add(Items.potato, new ItemStack(Items.baked_potato), 0.35F);
|
add(Items.potato, new ItemStack(Items.baked_potato), 0.35F);
|
||||||
add(Blocks.hellrock, new ItemStack(Items.bloodbrick), 0.1F);
|
add(Blocks.hellrock, new ItemStack(Items.bloodbrick), 0.1F);
|
||||||
// add(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F);
|
// add(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F);
|
||||||
|
@ -53,7 +53,7 @@ public abstract class SmeltingRegistry
|
||||||
|
|
||||||
add(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F);
|
add(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F);
|
||||||
add(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F);
|
add(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F);
|
||||||
add(Blocks.lapis_ore, new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), 0.2F);
|
add(Blocks.lapis_ore, new ItemStack(Items.lapis_lazuli), 0.2F);
|
||||||
add(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F);
|
add(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F);
|
||||||
add(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F);
|
add(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public abstract class SmeltingRegistry
|
||||||
add(BlockRegistry.getRegisteredBlock(metal.name + "_ore"), new ItemStack(item), 0.7F);
|
add(BlockRegistry.getRegisteredBlock(metal.name + "_ore"), new ItemStack(item), 0.7F);
|
||||||
}
|
}
|
||||||
for(WoodType wood : WoodType.values()) {
|
for(WoodType wood : WoodType.values()) {
|
||||||
add(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), new ItemStack(Items.coal, 1, 1), 0.15F);
|
add(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), new ItemStack(Items.charcoal), 0.15F);
|
||||||
// add(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F);
|
// add(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public abstract class SmeltingRegistry
|
||||||
|
|
||||||
private static void add(Item input, ItemStack stack, float experience)
|
private static void add(Item input, ItemStack stack, float experience)
|
||||||
{
|
{
|
||||||
add(new ItemStack(input, 1, 32767), stack, experience);
|
add(new ItemStack(input), stack, experience);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void add(ItemStack input, ItemStack stack, float experience)
|
private static void add(ItemStack input, ItemStack stack, float experience)
|
||||||
|
|
|
@ -142,7 +142,7 @@ public abstract class TradeRegistry {
|
||||||
i = this.price.getPrice(random);
|
i = this.price.getPrice(random);
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i, 0), Items.emerald));
|
recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i), Items.emerald));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,8 +172,8 @@ public abstract class TradeRegistry {
|
||||||
j = this.field_179408_d.getPrice(random);
|
j = this.field_179408_d.getPrice(random);
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i, this.buyingItemStack.getMetadata()),
|
recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i),
|
||||||
new ItemStack(Items.emerald), new ItemStack(this.sellingItemstack.getItem(), j, this.sellingItemstack.getMetadata())));
|
new ItemStack(Items.emerald), new ItemStack(this.sellingItemstack.getItem(), j)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ public abstract class TradeRegistry {
|
||||||
i = this.priceInfo.getPrice(random);
|
i = this.priceInfo.getPrice(random);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack itemstack = new ItemStack(Items.emerald, i, 0);
|
ItemStack itemstack = new ItemStack(Items.emerald, i);
|
||||||
ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem(), 1, this.enchantedItemStack.getMetadata());
|
ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem());
|
||||||
itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, random.range(5, 19));
|
itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, random.range(5, 19));
|
||||||
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
|
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
|
||||||
}
|
}
|
||||||
|
@ -240,12 +240,12 @@ public abstract class TradeRegistry {
|
||||||
ItemStack itemstack1;
|
ItemStack itemstack1;
|
||||||
|
|
||||||
if(i < 0) {
|
if(i < 0) {
|
||||||
itemstack = new ItemStack(Items.emerald, 1, 0);
|
itemstack = new ItemStack(Items.emerald);
|
||||||
itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i, this.itemToBuy.getMetadata());
|
itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemstack = new ItemStack(Items.emerald, i, 0);
|
itemstack = new ItemStack(Items.emerald, i);
|
||||||
itemstack1 = new ItemStack(this.itemToBuy.getItem(), 1, this.itemToBuy.getMetadata());
|
itemstack1 = new ItemStack(this.itemToBuy.getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
|
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
|
||||||
|
|
|
@ -327,7 +327,7 @@ public abstract class Container
|
||||||
}
|
}
|
||||||
else if (slot7.isItemValid(itemstack10))
|
else if (slot7.isItemValid(itemstack10))
|
||||||
{
|
{
|
||||||
if (itemstack9.getItem() == itemstack10.getItem() && itemstack9.getMetadata() == itemstack10.getMetadata() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10))
|
if (itemstack9.getItem() == itemstack10.getItem() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10))
|
||||||
{
|
{
|
||||||
int i2 = clickedButton == 0 ? itemstack10.size : 1;
|
int i2 = clickedButton == 0 ? itemstack10.size : 1;
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ public abstract class Container
|
||||||
inventoryplayer.setItemStack(itemstack9);
|
inventoryplayer.setItemStack(itemstack9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && (!itemstack9.getHasSubtypes() || itemstack9.getMetadata() == itemstack10.getMetadata()) && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10))
|
else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10))
|
||||||
{
|
{
|
||||||
int l1 = itemstack9.size;
|
int l1 = itemstack9.size;
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ public abstract class Container
|
||||||
Slot slot = (Slot)this.inventorySlots.get(i);
|
Slot slot = (Slot)this.inventorySlots.get(i);
|
||||||
ItemStack itemstack = slot.getStack();
|
ItemStack itemstack = slot.getStack();
|
||||||
|
|
||||||
if (itemstack != null && itemstack.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getMetadata() == itemstack.getMetadata()) && ItemStack.areItemStackTagsEqual(stack, itemstack))
|
if (itemstack != null && itemstack.getItem() == stack.getItem() && ItemStack.areItemStackTagsEqual(stack, itemstack))
|
||||||
{
|
{
|
||||||
int j = itemstack.size + stack.size;
|
int j = itemstack.size + stack.size;
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ public class ContainerEnchantment extends Container
|
||||||
}
|
}
|
||||||
else if (itemstack1.size >= 1)
|
else if (itemstack1.size >= 1)
|
||||||
{
|
{
|
||||||
((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata()));
|
((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem()));
|
||||||
--itemstack1.size;
|
--itemstack1.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ public class ContainerRepair extends Container
|
||||||
damage = 0;
|
damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage < newStack.getMetadata())
|
if (damage < newStack.getItemDamage())
|
||||||
{
|
{
|
||||||
newStack.setItemDamage(damage);
|
newStack.setItemDamage(damage);
|
||||||
totalCost += 2;
|
totalCost += 2;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class InventoryHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.size -= i;
|
stack.size -= i;
|
||||||
EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i, stack.getMetadata()));
|
EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i));
|
||||||
|
|
||||||
if (stack.hasTagCompound())
|
if (stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,19 +65,6 @@ public class InventoryPlayer implements IInventory
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getInventorySlotContainItemAndDamage(Item itemIn, int metadataIn)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < this.mainInventory.length; ++i)
|
|
||||||
{
|
|
||||||
if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemIn && this.mainInventory[i].getMetadata() == metadataIn)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stores an itemstack in the users inventory
|
* stores an itemstack in the users inventory
|
||||||
*/
|
*/
|
||||||
|
@ -85,7 +72,7 @@ public class InventoryPlayer implements IInventory
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.mainInventory.length; ++i)
|
for (int i = 0; i < this.mainInventory.length; ++i)
|
||||||
{
|
{
|
||||||
if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].size < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].size < this.getInventoryStackLimit() && (!this.mainInventory[i].getHasSubtypes() || this.mainInventory[i].getMetadata() == itemStackIn.getMetadata()) && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn))
|
if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].size < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].size < this.getInventoryStackLimit() && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn))
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -110,10 +97,10 @@ public class InventoryPlayer implements IInventory
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setCurrentItem(Item itemIn, int metadataIn, boolean isMetaSpecific) // , boolean p_146030_4_)
|
public boolean setCurrentItem(Item itemIn) // , boolean p_146030_4_)
|
||||||
{
|
{
|
||||||
// ItemStack itemstack = this.getCurrentItem();
|
// ItemStack itemstack = this.getCurrentItem();
|
||||||
int i = isMetaSpecific ? this.getInventorySlotContainItemAndDamage(itemIn, metadataIn) : this.getInventorySlotContainItem(itemIn);
|
int i = this.getInventorySlotContainItem(itemIn);
|
||||||
|
|
||||||
if (i >= 0 && i < 9)
|
if (i >= 0 && i < 9)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +199,7 @@ public class InventoryPlayer implements IInventory
|
||||||
{
|
{
|
||||||
if (this.mainInventory[j] == null)
|
if (this.mainInventory[j] == null)
|
||||||
{
|
{
|
||||||
this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata());
|
this.mainInventory[j] = new ItemStack(item, 0);
|
||||||
|
|
||||||
if (itemStackIn.hasTagCompound())
|
if (itemStackIn.hasTagCompound())
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,35 +26,25 @@ import common.world.World;
|
||||||
|
|
||||||
public class Item
|
public class Item
|
||||||
{
|
{
|
||||||
protected static final Random itemRand = new Random();
|
private int maxAmount = 64;
|
||||||
|
private int maxDamage = 0;
|
||||||
protected int maxStackSize = 64;
|
|
||||||
private int maxDamage;
|
|
||||||
protected boolean hasSubtypes;
|
|
||||||
private Item containerItem;
|
private Item containerItem;
|
||||||
private String potionEffect;
|
private String potionEffect;
|
||||||
private String display;
|
private String display;
|
||||||
private CheatTab tabToDisplayOn;
|
private CheatTab tab;
|
||||||
private TextColor color = null;
|
private TextColor color = null;
|
||||||
|
|
||||||
public Item setMaxStackSize(int maxStackSize)
|
public final Item setMaxAmount(int max)
|
||||||
{
|
{
|
||||||
this.maxStackSize = maxStackSize;
|
this.maxAmount = max;
|
||||||
|
this.maxDamage = 0;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item setHasSubtypes(boolean hasSubtypes)
|
public final Item setMaxDamage(int max)
|
||||||
{
|
{
|
||||||
this.hasSubtypes = hasSubtypes;
|
this.maxAmount = 1;
|
||||||
return this;
|
this.maxDamage = max;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* set max damage of an Item
|
|
||||||
*/
|
|
||||||
public Item setMaxDamage(int maxDamageIn)
|
|
||||||
{
|
|
||||||
this.maxDamage = maxDamageIn;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,27 +54,21 @@ public class Item
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item setContainerItem(Item containerItem)
|
public final Item setContainerItem(Item containerItem)
|
||||||
{
|
{
|
||||||
this.containerItem = containerItem;
|
this.containerItem = containerItem;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public final Item setPotionEffect(String potionEffect)
|
||||||
* Sets the string representing this item's effect on a potion when used as an ingredient.
|
|
||||||
*/
|
|
||||||
public Item setPotionEffect(String potionEffect)
|
|
||||||
{
|
{
|
||||||
this.potionEffect = potionEffect;
|
this.potionEffect = potionEffect;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public final Item setTab(CheatTab tab)
|
||||||
* returns this;
|
|
||||||
*/
|
|
||||||
public Item setTab(CheatTab tab)
|
|
||||||
{
|
{
|
||||||
this.tabToDisplayOn = tab;
|
this.tab = tab;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +77,22 @@ public class Item
|
||||||
this.color = color;
|
this.color = color;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final int getItemStackLimit()
|
||||||
|
{
|
||||||
|
return this.maxAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final int getMaxDamage()
|
||||||
|
{
|
||||||
|
return this.maxDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isDamageable()
|
||||||
|
{
|
||||||
|
return this.maxDamage > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Block getBlock()
|
public Block getBlock()
|
||||||
|
@ -101,17 +100,6 @@ public class Item
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data
|
|
||||||
*/
|
|
||||||
public boolean updateItemStackNBT(TagObject nbt)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a Block is right-clicked with this Item
|
|
||||||
*/
|
|
||||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -126,105 +114,41 @@ public class Item
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
|
||||||
*/
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||||
{
|
{
|
||||||
return itemStackIn;
|
return itemStackIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
|
|
||||||
* the Item before the action is complete.
|
|
||||||
*/
|
|
||||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||||
{
|
{
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int getMetadata()
|
||||||
* Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?*
|
|
||||||
*/
|
|
||||||
public int getItemStackLimit()
|
|
||||||
{
|
|
||||||
return this.maxStackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHasSubtypes()
|
|
||||||
{
|
|
||||||
return this.hasSubtypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the maximum damage an item can take.
|
|
||||||
*/
|
|
||||||
public int getMaxDamage()
|
|
||||||
{
|
|
||||||
return this.maxDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDamageable()
|
|
||||||
{
|
|
||||||
return this.maxDamage > 0 && !this.hasSubtypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
|
|
||||||
* the damage on the stack.
|
|
||||||
*/
|
|
||||||
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker)
|
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
|
|
||||||
*/
|
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn)
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether this Item can harvest the given Block
|
|
||||||
*/
|
|
||||||
public boolean canHarvestBlock(Block blockIn)
|
public boolean canHarvestBlock(Block blockIn)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
|
|
||||||
*/
|
|
||||||
public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target)
|
public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getUnlocalizedNameInefficiently(ItemStack stack)
|
|
||||||
// {
|
|
||||||
// String s = this.getUnlocalizedName(stack);
|
|
||||||
// return s == null ? "" : s; // I18n.translate(s);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Returns the unlocalized name of this item.
|
|
||||||
// */
|
|
||||||
// public String getUnlocalizedName()
|
|
||||||
// {
|
|
||||||
// return "item." + this.unlocalizedName;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
return this.display;
|
return this.display;
|
||||||
|
@ -235,9 +159,6 @@ public class Item
|
||||||
return this.containerItem;
|
return this.containerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* True if this Item has a container item (a.k.a. crafting result)
|
|
||||||
*/
|
|
||||||
public boolean hasContainerItem()
|
public boolean hasContainerItem()
|
||||||
{
|
{
|
||||||
return this.containerItem != null;
|
return this.containerItem != null;
|
||||||
|
@ -248,24 +169,6 @@ public class Item
|
||||||
return 16777215;
|
return 16777215;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
|
|
||||||
// * update it's contents.
|
|
||||||
// */
|
|
||||||
// public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Called when item is crafted/smelted. Used only by maps so far.
|
|
||||||
// */
|
|
||||||
// public void onCreated(ItemStack stack, World worldIn, EntityNPC playerIn)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the action that specifies what animation to play when the items is being used
|
|
||||||
*/
|
|
||||||
public ItemAction getItemUseAction(ItemStack stack)
|
public ItemAction getItemUseAction(ItemStack stack)
|
||||||
{
|
{
|
||||||
return ItemAction.NONE;
|
return ItemAction.NONE;
|
||||||
|
@ -276,17 +179,11 @@ public class Item
|
||||||
return ItemAction.NONE;
|
return ItemAction.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* How long it takes to use or consume an item
|
|
||||||
*/
|
|
||||||
public int getMaxItemUseDuration(ItemStack stack)
|
public int getMaxItemUseDuration(ItemStack stack)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the player stops using an Item (stops holding the right mouse button).
|
|
||||||
*/
|
|
||||||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft)
|
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -301,18 +198,10 @@ public class Item
|
||||||
return this.getPotionEffect(stack) != null;
|
return this.getPotionEffect(stack) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* allows items to add custom lines of information to the mouseover description
|
|
||||||
*/
|
|
||||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getItemStackDisplayName(ItemStack stack)
|
|
||||||
// {
|
|
||||||
// return this.getUnlocalizedName(stack);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean hasEffect(ItemStack stack)
|
public boolean hasEffect(ItemStack stack)
|
||||||
{
|
{
|
||||||
return stack.isItemEnchanted();
|
return stack.isItemEnchanted();
|
||||||
|
@ -323,9 +212,6 @@ public class Item
|
||||||
return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE);
|
return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks isDamagable and if it cannot be stacked
|
|
||||||
*/
|
|
||||||
public boolean isItemTool(ItemStack stack)
|
public boolean isItemTool(ItemStack stack)
|
||||||
{
|
{
|
||||||
return this.getItemStackLimit() == 1 && this.isDamageable();
|
return this.getItemStackLimit() == 1 && this.isDamageable();
|
||||||
|
@ -350,38 +236,21 @@ public class Item
|
||||||
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
|
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the enchantability factor of the item, most of the time is based on material.
|
|
||||||
*/
|
|
||||||
public int getItemEnchantability()
|
public int getItemEnchantability()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
|
||||||
*/
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
||||||
{
|
{
|
||||||
subItems.add(new ItemStack(itemIn, 1, 0));
|
subItems.add(new ItemStack(itemIn, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the tab this item is displayed on
|
|
||||||
*/
|
|
||||||
public CheatTab getTab()
|
public CheatTab getTab()
|
||||||
{
|
{
|
||||||
return this.tabToDisplayOn;
|
return this.tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean canItemEditBlocks()
|
|
||||||
// {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether this item is repairable in an anvil.
|
|
||||||
*/
|
|
||||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -395,235 +264,13 @@ public class Item
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean canBeDyed() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean isFragile() {
|
public boolean isFragile() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean isValidMeta(int meta) {
|
|
||||||
// return true; // meta == 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public int getDefaultMeta() {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public final Set<String> getValidTags() {
|
public final Set<String> getValidTags() {
|
||||||
return Sets.newHashSet();
|
return Sets.newHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static final Set<String> VALID_TAGS = Sets.newHashSet("Name", "ench", "RepairCost");
|
|
||||||
|
|
||||||
protected final boolean validateNbt(TagObject tag) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private final boolean isValidNbt(ItemStack stack) {
|
|
||||||
// if(!stack.hasTagCompound()) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// NBTTagCompound tag = stack.getTagCompound();
|
|
||||||
// if(tag.hasNoTags()) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// Set<String> keys = tag.getKeySet();
|
|
||||||
// int z = keys.size();
|
|
||||||
// boolean validate = false;
|
|
||||||
// if(z > 0) {
|
|
||||||
// for(String v : VALID_TAGS) {
|
|
||||||
// if(keys.contains(v)) {
|
|
||||||
// z--;
|
|
||||||
// if(z == 0) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//// if(adv && z > 0) {
|
|
||||||
////// for(String v : ADV_TAGS) {
|
|
||||||
//// if(keys.contains("Unbreakable")) {
|
|
||||||
//// z--;
|
|
||||||
////// if(z == 0) {
|
|
||||||
////// break;
|
|
||||||
////// }
|
|
||||||
//// }
|
|
||||||
////// }
|
|
||||||
//// }
|
|
||||||
// if(z > 0) {
|
|
||||||
// for(String v : this.getValidTags()) {
|
|
||||||
// if(keys.contains(v)) {
|
|
||||||
// validate = true;
|
|
||||||
// z--;
|
|
||||||
// if(z == 0) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if(z > 0) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//// if(tag.hasKey("display")) {
|
|
||||||
//// if(!tag.hasTag("display")) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// NBTTagCompound display = tag.getCompoundTag("display");
|
|
||||||
//// keys = display.getKeySet();
|
|
||||||
//// z = keys.size();
|
|
||||||
// if(tag.hasKey("Name")) {
|
|
||||||
// if(!tag.hasString("Name")) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if(tag.getString("Name").length() > 64) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//// z--;
|
|
||||||
// }
|
|
||||||
//// if(display.hasKey("Lore")) {
|
|
||||||
//// if(!adv) {
|
|
||||||
//// display.removeTag("Lore");
|
|
||||||
//// if(display.hasNoTags()) {
|
|
||||||
//// tag.removeTag("display");
|
|
||||||
//// if(tag.hasNoTags()) {
|
|
||||||
//// stack.setTagCompound(null);
|
|
||||||
//// return true;
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// else {
|
|
||||||
//// if(!display.hasList("Lore")) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// NBTTagList lore = display.getTagList("Lore", 8);
|
|
||||||
//// if(lore.hasNoTags()) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// z--;
|
|
||||||
//// }
|
|
||||||
//// if(display.hasKey("color")) {
|
|
||||||
//// if(!display.hasInt("color")) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// if(!this.canBeDyed()) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// z--;
|
|
||||||
//// }
|
|
||||||
//// if(z > 0) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// if(tag.hasKey("RepairCost")) {
|
|
||||||
// if(!tag.hasInt("RepairCost")) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if(tag.getInteger("RepairCost") < 1) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if(tag.hasKey("ench")) {
|
|
||||||
// if(!tag.hasList("ench")) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// NBTTagList ench = tag.getTagList("ench", 10);
|
|
||||||
// if(ench.hasNoTags()) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if(ench.tagCount() > Enchantment.getNames().size()) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// Enchantment[] ecn = new Enchantment[ench.tagCount()];
|
|
||||||
// for(int e = 0; e < ench.tagCount(); e++) {
|
|
||||||
// NBTTagCompound ec = ench.getCompoundTagAt(e);
|
|
||||||
// if(ec.getKeySet().size() != 2 || !ec.hasShort("id") || !ec.hasShort("lvl")) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// int id = ec.getShort("id");
|
|
||||||
// int lvl = ec.getShort("lvl");
|
|
||||||
// Enchantment en = Enchantment.getEnchantmentById(id);
|
|
||||||
// if(en == null) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//// if(!adv && (lvl < en.getMinLevel() || lvl > en.getMaxLevel())) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// if(!adv && !en.canApply(stack)) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
// ecn[e] = en;
|
|
||||||
// }
|
|
||||||
// for(int e = 0; e < ecn.length; e++) {
|
|
||||||
// for(int f = 0; f < ecn.length; f++) {
|
|
||||||
// if(f != e && ecn[e] == ecn[f]) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//// if(adv) {
|
|
||||||
//// if(tag.hasKey("Unbreakable")) {
|
|
||||||
//// if(!tag.hasBoolean("Unbreakable")) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// if(tag.hasKey("HideFlags")) {
|
|
||||||
//// if(!tag.hasInt("HideFlags")) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// if(validate) {
|
|
||||||
// if(this.validateNbt(stack.getTagCompound())) {
|
|
||||||
// if(tag.hasNoTags()) {
|
|
||||||
// stack.setTagCompound(null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// boolean validate(ItemStack stack) {
|
|
||||||
//// if(!bypass && this.isSpecialItem()) {
|
|
||||||
//// return false;
|
|
||||||
//// }
|
|
||||||
// boolean flag = true;
|
|
||||||
// if(this.isDamageable() && (stack.getItemDamage() < 0 || (stack.getItemDamage() > this.getMaxDamage()))) {
|
|
||||||
// stack.setItemDamage(0);
|
|
||||||
// flag = false;
|
|
||||||
// }
|
|
||||||
// if(stack.stackSize > stack.getMaxStackSize()) {
|
|
||||||
// stack.stackSize = stack.getMaxStackSize();
|
|
||||||
// flag = false;
|
|
||||||
// }
|
|
||||||
// else if(stack.stackSize < 1) {
|
|
||||||
// stack.stackSize = 1;
|
|
||||||
// flag = false;
|
|
||||||
// }
|
|
||||||
// if(!this.isValidNbt(stack)) {
|
|
||||||
// stack.setTagCompound(null);
|
|
||||||
// flag = false;
|
|
||||||
// }
|
|
||||||
// return flag;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public boolean canBreakBlocks() {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean canUseInAir() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public boolean ignoresBlocks() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public float getRadiation(ItemStack stack) {
|
public float getRadiation(ItemStack stack) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
@ -649,7 +296,7 @@ public class Item
|
||||||
return Transforms.ITEM;
|
return Transforms.ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), name);
|
return provider.getModel(this.getTransform(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ public class ItemAmmo extends ItemMagnetic {
|
||||||
private final float explosion;
|
private final float explosion;
|
||||||
|
|
||||||
public ItemAmmo(int damage, float explosion, int stack) {
|
public ItemAmmo(int damage, float explosion, int stack) {
|
||||||
this.maxStackSize = stack;
|
this.setMaxAmount(stack);
|
||||||
this.setTab(CheatTab.COMBAT);
|
this.setTab(CheatTab.COMBAT);
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
this.explosion = explosion;
|
this.explosion = explosion;
|
||||||
|
|
|
@ -4,18 +4,14 @@ import common.block.Block;
|
||||||
|
|
||||||
public class ItemAnvilBlock extends ItemMultiTexture
|
public class ItemAnvilBlock extends ItemMultiTexture
|
||||||
{
|
{
|
||||||
public ItemAnvilBlock(Block block)
|
public ItemAnvilBlock(Block block, int data)
|
||||||
{
|
{
|
||||||
super(block, block, new String[] {"Amboss", "Leicht beschädigter Amboss", "Stark beschädigter Amboss"});
|
super(block, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int getMetadata()
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
{
|
||||||
return damage << 2;
|
return this.data << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMagnetic() {
|
public boolean isMagnetic() {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package common.item;
|
package common.item;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import common.color.TextColor;
|
import common.color.TextColor;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.potion.Potion;
|
import common.potion.Potion;
|
||||||
|
@ -10,24 +8,18 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemAppleGold extends ItemFood
|
public class ItemAppleGold extends ItemFood
|
||||||
{
|
{
|
||||||
public ItemAppleGold(int amount, boolean isWolfFood)
|
private final boolean powered;
|
||||||
|
|
||||||
|
public ItemAppleGold(int amount, boolean powered)
|
||||||
{
|
{
|
||||||
super(amount, isWolfFood);
|
super(amount, false);
|
||||||
this.setHasSubtypes(true);
|
this.powered = powered;
|
||||||
this.setColor(TextColor.NEON);
|
this.setColor(powered ? TextColor.MAGENTA : TextColor.NEON);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEffect(ItemStack stack)
|
public boolean hasEffect(ItemStack stack)
|
||||||
{
|
{
|
||||||
return stack.getMetadata() > 0;
|
return this.powered;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return an item rarity from EnumRarity
|
|
||||||
*/
|
|
||||||
public TextColor getColor(ItemStack stack)
|
|
||||||
{
|
|
||||||
return stack.getMetadata() == 0 ? super.getColor(stack) : TextColor.MAGENTA;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
||||||
|
@ -37,7 +29,7 @@ public class ItemAppleGold extends ItemFood
|
||||||
player.addEffect(new PotionEffect(Potion.ABSORPTION, 2400, 0));
|
player.addEffect(new PotionEffect(Potion.ABSORPTION, 2400, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getMetadata() > 0)
|
if (this.powered)
|
||||||
{
|
{
|
||||||
if (!worldIn.client)
|
if (!worldIn.client)
|
||||||
{
|
{
|
||||||
|
@ -51,13 +43,4 @@ public class ItemAppleGold extends ItemFood
|
||||||
super.onFoodEaten(stack, worldIn, player);
|
super.onFoodEaten(stack, worldIn, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
|
||||||
*/
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, 0));
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,6 @@ public class ItemArmor extends Item
|
||||||
// this.renderIndex = renderIndex;
|
// this.renderIndex = renderIndex;
|
||||||
this.damageReduceAmount = material.getDamageReduction(armorType);
|
this.damageReduceAmount = material.getDamageReduction(armorType);
|
||||||
this.setMaxDamage(material.getDurability(armorType));
|
this.setMaxDamage(material.getDurability(armorType));
|
||||||
this.maxStackSize = 1;
|
|
||||||
this.setTab(CheatTab.COMBAT);
|
this.setTab(CheatTab.COMBAT);
|
||||||
DispenserRegistry.REGISTRY.putObject(this, dispenserBehavior);
|
DispenserRegistry.REGISTRY.putObject(this, dispenserBehavior);
|
||||||
}
|
}
|
||||||
|
@ -272,11 +271,11 @@ public class ItemArmor extends Item
|
||||||
super.getTransform());
|
super.getTransform());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
if(this.material.canBeDyed())
|
if(this.material.canBeDyed())
|
||||||
return provider.getModel(this.getTransform(), name, name + "_overlay");
|
return provider.getModel(this.getTransform(), name, name + "_overlay");
|
||||||
else
|
else
|
||||||
return super.getModel(provider, name, meta);
|
return super.getModel(provider, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
|
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
|
||||||
|
|
|
@ -24,8 +24,6 @@ public class ItemBanner extends ItemBlock
|
||||||
{
|
{
|
||||||
super(Blocks.banner);
|
super(Blocks.banner);
|
||||||
this.setTab(CheatTab.DECORATION);
|
this.setTab(CheatTab.DECORATION);
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +138,7 @@ public class ItemBanner extends ItemBlock
|
||||||
TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), null);
|
TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), null);
|
||||||
TagObject nbttagcompound1 = new TagObject();
|
TagObject nbttagcompound1 = new TagObject();
|
||||||
nbttagcompound1.setObject("BlockEntityTag", nbttagcompound);
|
nbttagcompound1.setObject("BlockEntityTag", nbttagcompound);
|
||||||
ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage());
|
ItemStack itemstack = new ItemStack(itemIn);
|
||||||
itemstack.setTagCompound(nbttagcompound1);
|
itemstack.setTagCompound(nbttagcompound1);
|
||||||
subItems.add(itemstack);
|
subItems.add(itemstack);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +163,7 @@ public class ItemBanner extends ItemBlock
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata());
|
enumdyecolor = DyeColor.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return enumdyecolor;
|
return enumdyecolor;
|
||||||
|
@ -213,7 +211,7 @@ public class ItemBanner extends ItemBlock
|
||||||
subItems.add(new ItemStack(itemIn, 1, 0));
|
subItems.add(new ItemStack(itemIn, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,6 @@ public class ItemBlock extends Item
|
||||||
this(block, null);
|
this(block, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item."
|
|
||||||
*/
|
|
||||||
public ItemBlock setDisplay(String unlocalizedName)
|
public ItemBlock setDisplay(String unlocalizedName)
|
||||||
{
|
{
|
||||||
super.setDisplay(unlocalizedName);
|
super.setDisplay(unlocalizedName);
|
||||||
|
@ -72,7 +69,7 @@ public class ItemBlock extends Item
|
||||||
}
|
}
|
||||||
else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack))
|
else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack))
|
||||||
{
|
{
|
||||||
int i = this.getMetadata(stack.getMetadata());
|
int i = this.getMetadata();
|
||||||
State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn);
|
State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn);
|
||||||
|
|
||||||
if (worldIn.setState(pos, iblockstate1, 3))
|
if (worldIn.setState(pos, iblockstate1, 3))
|
||||||
|
@ -215,11 +212,11 @@ public class ItemBlock extends Item
|
||||||
return this.flatTexture != null ? super.getTransform() : this.block.getTransform();
|
return this.flatTexture != null ? super.getTransform() : this.block.getTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture :
|
return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture :
|
||||||
this.block.getModel(provider,
|
this.block.getModel(provider,
|
||||||
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata(meta))).getPrimary() /* "blocks/" + name */) :
|
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata())).getPrimary() /* "blocks/" + name */) :
|
||||||
provider.getModel(this.block.getModel(provider,
|
provider.getModel(this.block.getModel(provider,
|
||||||
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata(meta))), this.getTransform());
|
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata())), this.getTransform());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class ItemBoat extends Item
|
||||||
{
|
{
|
||||||
public ItemBoat()
|
public ItemBoat()
|
||||||
{
|
{
|
||||||
this.maxStackSize = 1;
|
this.setMaxAmount(1);
|
||||||
this.setTab(CheatTab.SPAWNERS);
|
this.setTab(CheatTab.SPAWNERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ public class ItemBow extends Item
|
||||||
{
|
{
|
||||||
public ItemBow()
|
public ItemBow()
|
||||||
{
|
{
|
||||||
this.maxStackSize = 1;
|
|
||||||
this.setMaxDamage(384);
|
this.setMaxDamage(384);
|
||||||
this.setTab(CheatTab.COMBAT);
|
this.setTab(CheatTab.COMBAT);
|
||||||
}
|
}
|
||||||
|
@ -149,8 +148,8 @@ public class ItemBow extends Item
|
||||||
return Transforms.RANGED;
|
return Transforms.RANGED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), meta == 0 ? "bow" : ("bow_pulling_" + (meta - 1)));
|
return provider.getModel(this.getTransform(), data == 0 ? "bow" : ("bow_pulling_" + (data - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBeWielded() {
|
public boolean canBeWielded() {
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class ItemBucket extends Item
|
||||||
|
|
||||||
public ItemBucket(BlockDynamicLiquid liquid, boolean recursive)
|
public ItemBucket(BlockDynamicLiquid liquid, boolean recursive)
|
||||||
{
|
{
|
||||||
this.maxStackSize = liquid == null ? 16 : 1;
|
this.setMaxAmount(liquid == null ? 16 : 1);
|
||||||
this.liquid = liquid;
|
this.liquid = liquid;
|
||||||
this.recursive = recursive;
|
this.recursive = recursive;
|
||||||
this.setTab(liquid == null ? CheatTab.TOOLS : CheatTab.LIQUIDS);
|
this.setTab(liquid == null ? CheatTab.TOOLS : CheatTab.LIQUIDS);
|
||||||
|
@ -178,7 +178,7 @@ public class ItemBucket extends Item
|
||||||
return this.fillBucket(itemStackIn, playerIn, new ItemStack(
|
return this.fillBucket(itemStackIn, playerIn, new ItemStack(
|
||||||
ItemRegistry.getRegisteredItem(BlockRegistry.getNameFromBlock(block instanceof BlockDynamicLiquid
|
ItemRegistry.getRegisteredItem(BlockRegistry.getNameFromBlock(block instanceof BlockDynamicLiquid
|
||||||
? FluidRegistry.getStaticBlock((BlockDynamicLiquid)block) : block) +
|
? FluidRegistry.getStaticBlock((BlockDynamicLiquid)block) : block) +
|
||||||
"_bucket"), 1, 0));
|
"_bucket")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,8 +316,8 @@ public class ItemBucket extends Item
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return this.recursive ? provider.getModel(this.getTransform(), name.substring("recursive_".length())) : super.getModel(provider, name, meta);
|
return this.recursive ? provider.getModel(this.getTransform(), name.substring("recursive_".length())) : super.getModel(provider, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ItemMeshDefinition getMesher() {
|
// public ItemMeshDefinition getMesher() {
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class ItemBucketMilk extends Item
|
||||||
{
|
{
|
||||||
public ItemBucketMilk()
|
public ItemBucketMilk()
|
||||||
{
|
{
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class ItemButton extends ItemBlock {
|
||||||
this.button = block;
|
this.button = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getModel(this.button.getTexture()).add(5, 6, 6, 11, 10, 10)
|
return provider.getModel(provider.getModel(this.button.getTexture()).add(5, 6, 6, 11, 10, 10)
|
||||||
.d().uv(5, 6, 11, 10).noCull().u().uv(5, 10, 11, 6).noCull()
|
.d().uv(5, 6, 11, 10).noCull().u().uv(5, 10, 11, 6).noCull()
|
||||||
.ns().uv(5, 12, 11, 16).noCull().we().uv(6, 12, 10, 16).noCull(), this.getTransform());
|
.ns().uv(5, 12, 11, 16).noCull().we().uv(6, 12, 10, 16).noCull(), this.getTransform());
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemCamera extends ItemMagnetic {
|
public class ItemCamera extends ItemMagnetic {
|
||||||
public ItemCamera() {
|
public ItemCamera() {
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) {
|
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ public class ItemCarrotOnAStick extends Item
|
||||||
public ItemCarrotOnAStick()
|
public ItemCarrotOnAStick()
|
||||||
{
|
{
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
this.setMaxStackSize(1);
|
|
||||||
this.setMaxDamage(25);
|
this.setMaxDamage(25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ public class ItemCarrotOnAStick extends Item
|
||||||
{
|
{
|
||||||
EntityPig entitypig = (EntityPig)playerIn.vehicle;
|
EntityPig entitypig = (EntityPig)playerIn.vehicle;
|
||||||
|
|
||||||
if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 7)
|
if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getItemDamage() >= 7)
|
||||||
{
|
{
|
||||||
entitypig.getAIControlledByPlayer().boostSpeed();
|
entitypig.getAIControlledByPlayer().boostSpeed();
|
||||||
itemStackIn.damageItem(7, playerIn);
|
itemStackIn.damageItem(7, playerIn);
|
||||||
|
|
|
@ -17,7 +17,6 @@ public class ItemChargedOrb extends ItemFragile
|
||||||
{
|
{
|
||||||
public ItemChargedOrb()
|
public ItemChargedOrb()
|
||||||
{
|
{
|
||||||
this.maxStackSize = 1;
|
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
this.setMaxDamage(16);
|
this.setMaxDamage(16);
|
||||||
this.setColor(TextColor.DMAGENTA);
|
this.setColor(TextColor.DMAGENTA);
|
||||||
|
@ -61,9 +60,9 @@ public class ItemChargedOrb extends ItemFragile
|
||||||
|
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
{
|
{
|
||||||
double d0 = (double)((float)pos.getX() + (5.0F + itemRand.floatv() * 6.0F) / 16.0F);
|
double d0 = (double)((float)pos.getX() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F);
|
||||||
double d1 = (double)((float)pos.getY() + 0.8125F);
|
double d1 = (double)((float)pos.getY() + 0.8125F);
|
||||||
double d2 = (double)((float)pos.getZ() + (5.0F + itemRand.floatv() * 6.0F) / 16.0F);
|
double d2 = (double)((float)pos.getZ() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F);
|
||||||
double d3 = 0.0D;
|
double d3 = 0.0D;
|
||||||
double d4 = 0.0D;
|
double d4 = 0.0D;
|
||||||
double d5 = 0.0D;
|
double d5 = 0.0D;
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class ItemChest extends ItemBlock {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,40 +8,32 @@ import common.model.ModelProvider;
|
||||||
public class ItemCloth extends ItemBlock
|
public class ItemCloth extends ItemBlock
|
||||||
{
|
{
|
||||||
private final Integer display;
|
private final Integer display;
|
||||||
|
private final DyeColor color;
|
||||||
|
|
||||||
public ItemCloth(Block block, Integer display, String flatTexture)
|
public ItemCloth(Block block, Integer display, String flatTexture, DyeColor color)
|
||||||
{
|
{
|
||||||
super(block, flatTexture);
|
super(block, flatTexture);
|
||||||
this.setMaxDamage(0);
|
this.color = color;
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.display = display;
|
this.display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemCloth(Block block, Integer display)
|
public ItemCloth(Block block, Integer display, DyeColor color)
|
||||||
{
|
{
|
||||||
this(block, display, null);
|
this(block, display, null, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int getMetadata()
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
{
|
||||||
return damage;
|
return this.color.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
* different names based on their damage or NBT.
|
|
||||||
*/
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
return DyeColor.byMetadata(stack.getMetadata()).getSubject(this.display) + " " + super.getDisplay(stack);
|
return this.color.getSubject(this.display) + " " + super.getDisplay(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return this.flatTexture != null ? provider.getModel(this.getTransform(), "blocks/" + DyeColor.byMetadata(meta).getName() + "_" +
|
return this.flatTexture != null ? provider.getModel(this.getTransform(), "blocks/" + this.color.getName() + "_" +
|
||||||
this.flatTexture) : super.getModel(provider, name, meta);
|
this.flatTexture) : super.getModel(provider, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
package common.item;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import common.model.Model;
|
|
||||||
import common.model.ModelProvider;
|
|
||||||
|
|
||||||
public class ItemCoal extends Item
|
|
||||||
{
|
|
||||||
public ItemCoal()
|
|
||||||
{
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setTab(CheatTab.METALS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
* different names based on their damage or NBT.
|
|
||||||
*/
|
|
||||||
public String getDisplay(ItemStack stack)
|
|
||||||
{
|
|
||||||
return stack.getMetadata() == 1 ? "Holzkohle" : super.getDisplay(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
|
||||||
*/
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, 0));
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
|
||||||
return provider.getModel(this.getTransform(), meta == 1 ? "charcoal" : "coal");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,59 +5,27 @@ import common.block.Block;
|
||||||
public class ItemColored extends ItemBlock
|
public class ItemColored extends ItemBlock
|
||||||
{
|
{
|
||||||
private final Block coloredBlock;
|
private final Block coloredBlock;
|
||||||
private String[] subtypeNames;
|
private final int data;
|
||||||
|
|
||||||
public ItemColored(Block block, boolean hasSubtypes, String flatTexture)
|
public ItemColored(Block block, String flatTexture, int data)
|
||||||
{
|
{
|
||||||
super(block, flatTexture);
|
super(block, flatTexture);
|
||||||
this.coloredBlock = block;
|
this.coloredBlock = block;
|
||||||
|
this.data = data;
|
||||||
if (hasSubtypes)
|
|
||||||
{
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemColored(Block block, boolean hasSubtypes)
|
public ItemColored(Block block, int data)
|
||||||
{
|
{
|
||||||
this(block, hasSubtypes, null);
|
this(block, null, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||||
{
|
{
|
||||||
return this.coloredBlock.getRenderColor(this.coloredBlock.getStateFromMeta(stack.getMetadata()));
|
return this.coloredBlock.getRenderColor(this.coloredBlock.getStateFromMeta(this.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int getMetadata()
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
{
|
||||||
return damage;
|
return this.data;
|
||||||
}
|
|
||||||
|
|
||||||
public ItemColored setSubtypeNames(String[] names)
|
|
||||||
{
|
|
||||||
this.subtypeNames = names;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
* different names based on their damage or NBT.
|
|
||||||
*/
|
|
||||||
public String getDisplay(ItemStack stack)
|
|
||||||
{
|
|
||||||
if (this.subtypeNames == null)
|
|
||||||
{
|
|
||||||
return super.getDisplay(stack);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i = stack.getMetadata();
|
|
||||||
return i >= 0 && i < this.subtypeNames.length ? this.subtypeNames[i] : super.getDisplay(stack);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package common.item;
|
package common.item;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import common.color.TextColor;
|
import common.color.TextColor;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.entity.projectile.EntityDie;
|
import common.entity.projectile.EntityDie;
|
||||||
|
@ -9,7 +7,6 @@ import common.init.SoundEvent;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.ModelProvider;
|
import common.model.ModelProvider;
|
||||||
import common.model.Transforms;
|
import common.model.Transforms;
|
||||||
import common.util.ExtMath;
|
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class ItemDie extends Item
|
public class ItemDie extends Item
|
||||||
|
@ -18,11 +15,12 @@ public class ItemDie extends Item
|
||||||
public static final TextColor[] DIE_COLORS = new TextColor[] {TextColor.DGREEN, TextColor.NEON, TextColor.DMAGENTA,
|
public static final TextColor[] DIE_COLORS = new TextColor[] {TextColor.DGREEN, TextColor.NEON, TextColor.DMAGENTA,
|
||||||
TextColor.MAGENTA, TextColor.DRED, TextColor.ORANGE};
|
TextColor.MAGENTA, TextColor.DRED, TextColor.ORANGE};
|
||||||
|
|
||||||
public ItemDie()
|
private final int sides;
|
||||||
|
|
||||||
|
public ItemDie(int sides)
|
||||||
{
|
{
|
||||||
|
this.sides = sides;
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||||
|
@ -36,32 +34,24 @@ public class ItemDie extends Item
|
||||||
|
|
||||||
if (!worldIn.client)
|
if (!worldIn.client)
|
||||||
{
|
{
|
||||||
worldIn.spawnEntityInWorld(new EntityDie(worldIn, playerIn, DIE_SIDES[ExtMath.clampi(itemStackIn.getMetadata(),
|
worldIn.spawnEntityInWorld(new EntityDie(worldIn, playerIn, this.sides, false)); // playerIn.creative));
|
||||||
0, DIE_SIDES.length - 1)], false)); // playerIn.creative));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||||
return itemStackIn;
|
return itemStackIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
|
||||||
{
|
|
||||||
for(int z = 0; z < DIE_SIDES.length; z++) {
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, z));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
return super.getDisplay(stack) + " W" + DIE_SIDES[ExtMath.clampi(stack.getMetadata(), 0, DIE_SIDES.length - 1)];
|
return super.getDisplay(stack) + " W" + this.sides;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transforms getTransform() {
|
public Transforms getTransform() {
|
||||||
return Transforms.DICE;
|
return Transforms.DICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getModel("items/die_d" + DIE_SIDES[meta] + "_side").add().nswe()
|
return provider.getModel(provider.getModel("items/die_d" + this.sides + "_side").add().nswe()
|
||||||
.du("items/die_d" + DIE_SIDES[meta] + "_top"), this.getTransform());
|
.du("items/die_d" + this.sides + "_top"), this.getTransform());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ public class ItemDispenser extends ItemBlock {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata(int damage) {
|
public int getMetadata() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package common.item;
|
package common.item;
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.block.foliage.BlockDoublePlant;
|
import common.block.foliage.BlockDoublePlant;
|
||||||
import common.block.foliage.BlockDoublePlant.EnumPlantType;
|
import common.block.foliage.BlockDoublePlant.EnumPlantType;
|
||||||
|
@ -11,20 +9,20 @@ import common.model.ModelProvider;
|
||||||
|
|
||||||
public class ItemDoublePlant extends ItemMultiTexture
|
public class ItemDoublePlant extends ItemMultiTexture
|
||||||
{
|
{
|
||||||
public ItemDoublePlant(Block block, Block block2, Function<ItemStack, String> nameFunction)
|
public ItemDoublePlant(Block block, int data)
|
||||||
{
|
{
|
||||||
super(block, block2, true, nameFunction);
|
super(block, true, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||||
{
|
{
|
||||||
BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.byMetadata(stack.getMetadata());
|
BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.byMetadata(this.data);
|
||||||
return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D);
|
return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "blocks/" + (
|
return provider.getModel(this.getTransform(), "blocks/" + (
|
||||||
BlockDoublePlant.EnumPlantType.byMetadata(meta) == EnumPlantType.SUNFLOWER ? "sunflower_front" :
|
BlockDoublePlant.EnumPlantType.byMetadata(this.data) == EnumPlantType.SUNFLOWER ? "sunflower_front" :
|
||||||
BlockDoublePlant.EnumPlantType.byMetadata(meta).getName() + "_top"));
|
BlockDoublePlant.EnumPlantType.byMetadata(this.data).getName() + "_top"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package common.item;
|
package common.item;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.block.artificial.BlockBed;
|
import common.block.artificial.BlockBed;
|
||||||
import common.block.foliage.IGrowable;
|
import common.block.foliage.IGrowable;
|
||||||
|
@ -25,22 +23,28 @@ import common.world.AWorldServer;
|
||||||
public class ItemDye extends Item
|
public class ItemDye extends Item
|
||||||
{
|
{
|
||||||
public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
|
public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
|
||||||
|
private static final ItemDye[] DIES = new ItemDye[DyeColor.values().length];
|
||||||
public ItemDye()
|
|
||||||
{
|
private final DyeColor color;
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
public static ItemDye getByColor(DyeColor color) {
|
||||||
this.setTab(CheatTab.MATERIALS);
|
return DIES[color.getMetadata()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemDye(DyeColor color)
|
||||||
|
{
|
||||||
|
this.color = color;
|
||||||
|
this.setTab(CheatTab.MATERIALS);
|
||||||
|
DIES[this.color.getMetadata()] = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DyeColor getColor() {
|
||||||
|
return this.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
* different names based on their damage or NBT.
|
|
||||||
*/
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
int i = stack.getMetadata();
|
return this.color.getDye();
|
||||||
return DyeColor.byDyeDamage(i).getDye();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,9 +58,7 @@ public class ItemDye extends Item
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DyeColor enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata());
|
if (this.color == DyeColor.WHITE)
|
||||||
|
|
||||||
if (enumdyecolor == DyeColor.WHITE)
|
|
||||||
{
|
{
|
||||||
if (applyBonemeal(stack, worldIn, pos))
|
if (applyBonemeal(stack, worldIn, pos))
|
||||||
{
|
{
|
||||||
|
@ -68,7 +70,7 @@ public class ItemDye extends Item
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (enumdyecolor == DyeColor.BROWN)
|
else if (this.color == DyeColor.BROWN)
|
||||||
{
|
{
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
@ -103,7 +105,7 @@ public class ItemDye extends Item
|
||||||
}
|
}
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
if(iblockstate.getBlock() instanceof BlockBed) {
|
if(iblockstate.getBlock() instanceof BlockBed) {
|
||||||
Block bedBlock = BlockRegistry.getRegisteredBlock(enumdyecolor.getName() + "_bed");
|
Block bedBlock = BlockRegistry.getRegisteredBlock(this.color.getName() + "_bed");
|
||||||
if(bedBlock != Blocks.air) {
|
if(bedBlock != Blocks.air) {
|
||||||
if (iblockstate.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT)
|
if (iblockstate.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT)
|
||||||
{
|
{
|
||||||
|
@ -134,7 +136,7 @@ public class ItemDye extends Item
|
||||||
else if(iblockstate.getBlock() == Blocks.beacon) {
|
else if(iblockstate.getBlock() == Blocks.beacon) {
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if(te instanceof TileEntityBeacon) {
|
if(te instanceof TileEntityBeacon) {
|
||||||
((TileEntityBeacon)te).setBeamColor(enumdyecolor);
|
((TileEntityBeacon)te).setBeamColor(this.color);
|
||||||
// if(!playerIn.creative)
|
// if(!playerIn.creative)
|
||||||
--stack.size;
|
--stack.size;
|
||||||
}
|
}
|
||||||
|
@ -186,10 +188,10 @@ public class ItemDye extends Item
|
||||||
|
|
||||||
for (int i = 0; i < amount; ++i)
|
for (int i = 0; i < amount; ++i)
|
||||||
{
|
{
|
||||||
double d0 = itemRand.gaussian() * 0.02D;
|
double d0 = worldIn.rand.gaussian() * 0.02D;
|
||||||
double d1 = itemRand.gaussian() * 0.02D;
|
double d1 = worldIn.rand.gaussian() * 0.02D;
|
||||||
double d2 = itemRand.gaussian() * 0.02D;
|
double d2 = worldIn.rand.gaussian() * 0.02D;
|
||||||
worldIn.spawnParticle(ParticleType.GROW, (double)((float)pos.getX() + itemRand.floatv()), (double)pos.getY() + (double)itemRand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.floatv()), d0, d1, d2);
|
worldIn.spawnParticle(ParticleType.GROW, (double)((float)pos.getX() + worldIn.rand.floatv()), (double)pos.getY() + (double)worldIn.rand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + worldIn.rand.floatv()), d0, d1, d2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,11 +204,10 @@ public class ItemDye extends Item
|
||||||
if (target instanceof EntitySheep)
|
if (target instanceof EntitySheep)
|
||||||
{
|
{
|
||||||
EntitySheep entitysheep = (EntitySheep)target;
|
EntitySheep entitysheep = (EntitySheep)target;
|
||||||
DyeColor enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata());
|
|
||||||
|
|
||||||
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
|
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != this.color)
|
||||||
{
|
{
|
||||||
entitysheep.setFleeceColor(enumdyecolor);
|
entitysheep.setFleeceColor(this.color);
|
||||||
--stack.size;
|
--stack.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,18 +219,7 @@ public class ItemDye extends Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
return provider.getModel(this.getTransform(), "dye_" + this.color.getName());
|
||||||
*/
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 16; ++i)
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
|
||||||
return provider.getModel(this.getTransform(), "dye_" + DyeColor.byDyeDamage(meta).getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@ public class ItemDynamite extends Item
|
||||||
{
|
{
|
||||||
private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII"};
|
private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII"};
|
||||||
|
|
||||||
public ItemDynamite()
|
private final int power;
|
||||||
|
|
||||||
|
public ItemDynamite(int power)
|
||||||
{
|
{
|
||||||
this.maxStackSize = 32;
|
this.power = power;
|
||||||
|
this.setMaxAmount(32);
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,27 +36,19 @@ public class ItemDynamite extends Item
|
||||||
|
|
||||||
if (!worldIn.client)
|
if (!worldIn.client)
|
||||||
{
|
{
|
||||||
worldIn.spawnEntityInWorld(new EntityDynamite(worldIn, playerIn, itemStackIn.getMetadata()));
|
worldIn.spawnEntityInWorld(new EntityDynamite(worldIn, playerIn, this.power));
|
||||||
}
|
}
|
||||||
|
|
||||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||||
return itemStackIn;
|
return itemStackIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
|
||||||
{
|
|
||||||
for(int z = 0; z < 8; z++) {
|
|
||||||
subItems.add(new ItemStack(itemIn, 1, z));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
int exp = stack.getMetadata() & 7;
|
return super.getDisplay(stack) + (this.power == 0 ? "" : " " + TIERS[this.power-1]);
|
||||||
return super.getDisplay(stack) + (exp == 0 ? "" : " " + TIERS[exp-1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "dynamite" + (meta == 0 ? "" : ("_" + meta)));
|
return provider.getModel(this.getTransform(), "dynamite" + (this.power == 0 ? "" : ("_" + this.power)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemEditWand extends Item {
|
public class ItemEditWand extends Item {
|
||||||
public ItemEditWand() {
|
public ItemEditWand() {
|
||||||
this.maxStackSize = 1;
|
this.setMaxAmount(1);
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class ItemEnchantedBook extends Item
|
||||||
|
|
||||||
public RngLoot getRandom(Random rand, int minChance, int maxChance, int weight)
|
public RngLoot getRandom(Random rand, int minChance, int maxChance, int weight)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = new ItemStack(Items.book, 1, 0);
|
ItemStack itemstack = new ItemStack(Items.book);
|
||||||
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30);
|
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30);
|
||||||
return new RngLoot(itemstack, minChance, maxChance, weight);
|
return new RngLoot(itemstack, minChance, maxChance, weight);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import common.world.AWorldServer;
|
||||||
|
|
||||||
public class ItemExterminator extends ItemMagnetic {
|
public class ItemExterminator extends ItemMagnetic {
|
||||||
public ItemExterminator() {
|
public ItemExterminator() {
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
this.setColor(TextColor.DRED);
|
this.setColor(TextColor.DRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class ItemFence extends ItemBlock {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getModel(((BlockFence)this.block).getTexture())
|
return provider.getModel(provider.getModel(((BlockFence)this.block).getTexture())
|
||||||
.add(6, 0, 0, 10, 16, 4)
|
.add(6, 0, 0, 10, 16, 4)
|
||||||
.d().uv(6, 0, 10, 4)
|
.d().uv(6, 0, 10, 4)
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class ItemFireworkCharge extends Item
|
||||||
// return Sets.newHashSet("Explosion");
|
// return Sets.newHashSet("Explosion");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "firework_charge", "firework_charge_overlay");
|
return provider.getModel(this.getTransform(), "firework_charge", "firework_charge_overlay");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,31 +14,29 @@ import common.world.World;
|
||||||
|
|
||||||
public class ItemFishFood extends ItemFood
|
public class ItemFishFood extends ItemFood
|
||||||
{
|
{
|
||||||
/** Indicates whether this fish is "cooked" or not. */
|
|
||||||
private final boolean cooked;
|
private final boolean cooked;
|
||||||
|
private final FishType type;
|
||||||
|
|
||||||
public ItemFishFood(boolean cooked)
|
public ItemFishFood(boolean cooked, FishType type)
|
||||||
{
|
{
|
||||||
super(0, false);
|
super(0, false);
|
||||||
this.cooked = cooked;
|
this.cooked = cooked;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHealAmount(ItemStack stack)
|
public int getHealAmount(ItemStack stack)
|
||||||
{
|
{
|
||||||
ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack);
|
return this.cooked && this.type.canCook() ? this.type.getCookedHealAmount() : this.type.getUncookedHealAmount();
|
||||||
return this.cooked && itemfishfood$fishtype.canCook() ? itemfishfood$fishtype.getCookedHealAmount() : itemfishfood$fishtype.getUncookedHealAmount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPotionEffect(ItemStack stack)
|
public String getPotionEffect(ItemStack stack)
|
||||||
{
|
{
|
||||||
return ItemFishFood.FishType.byItemStack(stack) == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null;
|
return this.type == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
||||||
{
|
{
|
||||||
ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack);
|
if (this.type == ItemFishFood.FishType.PUFFERFISH)
|
||||||
|
|
||||||
if (itemfishfood$fishtype == ItemFishFood.FishType.PUFFERFISH)
|
|
||||||
{
|
{
|
||||||
player.addEffect(new PotionEffect(Potion.POISON, 1200, 3));
|
player.addEffect(new PotionEffect(Potion.POISON, 1200, 3));
|
||||||
player.addEffect(new PotionEffect(Potion.NAUSEA, 300, 1));
|
player.addEffect(new PotionEffect(Potion.NAUSEA, 300, 1));
|
||||||
|
@ -47,32 +45,13 @@ public class ItemFishFood extends ItemFood
|
||||||
super.onFoodEaten(stack, worldIn, player);
|
super.onFoodEaten(stack, worldIn, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
|
||||||
*/
|
|
||||||
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems)
|
|
||||||
{
|
|
||||||
for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values())
|
|
||||||
{
|
|
||||||
if (!this.cooked || itemfishfood$fishtype.canCook())
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(this, 1, itemfishfood$fishtype.getMetadata()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
* different names based on their damage or NBT.
|
|
||||||
*/
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
ItemFishFood.FishType type = ItemFishFood.FishType.byItemStack(stack);
|
return (this.type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + this.type.getName();
|
||||||
return (type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + type.getName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + FishType.byMetadata(meta).getTexture());
|
return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + this.type.getTexture());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum FishType
|
public static enum FishType
|
||||||
|
@ -82,7 +61,6 @@ public class ItemFishFood extends ItemFood
|
||||||
CLOWNFISH("clownfish", 2, "Clownfisch", 1),
|
CLOWNFISH("clownfish", 2, "Clownfisch", 1),
|
||||||
PUFFERFISH("pufferfish", 3, "Kugelfisch", 1);
|
PUFFERFISH("pufferfish", 3, "Kugelfisch", 1);
|
||||||
|
|
||||||
private static final Map<Integer, ItemFishFood.FishType> META_LOOKUP = Maps.<Integer, ItemFishFood.FishType>newHashMap();
|
|
||||||
private final int meta;
|
private final int meta;
|
||||||
private final String texture;
|
private final String texture;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
@ -139,23 +117,5 @@ public class ItemFishFood extends ItemFood
|
||||||
{
|
{
|
||||||
return this.cookable;
|
return this.cookable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemFishFood.FishType byMetadata(int meta)
|
|
||||||
{
|
|
||||||
ItemFishFood.FishType itemfishfood$fishtype = (ItemFishFood.FishType)META_LOOKUP.get(Integer.valueOf(meta));
|
|
||||||
return itemfishfood$fishtype == null ? COD : itemfishfood$fishtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemFishFood.FishType byItemStack(ItemStack stack)
|
|
||||||
{
|
|
||||||
return stack.getItem() instanceof ItemFishFood ? byMetadata(stack.getMetadata()) : COD;
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
for (ItemFishFood.FishType itemfishfood$fishtype : values())
|
|
||||||
{
|
|
||||||
META_LOOKUP.put(Integer.valueOf(itemfishfood$fishtype.getMetadata()), itemfishfood$fishtype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class ItemFishingRod extends Item
|
||||||
public ItemFishingRod()
|
public ItemFishingRod()
|
||||||
{
|
{
|
||||||
this.setMaxDamage(64);
|
this.setMaxDamage(64);
|
||||||
this.setMaxStackSize(1);
|
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ public class ItemFishingRod extends Item
|
||||||
return Transforms.TOOL_FLIP;
|
return Transforms.TOOL_FLIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), meta == 1 ? "fishing_rod_cast" : "fishing_rod");
|
return provider.getModel(this.getTransform(), data == 1 ? "fishing_rod_cast" : "fishing_rod");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class ItemFlintAndSteel extends Item
|
||||||
public ItemFlintAndSteel(BlockFire fireBlock)
|
public ItemFlintAndSteel(BlockFire fireBlock)
|
||||||
{
|
{
|
||||||
this.fireBlock = fireBlock;
|
this.fireBlock = fireBlock;
|
||||||
this.maxStackSize = 1;
|
|
||||||
this.setMaxDamage(64);
|
this.setMaxDamage(64);
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ItemGlassBottle extends Item
|
||||||
|
|
||||||
if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potion)))
|
if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potion)))
|
||||||
{
|
{
|
||||||
playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potion, 1, 0), false);
|
playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potion), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class ItemGlassBottle extends Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "potion_bottle_empty");
|
return provider.getModel(this.getTransform(), "potion_bottle_empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public abstract class ItemGunBase extends Item
|
||||||
|
|
||||||
public ItemGunBase(int durability)
|
public ItemGunBase(int durability)
|
||||||
{
|
{
|
||||||
this.maxStackSize = 1;
|
|
||||||
this.setMaxDamage(durability);
|
this.setMaxDamage(durability);
|
||||||
this.setTab(CheatTab.COMBAT);
|
this.setTab(CheatTab.COMBAT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ public class ItemHoe extends Item
|
||||||
public ItemHoe(ToolMaterial material)
|
public ItemHoe(ToolMaterial material)
|
||||||
{
|
{
|
||||||
this.theToolMaterial = material;
|
this.theToolMaterial = material;
|
||||||
this.maxStackSize = 1;
|
|
||||||
this.setMaxDamage(material.getDurability());
|
this.setMaxDamage(material.getDurability());
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class ItemHorseArmor extends Item {
|
||||||
public ItemHorseArmor(ToolMaterial material, String texture) {
|
public ItemHorseArmor(ToolMaterial material, String texture) {
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
this.setTab(CheatTab.COMBAT);
|
this.setTab(CheatTab.COMBAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ public class ItemHugeMushroom extends ItemBlock {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata(int damage) {
|
public int getMetadata() {
|
||||||
return 14;
|
return 14;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,40 +6,27 @@ import common.block.foliage.LeavesType;
|
||||||
public class ItemLeaves extends ItemBlock
|
public class ItemLeaves extends ItemBlock
|
||||||
{
|
{
|
||||||
protected final BlockLeaves leaves;
|
protected final BlockLeaves leaves;
|
||||||
|
private final LeavesType type;
|
||||||
|
|
||||||
public ItemLeaves(BlockLeaves block)
|
public ItemLeaves(BlockLeaves block, LeavesType type)
|
||||||
{
|
{
|
||||||
super(block);
|
super(block);
|
||||||
this.leaves = block;
|
this.leaves = block;
|
||||||
this.setMaxDamage(0);
|
this.type = type;
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public int getMetadata()
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
{
|
||||||
return damage | 8;
|
return this.type.getIndex() | 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||||
{
|
{
|
||||||
return this.leaves.getRenderColor(this.leaves.getStateFromMeta(stack.getMetadata()));
|
return this.leaves.getRenderColor(this.leaves.getState().withProperty(BlockLeaves.TYPE, this.type));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
// * different names based on their damage or NBT.
|
|
||||||
// */
|
|
||||||
// public String getUnlocalizedName(ItemStack stack)
|
|
||||||
// {
|
|
||||||
// return super.getUnlocalizedName() + "." + this.leaves.getWoodType().getUnlocalizedName();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String getDisplay(ItemStack stack)
|
public String getDisplay(ItemStack stack)
|
||||||
{
|
{
|
||||||
return this.block.getDisplay() + " (" + LeavesType.getById(stack.getMetadata()).getDisplayName() + ")";
|
return this.block.getDisplay() + " (" + this.type.getDisplayName() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,6 @@ public class ItemLilyPad extends ItemColored
|
||||||
|
|
||||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||||
{
|
{
|
||||||
return Blocks.waterlily.getRenderColor(Blocks.waterlily.getStateFromMeta(stack.getMetadata()));
|
return Blocks.waterlily.getRenderColor(Blocks.waterlily.getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ItemMagnet extends Item {
|
||||||
|
|
||||||
public <T extends Entity> ItemMagnet(boolean chicken) {
|
public <T extends Entity> ItemMagnet(boolean chicken) {
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
this.chicken = chicken;
|
this.chicken = chicken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class ItemMinecart extends Item
|
||||||
|
|
||||||
public ItemMinecart(EntityCart.EnumMinecartType type)
|
public ItemMinecart(EntityCart.EnumMinecartType type)
|
||||||
{
|
{
|
||||||
this.maxStackSize = 1;
|
this.setMaxAmount(1);
|
||||||
this.minecartType = type;
|
this.minecartType = type;
|
||||||
this.setTab(CheatTab.SPAWNERS);
|
this.setTab(CheatTab.SPAWNERS);
|
||||||
// if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK)
|
// if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK)
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class ItemMonsterPlacer extends Item
|
||||||
// subItems.add(new ItemStack(itemIn, 1, 0));
|
// subItems.add(new ItemStack(itemIn, 1, 0));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "spawn_egg", "spawn_egg_overlay");
|
return provider.getModel(this.getTransform(), "spawn_egg", "spawn_egg_overlay");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +1,24 @@
|
||||||
package common.item;
|
package common.item;
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
|
|
||||||
public class ItemMultiTexture extends ItemBlock
|
public class ItemMultiTexture extends ItemBlock
|
||||||
{
|
{
|
||||||
protected final Block theBlock;
|
protected final int data;
|
||||||
protected final Function<ItemStack, String> nameFunction;
|
|
||||||
|
|
||||||
public ItemMultiTexture(Block block, Block block2, boolean flatTexture, Function<ItemStack, String> nameFunction)
|
public ItemMultiTexture(Block block, boolean flatTexture, int data)
|
||||||
{
|
{
|
||||||
super(block, flatTexture ? "" : null);
|
super(block, flatTexture ? "" : null);
|
||||||
this.theBlock = block2;
|
this.data = data;
|
||||||
this.nameFunction = nameFunction;
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemMultiTexture(Block block, Block block2, Function<ItemStack, String> nameFunction)
|
public ItemMultiTexture(Block block, int data)
|
||||||
{
|
{
|
||||||
this(block, block2, false, nameFunction);
|
this(block, false, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemMultiTexture(Block block, Block block2, final String[] namesByMeta)
|
public int getMetadata()
|
||||||
{
|
{
|
||||||
this(block, block2, false, new Function<ItemStack, String>()
|
return this.data;
|
||||||
{
|
|
||||||
public String apply(ItemStack p_apply_1_)
|
|
||||||
{
|
|
||||||
int i = p_apply_1_.getMetadata();
|
|
||||||
|
|
||||||
if (i < 0 || i >= namesByMeta.length)
|
|
||||||
{
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return namesByMeta[i];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
|
|
||||||
* different names based on their damage or NBT.
|
|
||||||
*/
|
|
||||||
public String getDisplay(ItemStack stack)
|
|
||||||
{
|
|
||||||
return this.nameFunction.apply(stack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class ItemNpcSpawner extends Item
|
||||||
// subItems.add(new ItemStack(itemIn, 1, 0));
|
// subItems.add(new ItemStack(itemIn, 1, 0));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "npc_spawner", "npc_spawner_overlay");
|
return provider.getModel(this.getTransform(), "npc_spawner", "npc_spawner_overlay");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ItemPiston extends ItemBlock
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
* placed as a Block (mostly used with ItemBlocks).
|
||||||
*/
|
*/
|
||||||
public int getMetadata(int damage)
|
public int getMetadata()
|
||||||
{
|
{
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class ItemPiston extends ItemBlock
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getModel("piston_side").add().nswe().d("piston_bottom").u("piston_top" + (this.block ==
|
return provider.getModel(provider.getModel("piston_side").add().nswe().d("piston_bottom").u("piston_top" + (this.block ==
|
||||||
Blocks.sticky_piston ? "_sticky" : "")), this.getTransform());
|
Blocks.sticky_piston ? "_sticky" : "")), this.getTransform());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,7 @@ public class ItemPotion extends Item
|
||||||
|
|
||||||
public ItemPotion()
|
public ItemPotion()
|
||||||
{
|
{
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setTab(CheatTab.MAGIC);
|
this.setTab(CheatTab.MAGIC);
|
||||||
this.setColor(TextColor.ORK);
|
this.setColor(TextColor.ORK);
|
||||||
}
|
}
|
||||||
|
@ -389,8 +387,7 @@ public class ItemPotion extends Item
|
||||||
subItems.add(new ItemStack(itemIn, 1, 16384));
|
subItems.add(new ItemStack(itemIn, 1, 16384));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "potion_overlay",
|
return provider.getModel(this.getTransform(), "potion_overlay");
|
||||||
isSplash(meta) ? "potion_bottle_splash" : "potion_bottle_drinkable");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class ItemPressurePlate extends ItemBlock {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(provider.getModel(((BlockBasePressurePlate)this.block).getTexture())
|
return provider.getModel(provider.getModel(((BlockBasePressurePlate)this.block).getTexture())
|
||||||
.add(1, 6, 1, 15, 10, 15)
|
.add(1, 6, 1, 15, 10, 15)
|
||||||
.d().uv(1, 1, 15, 15).noCull()
|
.d().uv(1, 1, 15, 15).noCull()
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class ItemRecord extends Item {
|
||||||
this.setTab(CheatTab.MISC);
|
this.setTab(CheatTab.MISC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getModel(ModelProvider provider, String name, int meta) {
|
public Model getModel(ModelProvider provider, String name) {
|
||||||
return provider.getModel(this.getTransform(), "record_old");
|
return provider.getModel(this.getTransform(), "record_old");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class ItemSaddle extends Item
|
||||||
{
|
{
|
||||||
public ItemSaddle()
|
public ItemSaddle()
|
||||||
{
|
{
|
||||||
this.maxStackSize = 1;
|
this.setMaxAmount(1);
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ public class ItemShears extends Item
|
||||||
|
|
||||||
public ItemShears(ToolMaterial material)
|
public ItemShears(ToolMaterial material)
|
||||||
{
|
{
|
||||||
this.setMaxStackSize(1);
|
|
||||||
this.setMaxDamage(material.getDurability() - 12);
|
this.setMaxDamage(material.getDurability() - 12);
|
||||||
this.setTab(CheatTab.TOOLS);
|
this.setTab(CheatTab.TOOLS);
|
||||||
this.material = material;
|
this.material = material;
|
||||||
|
|
|
@ -16,8 +16,6 @@ public class ItemSlab extends ItemBlock
|
||||||
{
|
{
|
||||||
super(slab);
|
super(slab);
|
||||||
this.slab = slab;
|
this.slab = slab;
|
||||||
// this.setMaxDamage(0);
|
|
||||||
// this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
|
@ -14,13 +14,8 @@ public class ItemSnow extends ItemBlock
|
||||||
public ItemSnow(Block block)
|
public ItemSnow(Block block)
|
||||||
{
|
{
|
||||||
super(block);
|
super(block);
|
||||||
this.setMaxDamage(0);
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a Block is right-clicked with this Item
|
|
||||||
*/
|
|
||||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (stack.size == 0)
|
if (stack.size == 0)
|
||||||
|
@ -65,13 +60,4 @@ public class ItemSnow extends ItemBlock
|
||||||
return super.onItemUse(stack, playerIn, worldIn, blockpos, side, hitX, hitY, hitZ);
|
return super.onItemUse(stack, playerIn, worldIn, blockpos, side, hitX, hitY, hitZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is
|
|
||||||
* placed as a Block (mostly used with ItemBlocks).
|
|
||||||
*/
|
|
||||||
public int getMetadata(int damage)
|
|
||||||
{
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class ItemSoup extends ItemFood
|
||||||
public ItemSoup(int healAmount)
|
public ItemSoup(int healAmount)
|
||||||
{
|
{
|
||||||
super(healAmount, false);
|
super(healAmount, false);
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class ItemSpaceNavigator extends ItemMagnetic {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemSpaceNavigator() {
|
public ItemSpaceNavigator() {
|
||||||
this.setMaxStackSize(1);
|
this.setMaxAmount(1);
|
||||||
this.setColor(TextColor.DGREEN);
|
this.setColor(TextColor.DGREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import common.enchantment.Enchantment;
|
||||||
import common.enchantment.EnchantmentHelper;
|
import common.enchantment.EnchantmentHelper;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.init.BlockRegistry;
|
|
||||||
import common.init.ItemRegistry;
|
import common.init.ItemRegistry;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tags.TagObject;
|
import common.tags.TagObject;
|
||||||
|
@ -26,12 +25,11 @@ import common.world.World;
|
||||||
public final class ItemStack
|
public final class ItemStack
|
||||||
{
|
{
|
||||||
public static final int MAX_SIZE = 67108864;
|
public static final int MAX_SIZE = 67108864;
|
||||||
public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###");
|
private static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###");
|
||||||
|
|
||||||
public int size;
|
public int size;
|
||||||
private Item item;
|
private Item item;
|
||||||
private TagObject tag;
|
private TagObject tag;
|
||||||
private int meta;
|
|
||||||
|
|
||||||
public ItemStack(Block block)
|
public ItemStack(Block block)
|
||||||
{
|
{
|
||||||
|
@ -40,12 +38,7 @@ public final class ItemStack
|
||||||
|
|
||||||
public ItemStack(Block block, int amount)
|
public ItemStack(Block block, int amount)
|
||||||
{
|
{
|
||||||
this(block, amount, 0);
|
this(ItemRegistry.getItemFromBlock(block), amount);
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack(Block block, int amount, int meta)
|
|
||||||
{
|
|
||||||
this(ItemRegistry.getItemFromBlock(block), amount, meta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack(Item item)
|
public ItemStack(Item item)
|
||||||
|
@ -55,23 +48,8 @@ public final class ItemStack
|
||||||
|
|
||||||
public ItemStack(Item item, int amount)
|
public ItemStack(Item item, int amount)
|
||||||
{
|
{
|
||||||
this(item, amount, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack(Item item, int amount, int meta)
|
|
||||||
{
|
|
||||||
// this.canDestroyCacheBlock = null;
|
|
||||||
// this.canDestroyCacheResult = false;
|
|
||||||
// this.canPlaceOnCacheBlock = null;
|
|
||||||
// this.canPlaceOnCacheResult = false;
|
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.size = amount;
|
this.size = amount;
|
||||||
this.meta = meta;
|
|
||||||
|
|
||||||
if (this.meta < 0)
|
|
||||||
{
|
|
||||||
this.meta = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatAmount(int amount) {
|
public static String formatAmount(int amount) {
|
||||||
|
@ -100,10 +78,6 @@ public final class ItemStack
|
||||||
|
|
||||||
private ItemStack()
|
private ItemStack()
|
||||||
{
|
{
|
||||||
// this.canDestroyCacheBlock = null;
|
|
||||||
// this.canDestroyCacheResult = false;
|
|
||||||
// this.canPlaceOnCacheBlock = null;
|
|
||||||
// this.canPlaceOnCacheResult = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,7 +85,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public ItemStack splitStack(int amount)
|
public ItemStack splitStack(int amount)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = new ItemStack(this.item, amount, this.meta);
|
ItemStack itemstack = new ItemStack(this.item, amount);
|
||||||
|
|
||||||
if (this.tag != null)
|
if (this.tag != null)
|
||||||
{
|
{
|
||||||
|
@ -168,136 +142,70 @@ public final class ItemStack
|
||||||
return this.getItem().onItemUseFinish(this, worldIn, playerIn);
|
return this.getItem().onItemUseFinish(this, worldIn, playerIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write the stack fields to a object. Return the new object.
|
|
||||||
*/
|
|
||||||
public TagObject writeTags(TagObject tag)
|
public TagObject writeTags(TagObject tag)
|
||||||
{
|
{
|
||||||
String resourcelocation = ItemRegistry.getNameFromItem(this.item);
|
if(this.tag != null)
|
||||||
tag.setString("id", resourcelocation == null ? "air" : resourcelocation.toString());
|
tag.merge(this.tag);
|
||||||
tag.setInt("Count", this.size);
|
tag.setString("id", this.item == null ? "air" : ItemRegistry.getNameFromItem(this.item));
|
||||||
tag.setShort("Damage", (short)this.meta);
|
tag.setInt("size", this.size);
|
||||||
|
|
||||||
if (this.tag != null)
|
|
||||||
{
|
|
||||||
tag.setObject("tag", this.tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void readTags(TagObject tag)
|
||||||
* Read the stack fields from a object.
|
|
||||||
*/
|
|
||||||
public void readTags(TagObject tag)
|
|
||||||
{
|
{
|
||||||
if (tag.hasString("id"))
|
if(!tag.hasString("id") || !tag.hasInt("size"))
|
||||||
{
|
return;
|
||||||
this.item = ItemRegistry.getRegisteredItem(tag.getString("id"));
|
this.item = ItemRegistry.getRegisteredItem(tag.getString("id"));
|
||||||
}
|
this.size = tag.getInt("size");
|
||||||
else
|
tag.remove("id");
|
||||||
{
|
tag.remove("size");
|
||||||
this.item = ItemRegistry.getItemById(tag.getShort("id"));
|
if(!tag.isEmpty())
|
||||||
}
|
this.tag = tag;
|
||||||
|
|
||||||
this.size = tag.getInt("Count");
|
|
||||||
this.meta = tag.getShort("Damage");
|
|
||||||
|
|
||||||
if (this.meta < 0)
|
|
||||||
{
|
|
||||||
this.meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tag.hasObject("tag"))
|
|
||||||
{
|
|
||||||
this.tag = tag.getObject("tag");
|
|
||||||
|
|
||||||
if (this.item != null)
|
|
||||||
{
|
|
||||||
this.item.updateItemStackNBT(this.tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns maximum size of the stack.
|
|
||||||
*/
|
|
||||||
public int getMaxStackSize()
|
public int getMaxStackSize()
|
||||||
{
|
{
|
||||||
return this.getItem().getItemStackLimit();
|
return this.getItem().getItemStackLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the ItemStack can hold 2 or more units of the item.
|
|
||||||
*/
|
|
||||||
public boolean isStackable()
|
public boolean isStackable()
|
||||||
{
|
{
|
||||||
return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged());
|
return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* true if this itemStack is damageable
|
|
||||||
*/
|
|
||||||
public boolean isItemStackDamageable()
|
public boolean isItemStackDamageable()
|
||||||
{
|
{
|
||||||
return this.item != null && this.item.getMaxDamage() > 0;
|
return this.item != null && this.item.getMaxDamage() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setItemStackDamageable(boolean breakable)
|
|
||||||
// {
|
|
||||||
// if(!breakable) {
|
|
||||||
// if(this.stackTagCompound == null) {
|
|
||||||
// this.setTagCompound(new TagObject());
|
|
||||||
// }
|
|
||||||
// this.stackTagCompound.setBoolean("Unbreakable", true);
|
|
||||||
// this.setItemDamage(0);
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// if(this.stackTagCompound != null) {
|
|
||||||
// this.stackTagCompound.removeTag("Unbreakable");
|
|
||||||
// if(this.stackTagCompound.hasNoTags()) {
|
|
||||||
// this.stackTagCompound = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean getHasSubtypes()
|
|
||||||
{
|
|
||||||
return this.item.getHasSubtypes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns true when a damageable item is damaged
|
|
||||||
*/
|
|
||||||
public boolean isItemDamaged()
|
public boolean isItemDamaged()
|
||||||
{
|
{
|
||||||
return this.isItemStackDamageable() && this.meta > 0;
|
return this.isItemStackDamageable() && this.getItemDamage() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemDamage()
|
public int getItemDamage()
|
||||||
{
|
{
|
||||||
return this.meta;
|
return this.isItemStackDamageable() && this.tag != null && this.tag.hasInt("dmg") ? this.tag.getInt("dmg") : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMetadata()
|
public void setItemDamage(int damage)
|
||||||
{
|
{
|
||||||
return this.meta;
|
if(!this.isItemStackDamageable())
|
||||||
|
return;
|
||||||
|
if(damage <= 0) {
|
||||||
|
if(this.tag != null) {
|
||||||
|
this.tag.remove("dmg");
|
||||||
|
if(this.tag.isEmpty())
|
||||||
|
this.tag = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(this.tag == null)
|
||||||
|
this.tag = new TagObject();
|
||||||
|
this.tag.setInt("dmg", damage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemDamage(int meta)
|
|
||||||
{
|
|
||||||
this.meta = meta;
|
|
||||||
|
|
||||||
if (this.meta < 0)
|
|
||||||
{
|
|
||||||
this.meta = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the max damage an item in the stack can take.
|
|
||||||
*/
|
|
||||||
public int getMaxDamage()
|
public int getMaxDamage()
|
||||||
{
|
{
|
||||||
return this.item.getMaxDamage();
|
return this.item.getMaxDamage();
|
||||||
|
@ -338,18 +246,14 @@ public final class ItemStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.meta += amount;
|
int damage = this.getItemDamage() + amount;
|
||||||
return this.meta > this.getMaxDamage();
|
this.setItemDamage(damage);
|
||||||
|
return damage > this.getMaxDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Damages the item in the ItemStack
|
|
||||||
*/
|
|
||||||
public void damageItem(int amount, EntityLiving entityIn)
|
public void damageItem(int amount, EntityLiving entityIn)
|
||||||
{
|
{
|
||||||
// if (!(entityIn.isPlayer()) || !((EntityNPC)entityIn).creative)
|
|
||||||
// {
|
|
||||||
if (this.isItemStackDamageable())
|
if (this.isItemStackDamageable())
|
||||||
{
|
{
|
||||||
if (this.attemptDamageItem(amount, entityIn.getRNG()))
|
if (this.attemptDamageItem(amount, entityIn.getRNG()))
|
||||||
|
@ -360,7 +264,6 @@ public final class ItemStack
|
||||||
if (entityIn.isPlayer())
|
if (entityIn.isPlayer())
|
||||||
{
|
{
|
||||||
EntityNPC entityplayer = (EntityNPC)entityIn;
|
EntityNPC entityplayer = (EntityNPC)entityIn;
|
||||||
// entityplayer.triggerAchievement(StatRegistry.objectBreakStats[ItemRegistry.getIdFromItem(this.item)]);
|
|
||||||
|
|
||||||
if (this.size == 0 && this.getItem() instanceof ItemBow)
|
if (this.size == 0 && this.getItem() instanceof ItemBow)
|
||||||
{
|
{
|
||||||
|
@ -373,10 +276,9 @@ public final class ItemStack
|
||||||
this.size = 0;
|
this.size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.meta = 0;
|
this.setItemDamage(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -418,12 +320,9 @@ public final class ItemStack
|
||||||
return this.item.itemInteractionForEntity(this, playerIn, entityIn);
|
return this.item.itemInteractionForEntity(this, playerIn, entityIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new stack with the same properties.
|
|
||||||
*/
|
|
||||||
public ItemStack copy()
|
public ItemStack copy()
|
||||||
{
|
{
|
||||||
ItemStack itemstack = new ItemStack(this.item, this.size, this.meta);
|
ItemStack itemstack = new ItemStack(this.item, this.size);
|
||||||
|
|
||||||
if (this.tag != null)
|
if (this.tag != null)
|
||||||
{
|
{
|
||||||
|
@ -451,7 +350,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
private boolean isItemStackEqual(ItemStack other)
|
private boolean isItemStackEqual(ItemStack other)
|
||||||
{
|
{
|
||||||
return this.size != other.size ? false : (this.item != other.item ? false : (this.meta != other.meta ? false : (this.tag == null && other.tag != null ? false : this.tag == null || this.tag.equals(other.tag))));
|
return this.size != other.size ? false : (this.item != other.item ? false : (this.tag == null && other.tag != null ? false : this.tag == null || this.tag.equals(other.tag)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -468,7 +367,7 @@ public final class ItemStack
|
||||||
*/
|
*/
|
||||||
public boolean isItemEqual(ItemStack other)
|
public boolean isItemEqual(ItemStack other)
|
||||||
{
|
{
|
||||||
return other != null && this.item == other.item && this.meta == other.meta;
|
return other != null && this.item == other.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getUnlocalizedName()
|
// public String getUnlocalizedName()
|
||||||
|
@ -579,29 +478,18 @@ public final class ItemStack
|
||||||
return this.tag == null ? null : this.tag.getList("ench");
|
return this.tag == null ? null : this.tag.getList("ench");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Assigns a NBTTagCompound to the ItemStack, does not validate that only non-stackable items can have it.
|
|
||||||
*/
|
|
||||||
public void setTagCompound(TagObject nbt)
|
public void setTagCompound(TagObject nbt)
|
||||||
{
|
{
|
||||||
this.tag = nbt;
|
this.tag = nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the display name of the itemstack
|
|
||||||
*/
|
|
||||||
public String getDisplayName()
|
public String getDisplayName()
|
||||||
{
|
{
|
||||||
String s = this.getItem().getDisplay(this);
|
String s = this.getItem().getDisplay(this);
|
||||||
|
|
||||||
if (this.tag != null && this.tag.hasString("Name"))
|
if (this.tag != null && this.tag.hasString("Name"))
|
||||||
{
|
{
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
|
||||||
//
|
|
||||||
// if (nbttagcompound.hasString("Name"))
|
|
||||||
// {
|
|
||||||
s = this.tag.getString("Name");
|
s = this.tag.getString("Name");
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@ -622,131 +510,26 @@ public final class ItemStack
|
||||||
this.tag = new TagObject();
|
this.tag = new TagObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!this.stackTagCompound.hasTag("display"))
|
|
||||||
// {
|
|
||||||
// this.stackTagCompound.setTag("display", new NBTTagCompound());
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.tag.setString("Name", displayName);
|
this.tag.setString("Name", displayName);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ItemStack setStackLore(String displayLore)
|
|
||||||
// {
|
|
||||||
// if (this.stackTagCompound == null)
|
|
||||||
// {
|
|
||||||
// this.stackTagCompound = new NBTTagCompound();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!this.stackTagCompound.hasTag("display"))
|
|
||||||
// {
|
|
||||||
// this.stackTagCompound.setTag("display", new NBTTagCompound());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// NBTTagList nbttaglist = new NBTTagList();
|
|
||||||
// for(String s : displayLore.split("\\n")) {
|
|
||||||
// nbttaglist.appendTag(new NBTTagString(s));
|
|
||||||
// }
|
|
||||||
// this.stackTagCompound.getCompoundTag("display").setTag("Lore", nbttaglist);
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getStackLore()
|
|
||||||
// {
|
|
||||||
// if (this.stackTagCompound == null)
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!this.stackTagCompound.hasTag("display"))
|
|
||||||
// {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// NBTTagList nbttaglist = this.stackTagCompound.getCompoundTag("display").getTagList("Lore", 8);
|
|
||||||
// StringBuilder sb = new StringBuilder();
|
|
||||||
// for(int z = 0; z < nbttaglist.tagCount(); z++) {
|
|
||||||
// if(sb.length() > 0) {
|
|
||||||
// sb.append("\n");
|
|
||||||
// }
|
|
||||||
// sb.append(nbttaglist.getStringTagAt(z));
|
|
||||||
// }
|
|
||||||
// return sb.toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public ItemStack setStackFlags(int flags)
|
|
||||||
// {
|
|
||||||
// if(flags != 0) {
|
|
||||||
// if (this.stackTagCompound == null)
|
|
||||||
// {
|
|
||||||
// this.stackTagCompound = new NBTTagCompound();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this.stackTagCompound.setInteger("HideFlags", flags);
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// if (this.stackTagCompound != null)
|
|
||||||
// {
|
|
||||||
// this.stackTagCompound.removeTag("HideFlags");
|
|
||||||
// if (this.stackTagCompound.hasNoTags())
|
|
||||||
// {
|
|
||||||
// this.setTagCompound((NBTTagCompound)null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear any custom name set for this ItemStack
|
|
||||||
*/
|
|
||||||
public void clearCustomName()
|
public void clearCustomName()
|
||||||
{
|
{
|
||||||
if (this.tag != null)
|
if (this.tag != null)
|
||||||
{
|
{
|
||||||
if (this.tag.hasString("Name"))
|
if (this.tag.hasString("Name"))
|
||||||
{
|
{
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
|
||||||
this.tag.remove("Name");
|
this.tag.remove("Name");
|
||||||
|
|
||||||
if (this.tag.isEmpty())
|
if (this.tag.isEmpty())
|
||||||
{
|
{
|
||||||
// this.stackTagCompound.removeTag("display");
|
|
||||||
//
|
|
||||||
// if (this.stackTagCompound.hasNoTags())
|
|
||||||
// {
|
|
||||||
this.setTagCompound(null);
|
this.setTagCompound(null);
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void clearLore()
|
|
||||||
// {
|
|
||||||
// if (this.stackTagCompound != null)
|
|
||||||
// {
|
|
||||||
// if (this.stackTagCompound.hasTag("display"))
|
|
||||||
// {
|
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
|
||||||
// nbttagcompound.removeTag("Lore");
|
|
||||||
//
|
|
||||||
// if (nbttagcompound.hasNoTags())
|
|
||||||
// {
|
|
||||||
// this.stackTagCompound.removeTag("display");
|
|
||||||
//
|
|
||||||
// if (this.stackTagCompound.hasNoTags())
|
|
||||||
// {
|
|
||||||
// this.setTagCompound((NBTTagCompound)null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the itemstack has a display name
|
|
||||||
*/
|
|
||||||
public boolean hasDisplayName()
|
public boolean hasDisplayName()
|
||||||
{
|
{
|
||||||
return this.tag != null && this.tag.hasString("Name");
|
return this.tag != null && this.tag.hasString("Name");
|
||||||
|
@ -756,59 +539,14 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
List<String> list = Lists.<String>newArrayList();
|
List<String> list = Lists.<String>newArrayList();
|
||||||
String s = this.getColoredName();
|
String s = this.getColoredName();
|
||||||
|
|
||||||
// if (this.hasDisplayName())
|
|
||||||
// {
|
|
||||||
// s = ChatFormat.ITALIC + s;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(this.size != 1)
|
if(this.size != 1)
|
||||||
s = TextColor.YELLOW + "" + this.size + " " + TextColor.RESET + s;
|
s = TextColor.YELLOW + "" + this.size + " " + TextColor.RESET + s;
|
||||||
|
|
||||||
s = s + TextColor.RESET;
|
s = s + TextColor.RESET;
|
||||||
|
|
||||||
// if (advanced)
|
|
||||||
// {
|
|
||||||
String s1 = "";
|
|
||||||
|
|
||||||
if (this.getHasSubtypes())
|
|
||||||
{
|
|
||||||
s1 = s1 + String.format("%d", this.meta);
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// s = s + String.format("#%04d", i);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (s1.length() > 0)
|
|
||||||
{
|
|
||||||
s = s + " (" + s1 + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
// s = s + s1;
|
|
||||||
// }
|
|
||||||
// else if (!this.hasDisplayName() && this.item == Items.filled_map)
|
|
||||||
// {
|
|
||||||
// s = s + " #" + this.itemDamage;
|
|
||||||
// }
|
|
||||||
|
|
||||||
list.add(s);
|
list.add(s);
|
||||||
// int i1 = 0;
|
|
||||||
//
|
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasKey("HideFlags", 99))
|
|
||||||
// {
|
|
||||||
// i1 = this.stackTagCompound.getInteger("HideFlags");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if ((i1 & 32) == 0)
|
|
||||||
// {
|
|
||||||
this.item.addInformation(this, playerIn, list);
|
this.item.addInformation(this, playerIn, list);
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.hasTagCompound())
|
if (this.hasTagCompound())
|
||||||
{
|
{
|
||||||
// if ((i1 & 1) == 0)
|
|
||||||
// {
|
|
||||||
List<TagObject> nbttaglist = this.getEnchantmentTagList();
|
List<TagObject> nbttaglist = this.getEnchantmentTagList();
|
||||||
|
|
||||||
if (nbttaglist != null)
|
if (nbttaglist != null)
|
||||||
|
@ -824,37 +562,6 @@ public final class ItemStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.stackTagCompound.hasTag("display"))
|
|
||||||
// {
|
|
||||||
// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display");
|
|
||||||
//
|
|
||||||
// if (nbttagcompound.hasInt("color"))
|
|
||||||
// {
|
|
||||||
// if (advanced)
|
|
||||||
// {
|
|
||||||
// list.add("Color: #" + Integer.toHexString(nbttagcompound.getInteger("color")).toUpperCase());
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// list.add(ChatFormat.ITALIC + I18n.translate("item.dyed"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//// if (nbttagcompound.getTagId("Lore") == 9)
|
|
||||||
//// {
|
|
||||||
//// NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8);
|
|
||||||
////
|
|
||||||
//// if (nbttaglist1.tagCount() > 0)
|
|
||||||
//// {
|
|
||||||
//// for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1)
|
|
||||||
//// {
|
|
||||||
//// list.add(ChatFormat.DARK_PURPLE + "" + ChatFormat.ITALIC + nbttaglist1.getStringTagAt(j1));
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int damage = this.item.getAttackDamageBonus();
|
int damage = this.item.getAttackDamageBonus();
|
||||||
|
@ -890,58 +597,6 @@ public final class ItemStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanDestroy") && (i1 & 8) == 0)
|
|
||||||
// {
|
|
||||||
// NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanDestroy", 8);
|
|
||||||
//
|
|
||||||
// if (nbttaglist2.tagCount() > 0)
|
|
||||||
// {
|
|
||||||
// list.add("");
|
|
||||||
// list.add(ChatFormat.GRAY + I18n.formatKey("item.canBreak"));
|
|
||||||
//
|
|
||||||
// for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1)
|
|
||||||
// {
|
|
||||||
// Block block = BlockRegistry.getByIdFallback(nbttaglist2.getStringTagAt(k1));
|
|
||||||
//
|
|
||||||
// if (block != null)
|
|
||||||
// {
|
|
||||||
// list.add(ChatFormat.DARK_GRAY + block.getLocalizedName());
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// list.add(ChatFormat.DARK_GRAY + "missingno");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanPlaceOn") && (i1 & 16) == 0)
|
|
||||||
// {
|
|
||||||
// NBTTagList nbttaglist3 = this.stackTagCompound.getTagList("CanPlaceOn", 8);
|
|
||||||
//
|
|
||||||
// if (nbttaglist3.tagCount() > 0)
|
|
||||||
// {
|
|
||||||
// list.add("");
|
|
||||||
// list.add(ChatFormat.GRAY + I18n.formatKey("item.canPlace"));
|
|
||||||
//
|
|
||||||
// for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1)
|
|
||||||
// {
|
|
||||||
// Block block1 = BlockRegistry.getByIdFallback(nbttaglist3.getStringTagAt(l1));
|
|
||||||
//
|
|
||||||
// if (block1 != null)
|
|
||||||
// {
|
|
||||||
// list.add(ChatFormat.DARK_GRAY + block1.getLocalizedName());
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// list.add(ChatFormat.DARK_GRAY + "missingno");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (advanced)
|
|
||||||
// {
|
|
||||||
if (this.isItemStackDamageable())
|
if (this.isItemStackDamageable())
|
||||||
{
|
{
|
||||||
list.add(String.format("Haltbarkeit: %d" + (this.isItemDamaged() ? " / %d" : ""),
|
list.add(String.format("Haltbarkeit: %d" + (this.isItemDamaged() ? " / %d" : ""),
|
||||||
|
@ -957,7 +612,6 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
list.add(TextColor.GRAY + String.format("NBT-Tags: %d", this.getTagCompound().keySet().size()));
|
list.add(TextColor.GRAY + String.format("NBT-Tags: %d", this.getTagCompound().keySet().size()));
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -1085,46 +739,11 @@ public final class ItemStack
|
||||||
this.tag.setList(key, value);
|
this.tag.setList(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean canEditBlocks()
|
|
||||||
// {
|
|
||||||
// return this.getItem().canItemEditBlocks();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether this stack is on an item frame.
|
|
||||||
*/
|
|
||||||
// public boolean isOnItemFrame()
|
|
||||||
// {
|
|
||||||
// return this.itemFrame != null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Set the item frame this stack is on.
|
|
||||||
// */
|
|
||||||
// public void setItemFrame(EntityFrame frame)
|
|
||||||
// {
|
|
||||||
// this.itemFrame = frame;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Return the item frame this stack is on. Returns null if not on an item frame.
|
|
||||||
// */
|
|
||||||
// public EntityFrame getItemFrame()
|
|
||||||
// {
|
|
||||||
// return this.itemFrame;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this stack's repair cost, or 0 if no repair cost is defined.
|
|
||||||
*/
|
|
||||||
public int getRepairCost()
|
public int getRepairCost()
|
||||||
{
|
{
|
||||||
return this.hasTagCompound() && this.tag.hasInt("RepairCost") ? this.tag.getInt("RepairCost") : 0;
|
return this.hasTagCompound() && this.tag.hasInt("RepairCost") ? this.tag.getInt("RepairCost") : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set this stack's repair cost.
|
|
||||||
*/
|
|
||||||
public void setRepairCost(int cost)
|
public void setRepairCost(int cost)
|
||||||
{
|
{
|
||||||
if(cost == 0) {
|
if(cost == 0) {
|
||||||
|
@ -1159,74 +778,4 @@ public final class ItemStack
|
||||||
{
|
{
|
||||||
this.item = newItem;
|
this.item = newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean canDestroy(Block blockIn)
|
|
||||||
// {
|
|
||||||
// if (blockIn == this.canDestroyCacheBlock)
|
|
||||||
// {
|
|
||||||
// return this.canDestroyCacheResult;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// this.canDestroyCacheBlock = blockIn;
|
|
||||||
//
|
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanDestroy"))
|
|
||||||
// {
|
|
||||||
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanDestroy", 8);
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
|
||||||
// {
|
|
||||||
// Block block = BlockRegistry.getByIdFallback(nbttaglist.getStringTagAt(i));
|
|
||||||
//
|
|
||||||
// if (block == blockIn)
|
|
||||||
// {
|
|
||||||
// this.canDestroyCacheResult = true;
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this.canDestroyCacheResult = false;
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public boolean canPlaceOn(Block blockIn)
|
|
||||||
// {
|
|
||||||
// if (blockIn == this.canPlaceOnCacheBlock)
|
|
||||||
// {
|
|
||||||
// return this.canPlaceOnCacheResult;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// this.canPlaceOnCacheBlock = blockIn;
|
|
||||||
//
|
|
||||||
// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanPlaceOn"))
|
|
||||||
// {
|
|
||||||
// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanPlaceOn", 8);
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
|
||||||
// {
|
|
||||||
// Block block = BlockRegistry.getByIdFallback(nbttaglist.getStringTagAt(i));
|
|
||||||
//
|
|
||||||
// if (block == blockIn)
|
|
||||||
// {
|
|
||||||
// this.canPlaceOnCacheResult = true;
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// this.canPlaceOnCacheResult = false;
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public boolean validate() {
|
|
||||||
// return this.item != null && this.item.validate(this);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public StackID getStackId() {
|
|
||||||
// return new StackID(this);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue