data changes

This commit is contained in:
Sen 2025-07-06 21:43:15 +02:00
parent 575015abd6
commit b14a99dc05
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
75 changed files with 449 additions and 1717 deletions

View file

@ -1560,7 +1560,7 @@ public class Client implements IThreadListener {
inventoryplayer.setCurrentItem(item); inventoryplayer.setCurrentItem(item);
if(this.itemCheat) { if(this.itemCheat) {
this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item), -2 - inventoryplayer.currentItem, this.ctrl())); this.player.client.addToSendQueue(new CPacketCheat(item, -2 - inventoryplayer.currentItem, this.ctrl()));
} }
} }
} }
@ -2393,7 +2393,7 @@ public class Client implements IThreadListener {
this.show(GuiMenu.INSTANCE); this.show(GuiMenu.INSTANCE);
} }
if(this.world != null && !this.charEditor && Bind.INVENTORY.isPressed()) { if(this.world != null && !this.charEditor && Bind.INVENTORY.isPressed()) {
if(this.open instanceof GuiContainer) { if(this.open instanceof GuiContainer && !(this.open.selected instanceof client.gui.element.Field || this.open.selected instanceof Area)) {
this.show(null); this.show(null);
} }
else if(this.open == null) { else if(this.open == null) {

View file

@ -507,7 +507,7 @@ public abstract class GuiContainer extends Gui
if(this.cheatStack != null) { if(this.cheatStack != null) {
Slot slot = this.getSlotAtPosition(mouseX, mouseY); Slot slot = this.getSlotAtPosition(mouseX, mouseY);
if((mouseButton == 0 || mouseButton == 1) && slot != null && this.gm.player != null && slot.canCheatItem()) if((mouseButton == 0 || mouseButton == 1) && slot != null && this.gm.player != null && slot.canCheatItem())
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack, slot.slotNumber, mouseButton == 0 && this.cheatStack.size > 1)); this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack.getItem(), slot.slotNumber, mouseButton == 0 && this.cheatStack.size > 1));
if(mouseButton != 1 && !this.gm.ctrl()) if(mouseButton != 1 && !this.gm.ctrl())
this.cheatStack = null; this.cheatStack = null;
return; return;
@ -885,7 +885,7 @@ public abstract class GuiContainer extends Gui
if(idx >= 0 && idx < ITEM_LIST.size()) { if(idx >= 0 && idx < ITEM_LIST.size()) {
if(slot != -1 || instant) { if(slot != -1 || instant) {
this.gm.player.client.addToSendQueue(new CPacketCheat(ITEM_LIST.get(idx), slot < 0 ? slot : -2 - slot, full)); this.gm.player.client.addToSendQueue(new CPacketCheat(ITEM_LIST.get(idx).getItem(), slot < 0 ? slot : -2 - slot, full));
} }
else { else {
this.cheatStack = ITEM_LIST.get(idx).copy(); this.cheatStack = ITEM_LIST.get(idx).copy();

View file

@ -33,7 +33,7 @@ public class RenderFireball extends Render<EntityProjectile>
GL11.glTranslatef((float)x, (float)y, (float)z); GL11.glTranslatef((float)x, (float)y, (float)z);
GlState.enableRescaleNormal(); GlState.enableRescaleNormal();
GL11.glScalef(this.scale, this.scale, this.scale); GL11.glScalef(this.scale, this.scale, this.scale);
TextureAtlasSprite textureatlassprite = Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(Items.fire_charge); TextureAtlasSprite textureatlassprite = Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(Items.fireball);
// Tessellator tessellator = Tessellator.getInstance(); // Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer(); RenderBuffer worldrenderer = Tessellator.getBuffer();
float f = textureatlassprite.getMinU(); float f = textureatlassprite.getMinU();

View file

@ -1,31 +0,0 @@
package client.renderer.model;
public class ModelBanner extends ModelBase
{
public ModelRenderer bannerSlate;
public ModelRenderer bannerStand;
public ModelRenderer bannerTop;
public ModelBanner()
{
this.textureWidth = 64;
this.textureHeight = 64;
this.bannerSlate = new ModelRenderer(this, 0, 0);
this.bannerSlate.addBox(-10.0F, 0.0F, -2.0F, 20, 40, 1, 0.0F);
this.bannerStand = new ModelRenderer(this, 44, 0);
this.bannerStand.addBox(-1.0F, -30.0F, -1.0F, 2, 42, 2, 0.0F);
this.bannerTop = new ModelRenderer(this, 0, 42);
this.bannerTop.addBox(-10.0F, -32.0F, -1.0F, 20, 2, 2, 0.0F);
}
/**
* Renders the banner model in.
*/
public void renderBanner()
{
this.bannerSlate.rotationPointY = -32.0F;
this.bannerSlate.render(0.0625F);
this.bannerStand.render(0.0625F);
this.bannerTop.render(0.0625F);
}
}

View file

@ -2,12 +2,7 @@ package client.renderer.particle;
import client.Client; import client.Client;
import client.renderer.RenderBuffer; import client.renderer.RenderBuffer;
import client.world.WorldClient;
import common.color.DyeColor;
import common.entity.Entity; import common.entity.Entity;
import common.init.SoundEvent;
import common.tags.TagObject;
import java.util.List;
import common.util.BoundingBox; import common.util.BoundingBox;
import common.util.ExtMath; import common.util.ExtMath;
import common.world.World; import common.world.World;
@ -76,33 +71,6 @@ public class EntityFirework
this.noClip = false; this.noClip = false;
} }
public void setTrail(boolean trailIn)
{
this.trail = trailIn;
}
public void setTwinkle(boolean twinkleIn)
{
this.twinkle = twinkleIn;
}
public void setColour(int colour)
{
float f = (float)((colour & 16711680) >> 16) / 255.0F;
float f1 = (float)((colour & 65280) >> 8) / 255.0F;
float f2 = (float)((colour & 255) >> 0) / 255.0F;
float f3 = 1.0F;
this.setRBGColorF(f * f3, f1 * f3, f2 * f3);
}
public void setFadeColour(int faceColour)
{
this.fadeColourRed = (float)((faceColour & 16711680) >> 16) / 255.0F;
this.fadeColourGreen = (float)((faceColour & 65280) >> 8) / 255.0F;
this.fadeColourBlue = (float)((faceColour & 255) >> 0) / 255.0F;
this.hasFadeColour = true;
}
public BoundingBox getCollisionBoundingBox() public BoundingBox getCollisionBoundingBox()
{ {
return null; return null;
@ -187,257 +155,4 @@ public class EntityFirework
return 1.0F; return 1.0F;
} }
} }
public static class StarterFX extends EntityFX
{
private int fireworkAge;
private final EffectRenderer theEffectRenderer;
private List<TagObject> fireworkExplosions;
boolean twinkle;
public StarterFX(World p_i46464_1_, double p_i46464_2_, double p_i46464_4_, double p_i46464_6_, double p_i46464_8_, double p_i46464_10_, double p_i46464_12_, EffectRenderer p_i46464_14_, TagObject p_i46464_15_)
{
super(p_i46464_1_, p_i46464_2_, p_i46464_4_, p_i46464_6_, 0.0D, 0.0D, 0.0D);
this.motionX = p_i46464_8_;
this.motionY = p_i46464_10_;
this.motionZ = p_i46464_12_;
this.theEffectRenderer = p_i46464_14_;
this.particleMaxAge = 8;
if (p_i46464_15_ != null)
{
this.fireworkExplosions = p_i46464_15_.getList("Explosions");
if (this.fireworkExplosions.size() == 0)
{
this.fireworkExplosions = null;
}
else
{
this.particleMaxAge = this.fireworkExplosions.size() * 2 - 1;
for (int i = 0; i < this.fireworkExplosions.size(); ++i)
{
TagObject tag = this.fireworkExplosions.get(i);
if (tag.getBool("Flicker"))
{
this.twinkle = true;
this.particleMaxAge += 15;
break;
}
}
}
}
}
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
}
public void onUpdate()
{
if (this.fireworkAge == 0 && this.fireworkExplosions != null)
{
boolean flag = this.isFarAway();
boolean flag1 = false;
if (this.fireworkExplosions.size() >= 3)
{
flag1 = true;
}
else
{
for (int i = 0; i < this.fireworkExplosions.size(); ++i)
{
TagObject tag = this.fireworkExplosions.get(i);
if (tag.getByte("Type") == 1)
{
flag1 = true;
break;
}
}
}
SoundEvent s1 = flag1 ? (flag ? SoundEvent.BLAST_LARGE_FAR : SoundEvent.BLAST_LARGE) :
(flag ? SoundEvent.BLAST_SMALL_FAR : SoundEvent.BLAST_SMALL);
((WorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, s1, 20.0F);
}
if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.size())
{
int k = this.fireworkAge / 2;
TagObject tag = this.fireworkExplosions.get(k);
int l = tag.getByte("Type");
boolean flag4 = tag.getBool("Trail");
boolean flag2 = tag.getBool("Flicker");
int[] aint = tag.getIntArray("Colors");
int[] aint1 = tag.getIntArray("FadeColors");
if (aint.length == 0)
{
aint = new int[] {DyeColor.WHITE.getColor()};
}
if (l == 1)
{
this.createBall(0.5D, 4, aint, aint1, flag4, flag2);
}
else if (l == 2)
{
this.createShaped(0.5D, new double[][] {
{0.0D, 1.0D}, {0.3455D, 0.309D}, {0.9511D, 0.309D}, {0.3795918367346939D, -0.12653061224489795D},
{0.6122448979591837D, -0.8040816326530612D}, {0.0D, -0.35918367346938773D}
}, aint, aint1, flag4, flag2, false, 4);
}
else if (l == 3)
{
this.createShaped(0.5D, new double[][] {
{0.187 - 0.5, 1.0 - 0.016}, {1.0 - 0.5, 1.0 - 0.625}, {0.0 - 0.5, 1.0 - 0.625},
{0.812 - 0.5, 1.0 - 0.016}, {0.5 - 0.5, 1.0 - 1.0}, {0.187 - 0.5, 1.0 - 0.016}
}, aint, aint1, flag4, flag2, true, 8);
}
else if (l == 4)
{
this.createBurst(aint, aint1, flag4, flag2);
}
else
{
this.createBall(0.25D, 2, aint, aint1, flag4, flag2);
}
int j = aint[0];
float f = (float)((j & 16711680) >> 16) / 255.0F;
float f1 = (float)((j & 65280) >> 8) / 255.0F;
float f2 = (float)((j & 255) >> 0) / 255.0F;
EntityFirework.OverlayFX entityfirework$overlayfx = new EntityFirework.OverlayFX(this.worldObj, this.posX, this.posY, this.posZ);
entityfirework$overlayfx.setRBGColorF(f, f1, f2);
this.theEffectRenderer.addEffect(entityfirework$overlayfx);
}
++this.fireworkAge;
if (this.fireworkAge > this.particleMaxAge)
{
if (this.twinkle)
{
boolean flag3 = this.isFarAway();
SoundEvent s = flag3 ? SoundEvent.TWINKLE_FAR : SoundEvent.TWINKLE;
((WorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, s, 20.0F);
}
this.setDead();
}
}
private boolean isFarAway()
{
Client gm = Client.CLIENT;
return gm == null || gm.getRenderViewEntity() == null || gm.getRenderViewEntity().getDistanceSq(this.posX, this.posY, this.posZ) >= 256.0D;
}
private void createParticle(double p_92034_1_, double p_92034_3_, double p_92034_5_, double p_92034_7_, double p_92034_9_, double p_92034_11_, int[] p_92034_13_, int[] p_92034_14_, boolean p_92034_15_, boolean p_92034_16_)
{
EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(this.worldObj, p_92034_1_, p_92034_3_, p_92034_5_, p_92034_7_, p_92034_9_, p_92034_11_, this.theEffectRenderer);
entityfirework$sparkfx.setAlphaF(0.99F);
entityfirework$sparkfx.setTrail(p_92034_15_);
entityfirework$sparkfx.setTwinkle(p_92034_16_);
int i = this.rand.zrange(p_92034_13_.length);
entityfirework$sparkfx.setColour(p_92034_13_[i]);
if (p_92034_14_ != null && p_92034_14_.length > 0)
{
entityfirework$sparkfx.setFadeColour(p_92034_14_[this.rand.zrange(p_92034_14_.length)]);
}
this.theEffectRenderer.addEffect(entityfirework$sparkfx);
}
private void createBall(double speed, int size, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn)
{
double d0 = this.posX;
double d1 = this.posY;
double d2 = this.posZ;
for (int i = -size; i <= size; ++i)
{
for (int j = -size; j <= size; ++j)
{
for (int k = -size; k <= size; ++k)
{
double d3 = (double)j + (this.rand.doublev() - this.rand.doublev()) * 0.5D;
double d4 = (double)i + (this.rand.doublev() - this.rand.doublev()) * 0.5D;
double d5 = (double)k + (this.rand.doublev() - this.rand.doublev()) * 0.5D;
double d6 = (double)ExtMath.sqrtd(d3 * d3 + d4 * d4 + d5 * d5) / speed + this.rand.gaussian() * 0.05D;
this.createParticle(d0, d1, d2, d3 / d6, d4 / d6, d5 / d6, colours, fadeColours, trail, twinkleIn);
if (i != -size && i != size && j != -size && j != size)
{
k += size * 2 - 1;
}
}
}
}
}
private void createShaped(double speed, double[][] shape, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn,
boolean p_92038_8_, int div)
{
double d0 = shape[0][0];
double d1 = shape[0][1];
this.createParticle(this.posX, this.posY, this.posZ, d0 * speed, d1 * speed, 0.0D, colours, fadeColours, trail, twinkleIn);
float f = this.rand.floatv() * (float)Math.PI;
double d2 = p_92038_8_ ? 0.034D : 0.34D;
double shift = 1.0 / (double)div;
for (int i = 0; i < 3; ++i)
{
double d3 = (double)f + (double)((float)i * (float)Math.PI) * d2;
double d4 = d0;
double d5 = d1;
for (int j = 1; j < shape.length; ++j)
{
double d6 = shape[j][0];
double d7 = shape[j][1];
for (double d8 = shift; d8 <= 1.0D; d8 += shift)
{
double d9 = (d4 + (d6 - d4) * d8) * speed;
double d10 = (d5 + (d7 - d5) * d8) * speed;
double d11 = d9 * Math.sin(d3);
d9 = d9 * Math.cos(d3);
for (double d12 = -1.0D; d12 <= 1.0D; d12 += 2.0D)
{
this.createParticle(this.posX, this.posY, this.posZ, d9 * d12, d10, d11 * d12, colours, fadeColours, trail, twinkleIn);
}
}
d4 = d6;
d5 = d7;
}
}
}
private void createBurst(int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn)
{
double d0 = this.rand.gaussian() * 0.05D;
double d1 = this.rand.gaussian() * 0.05D;
for (int i = 0; i < 70; ++i)
{
double d2 = this.motionX * 0.5D + this.rand.gaussian() * 0.15D + d0;
double d3 = this.motionZ * 0.5D + this.rand.gaussian() * 0.15D + d1;
double d4 = this.motionY * 0.5D + this.rand.doublev() * 0.5D;
this.createParticle(this.posX, this.posY, this.posZ, d2, d4, d3, colours, fadeColours, trail, twinkleIn);
}
}
public int getFXLayer()
{
return 0;
}
}
} }

View file

@ -5,7 +5,6 @@ import java.util.Set;
import client.Client; import client.Client;
import client.renderer.particle.EntityFX; import client.renderer.particle.EntityFX;
import client.renderer.particle.EntityFirework;
import common.biome.Biome; import common.biome.Biome;
import common.collect.Lists; import common.collect.Lists;
import common.collect.Sets; import common.collect.Sets;
@ -25,7 +24,6 @@ import common.model.ParticleType;
import common.rng.Random; import common.rng.Random;
import common.sound.MovingSoundMinecart; import common.sound.MovingSoundMinecart;
import common.sound.PositionedSound; import common.sound.PositionedSound;
import common.tags.TagObject;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.ChunkPos; import common.util.ChunkPos;
@ -382,11 +380,6 @@ public class WorldClient extends AWorldClient
// } // }
} }
public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, TagObject compund)
{
this.gm.effectRenderer.addEffect(new EntityFirework.StarterFX(this.gm.world, x, y, z, motionX, motionY, motionZ, this.gm.effectRenderer, compund));
}
public ChunkClient getChunk(int x, int z) public ChunkClient getChunk(int x, int z)
{ {
ChunkClient chunk = this.chunkMapping.getValueByKey(LongHashMap.packInt(x, z)); ChunkClient chunk = this.chunkMapping.getValueByKey(LongHashMap.packInt(x, z));

View file

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 239 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

View file

@ -43,7 +43,7 @@ public enum Material {
EXPLOSIVE {{ EXPLOSIVE {{
this.setBurning().setTranslucent(); this.setBurning().setTranslucent();
}}, }},
BLOCKING {{ // can't be placed next to signs and banners BLOCKING {{ // can't be placed next to signs
this.setTranslucent().setNoPushMobility(); this.setTranslucent().setNoPushMobility();
}}, }},
PORTAL {{ // not floodable by liquids PORTAL {{ // not floodable by liquids

View file

@ -3,6 +3,7 @@ package common.block.foliage;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.StackSize;
import common.item.block.ItemSeedFood; import common.item.block.ItemSeedFood;
import common.model.Model; import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
@ -26,6 +27,6 @@ public class BlockCarrot extends BlockCrops
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSeedFood(3, this, Blocks.farmland).setDisplay("Karotte").setMaxAmount(128); return new ItemSeedFood(3, this, Blocks.farmland).setDisplay("Karotte").setMaxAmount(StackSize.L);
} }
} }

View file

@ -7,6 +7,7 @@ import common.init.Items;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.item.block.ItemSeeds; import common.item.block.ItemSeeds;
import common.model.Model; import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
@ -228,6 +229,6 @@ public class BlockCrops extends BlockBush implements IGrowable
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSeeds(this, Blocks.farmland).setDisplay("Weizenkörner").setMaxAmount(256); return new ItemSeeds(this, Blocks.farmland).setDisplay("Weizenkörner").setMaxAmount(StackSize.XL);
} }
} }

View file

@ -4,6 +4,7 @@ import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.item.block.ItemSeedFood; import common.item.block.ItemSeedFood;
import common.model.Model; import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
@ -45,6 +46,6 @@ public class BlockPotato extends BlockCrops
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSeedFood(1, this, Blocks.farmland).setDisplay("Kartoffel").setMaxAmount(128); return new ItemSeedFood(1, this, Blocks.farmland).setDisplay("Kartoffel").setMaxAmount(StackSize.L);
} }
} }

View file

@ -6,6 +6,7 @@ import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.StackSize;
import common.item.block.ItemSmallBlock; import common.item.block.ItemSmallBlock;
import common.model.BlockLayer; import common.model.BlockLayer;
import common.model.Model; import common.model.Model;
@ -179,6 +180,6 @@ public class BlockReed extends Block
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSmallBlock(this).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(128); return new ItemSmallBlock(this).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(StackSize.L);
} }
} }

View file

@ -7,6 +7,7 @@ import common.init.Items;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.item.block.ItemSeeds; import common.item.block.ItemSeeds;
import common.model.Model; import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
@ -306,7 +307,7 @@ public class BlockStem extends BlockBush implements DirectionalUp, IGrowable
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSeeds(this, Blocks.farmland).setDisplay(this.itemName).setMaxAmount(256); return new ItemSeeds(this, Blocks.farmland).setDisplay(this.itemName).setMaxAmount(StackSize.XL);
} }
public Property[] getUnsavedProperties() { public Property[] getUnsavedProperties() {

View file

@ -7,6 +7,7 @@ import common.init.Items;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.item.block.ItemSeeds; import common.item.block.ItemSeeds;
import common.model.Model; import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
@ -119,6 +120,6 @@ public class BlockWart extends BlockBush
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(128); return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(StackSize.L);
} }
} }

View file

@ -11,6 +11,7 @@ import common.collect.Sets;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.StackSize;
import common.item.block.ItemRedstone; import common.item.block.ItemRedstone;
import common.model.BlockLayer; import common.model.BlockLayer;
import common.model.Model; import common.model.Model;
@ -1014,7 +1015,7 @@ public class BlockRedstoneWire extends Block
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemRedstone(Blocks.redstone).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(256); return new ItemRedstone(Blocks.redstone).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(StackSize.XL);
} }
public Property[] getUnsavedProperties() { public Property[] getUnsavedProperties() {

View file

@ -112,7 +112,7 @@ public class BlockTNT extends Block
{ {
Item item = playerIn.getCurrentEquippedItem().getItem(); Item item = playerIn.getCurrentEquippedItem().getItem();
if (item == Items.flint_and_steel || item == Items.fire_charge) if (item == Items.flint_and_steel || item == Items.fireball)
{ {
this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn); this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
worldIn.setBlockToAir(pos); worldIn.setBlockToAir(pos);

View file

@ -10,6 +10,7 @@ import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.StackSize;
import common.item.block.ItemSmallBlock; import common.item.block.ItemSmallBlock;
import common.item.tool.ItemShears; import common.item.tool.ItemShears;
import common.model.BlockLayer; import common.model.BlockLayer;
@ -662,7 +663,7 @@ public class BlockTripWire extends Block
} }
protected Item getItemToRegister() { protected Item getItemToRegister() {
return new ItemSmallBlock(this).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(1024); return new ItemSmallBlock(this).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(StackSize.XXXL);
} }
public Property[] getUnsavedProperties() { public Property[] getUnsavedProperties() {

View file

@ -3,6 +3,7 @@ package common.enchantment;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import common.collect.Lists; import common.collect.Lists;
import common.collect.Maps; import common.collect.Maps;
@ -12,6 +13,7 @@ import common.entity.types.EntityLiving;
import common.init.Items; import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.rng.WeightedList; import common.rng.WeightedList;
import common.tags.TagObject; import common.tags.TagObject;
@ -59,7 +61,11 @@ public class EnchantmentHelper
public static Map<Enchantment, Integer> getEnchantments(ItemStack stack) public static Map<Enchantment, Integer> getEnchantments(ItemStack stack)
{ {
Map<Enchantment, Integer> map = Maps.<Enchantment, Integer>newLinkedHashMap(); Map<Enchantment, Integer> map = Maps.<Enchantment, Integer>newLinkedHashMap();
List<TagObject> list = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList(); if(stack.getItem() instanceof ItemEnchantedBook book) {
map.put(book.getEnchantment(), book.getLevel());
return map;
}
List<TagObject> list = stack.getEnchantmentTagList();
if (list != null) if (list != null)
{ {
@ -78,34 +84,38 @@ public class EnchantmentHelper
public static void setEnchantments(Map<Enchantment, Integer> enchMap, ItemStack stack) public static void setEnchantments(Map<Enchantment, Integer> enchMap, ItemStack stack)
{ {
List<TagObject> list = Lists.newArrayList(); if (stack.getItem() instanceof ItemEnchantedBook)
Iterator<Enchantment> iterator = enchMap.keySet().iterator();
while (iterator.hasNext())
{ {
Enchantment enchantment = iterator.next(); Entry<Enchantment, Integer> entry = new Random().pick(Lists.newArrayList(enchMap.entrySet()));
stack.setItem(ItemEnchantedBook.getEnchantedBook(entry.getKey(), entry.getValue()));
TagObject tag = new TagObject(); if(stack.hasTag())
tag.setString("id", enchantment.getName()); stack.getTag().remove("ench");
tag.setShort("lvl", (short)enchMap.get(enchantment).intValue());
list.add(tag);
if (stack.getItem() == Items.enchanted_book)
{
Items.enchanted_book.addEnchantment(stack, new RngEnchantment(enchantment, enchMap.get(enchantment).intValue()));
}
} }
else {
List<TagObject> list = Lists.newArrayList();
Iterator<Enchantment> iterator = enchMap.keySet().iterator();
if (list.size() > 0) while (iterator.hasNext())
{ {
if (stack.getItem() != Items.enchanted_book) Enchantment enchantment = iterator.next();
{
stack.setTagInfo("ench", list); TagObject tag = new TagObject();
} tag.setString("id", enchantment.getName());
} tag.setShort("lvl", (short)enchMap.get(enchantment).intValue());
else if (stack.hasTag()) list.add(tag);
{ }
stack.getTag().remove("ench");
if (list.size() > 0)
{
if (!(stack.getItem() instanceof ItemEnchantedBook))
{
stack.setTagInfo("ench", list);
}
}
else if (stack.hasTag())
{
stack.getTag().remove("ench");
}
} }
} }
@ -361,32 +371,23 @@ public class EnchantmentHelper
/** /**
* Adds a random enchantment to the specified item. Args: random, itemStack, enchantabilityLevel * Adds a random enchantment to the specified item. Args: random, itemStack, enchantabilityLevel
*/ */
public static ItemStack addRandomEnchantment(Random p_77504_0_, ItemStack p_77504_1_, int p_77504_2_) public static ItemStack addRandomEnchantment(Random rand, ItemStack stack, int enchantability)
{ {
List<RngEnchantment> list = buildEnchantmentList(p_77504_0_, p_77504_1_, p_77504_2_); List<RngEnchantment> list = buildEnchantmentList(rand, stack, enchantability);
boolean flag = p_77504_1_.getItem() == Items.book; boolean flag = stack.getItem() == Items.book;
if (flag) if (list != null && !list.isEmpty())
{ {
p_77504_1_.setItem(Items.enchanted_book); if(flag) {
} RngEnchantment enchantmentdata = rand.pick(list);
stack.setItem(ItemEnchantedBook.getEnchantedBook(enchantmentdata.enchantment, enchantmentdata.level));
if (list != null) }
{ for (RngEnchantment enchantmentdata : list) {
for (RngEnchantment enchantmentdata : list) stack.addEnchantment(enchantmentdata.enchantment, enchantmentdata.level);
{
if (flag)
{
Items.enchanted_book.addEnchantment(p_77504_1_, enchantmentdata);
}
else
{
p_77504_1_.addEnchantment(enchantmentdata.enchantment, enchantmentdata.level);
}
} }
} }
return p_77504_1_; return stack;
} }
public static List<RngEnchantment> buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int level) public static List<RngEnchantment> buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int level)

View file

@ -3,21 +3,14 @@ package common.entity.item;
import common.entity.Entity; import common.entity.Entity;
import common.entity.EntityType; import common.entity.EntityType;
import common.init.SoundEvent; import common.init.SoundEvent;
import common.item.ItemStack;
import common.model.ParticleType; import common.model.ParticleType;
import common.tags.TagObject; import common.tags.TagObject;
import common.util.ExtMath; import common.util.ExtMath;
import common.world.AWorldClient;
import common.world.World; import common.world.World;
public class EntityFireworks extends Entity public class EntityFireworks extends Entity
{ {
/** The age of the firework in ticks. */
private int fireworkAge; private int fireworkAge;
/**
* The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes.
*/
private int lifetime; private int lifetime;
public EntityFireworks(World worldIn) public EntityFireworks(World worldIn)
@ -28,52 +21,26 @@ public class EntityFireworks extends Entity
protected void entityInit() protected void entityInit()
{ {
this.dataWatcher.addObjectByDataType(8, 5);
} }
/**
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
* length * 64 * renderDistanceWeight Args: distance
*/
public boolean isInRangeToRenderDist(double distance) public boolean isInRangeToRenderDist(double distance)
{ {
return distance < 4096.0D; return distance < 4096.0D;
} }
public EntityFireworks(World worldIn, double x, double y, double z, ItemStack givenItem) public EntityFireworks(World worldIn, double x, double y, double z)
{ {
super(worldIn); super(worldIn);
this.fireworkAge = 0; this.fireworkAge = 0;
this.setSize(0.25F, 0.25F); this.setSize(0.25F, 0.25F);
this.setPosition(x, y, z); this.setPosition(x, y, z);
int i = 1;
if (givenItem != null && givenItem.hasTag())
{
this.dataWatcher.updateObject(8, givenItem);
TagObject nbttagcompound = givenItem.getTag();
TagObject nbttagcompound1 = nbttagcompound.getObject("Fireworks");
if (nbttagcompound1 != null)
{
i += nbttagcompound1.getByte("Flight");
}
}
this.motionX = this.rand.gaussian() * 0.001D; this.motionX = this.rand.gaussian() * 0.001D;
this.motionZ = this.rand.gaussian() * 0.001D; this.motionZ = this.rand.gaussian() * 0.001D;
this.motionY = 0.05D; this.motionY = 0.05D;
this.lifetime = 10 * i + this.rand.zrange(6) + this.rand.zrange(7); this.lifetime = 25 + this.rand.zrange(6) + this.rand.zrange(7);
} }
public EntityFireworks(World worldIn, double x, double y, double z)
{
this(worldIn, x, y, z, null);
}
/**
* Sets the velocity to the args. Args: x, y, z
*/
public void setVelocity(double x, double y, double z) public void setVelocity(double x, double y, double z)
{ {
this.motionX = x; this.motionX = x;
@ -88,9 +55,6 @@ public class EntityFireworks extends Entity
} }
} }
/**
* Called to update the entity's position/logic.
*/
public void onUpdate() public void onUpdate()
{ {
this.lastTickPosX = this.posX; this.lastTickPosX = this.posX;
@ -127,7 +91,7 @@ public class EntityFireworks extends Entity
this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 0.2F; this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 0.2F;
this.rotYaw = this.prevYaw + (this.rotYaw - this.prevYaw) * 0.2F; this.rotYaw = this.prevYaw + (this.rotYaw - this.prevYaw) * 0.2F;
if (this.fireworkAge == 0) // && !this.isSilent()) if (this.fireworkAge == 0)
{ {
this.worldObj.playSoundAtEntity(this, SoundEvent.LAUNCH, 3.0F); this.worldObj.playSoundAtEntity(this, SoundEvent.LAUNCH, 3.0F);
} }
@ -141,64 +105,23 @@ public class EntityFireworks extends Entity
if (!this.worldObj.client && this.fireworkAge > this.lifetime) if (!this.worldObj.client && this.fireworkAge > this.lifetime)
{ {
this.worldObj.setEntityState(this, (byte)17);
this.setDead(); this.setDead();
this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 3.0f, false, false, false); this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 3.0f, false, false, false);
} }
} }
public void handleStatusUpdate(byte id)
{
if (id == 17 && this.worldObj.client)
{
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
TagObject nbttagcompound = null;
if (itemstack != null && itemstack.hasTag())
{
nbttagcompound = itemstack.getTag().getObject("Fireworks");
}
((AWorldClient)this.worldObj).makeFireworks(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound);
}
super.handleStatusUpdate(id);
}
public void writeEntity(TagObject tagCompound) public void writeEntity(TagObject tagCompound)
{ {
tagCompound.setInt("Life", this.fireworkAge); tagCompound.setInt("Life", this.fireworkAge);
tagCompound.setInt("LifeTime", this.lifetime); tagCompound.setInt("LifeTime", this.lifetime);
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
if (itemstack != null)
{
TagObject nbttagcompound = new TagObject();
itemstack.writeTags(nbttagcompound);
tagCompound.setObject("FireworksItem", nbttagcompound);
}
} }
public void readEntity(TagObject tagCompund) public void readEntity(TagObject tagCompund)
{ {
this.fireworkAge = tagCompund.getInt("Life"); this.fireworkAge = tagCompund.getInt("Life");
this.lifetime = tagCompund.getInt("LifeTime"); this.lifetime = tagCompund.getInt("LifeTime");
TagObject nbttagcompound = tagCompund.getObject("FireworksItem");
if (nbttagcompound != null)
{
ItemStack itemstack = ItemStack.readFromTag(nbttagcompound);
if (itemstack != null)
{
this.dataWatcher.updateObject(8, itemstack);
}
}
} }
/**
* Gets how bright this entity is.
*/
public float getBrightness(float partialTicks) public float getBrightness(float partialTicks)
{ {
return super.getBrightness(partialTicks); return super.getBrightness(partialTicks);
@ -209,9 +132,6 @@ public class EntityFireworks extends Entity
return super.getBrightnessForRender(partialTicks); return super.getBrightnessForRender(partialTicks);
} }
/**
* If returns false, the item will not inflict any damage against entities.
*/
public boolean canAttackWithItem() public boolean canAttackWithItem()
{ {
return false; return false;

View file

@ -21,7 +21,6 @@ import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemDye; import common.item.material.ItemDye;
import common.item.tool.ItemArmor; import common.item.tool.ItemArmor;
import common.tags.TagObject;
public abstract class CraftingRegistry public abstract class CraftingRegistry
{ {
@ -208,7 +207,6 @@ public abstract class CraftingRegistry
} }
recipes.add(new RecipesArmorDyes()); recipes.add(new RecipesArmorDyes());
recipes.add(new RecipeFireworks());
recipes.add(new RecipeRepairItem()); recipes.add(new RecipeRepairItem());
add(new ItemStack(Items.paper, 3), "###", '#', Items.reeds); add(new ItemStack(Items.paper, 3), "###", '#', Items.reeds);
@ -323,8 +321,8 @@ public abstract class CraftingRegistry
add(new ItemStack(Items.enchanting_table, 1), " B ", "D#D", "###", '#', Items.obsidian, 'B', Items.book, 'D', Items.diamond); add(new ItemStack(Items.enchanting_table, 1), " B ", "D#D", "###", '#', Items.obsidian, 'B', Items.book, 'D', Items.diamond);
add(new ItemStack(Items.anvil, 1), "III", " i ", "iii", 'I', Items.iron_block, 'i', Items.iron_ingot); add(new ItemStack(Items.anvil, 1), "III", " i ", "iii", 'I', Items.iron_block, 'i', Items.iron_ingot);
addShapeless(new ItemStack(Items.charged_orb, 1), Items.orb, Items.blazing_powder); addShapeless(new ItemStack(Items.charged_orb, 1), Items.orb, Items.blazing_powder);
addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blazing_powder, Items.coal); addShapeless(new ItemStack(Items.fireball, 3), Items.gunpowder, Items.blazing_powder, Items.coal);
addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blazing_powder, Items.charcoal); addShapeless(new ItemStack(Items.fireball, 3), Items.gunpowder, Items.blazing_powder, Items.charcoal);
add(new ItemStack(Items.hopper), "I I", "ICI", " I ", 'I', Items.iron_ingot, 'C', Items.chest); add(new ItemStack(Items.hopper), "I I", "ICI", " I ", 'I', Items.iron_ingot, 'C', Items.chest);
@ -509,265 +507,6 @@ public abstract class CraftingRegistry
ItemStack[] getRemainingItems(InventoryCrafting inv); ItemStack[] getRemainingItems(InventoryCrafting inv);
} }
private static class RecipeFireworks implements IRecipe
{
private ItemStack field_92102_a;
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv)
{
this.field_92102_a = null;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = 0; k1 < inv.getSizeInventory(); ++k1)
{
ItemStack itemstack = inv.getStackInSlot(k1);
if (itemstack != null)
{
if (itemstack.getItem() == Items.gunpowder)
{
++j;
}
else if (itemstack.getItem() == Items.firework_charge)
{
++l;
}
else if (itemstack.getItem() instanceof ItemDye)
{
++k;
}
else if (itemstack.getItem() == Items.paper)
{
++i;
}
else if (itemstack.getItem() == Items.glowstone_dust)
{
++i1;
}
else if (itemstack.getItem() == Items.diamond)
{
++i1;
}
else if (itemstack.getItem() == Items.fire_charge)
{
++j1;
}
else if (itemstack.getItem() == Items.feather)
{
++j1;
}
else if (itemstack.getItem() == Items.gold_nugget)
{
++j1;
}
else
{
if (itemstack.getItem() != Items.skull)
{
return false;
}
++j1;
}
}
}
i1 = i1 + k + j1;
if (j <= 3 && i <= 1)
{
if (j >= 1 && i == 1 && i1 == 0)
{
this.field_92102_a = new ItemStack(Items.fireworks);
if (l > 0)
{
TagObject tag = new TagObject();
TagObject data = new TagObject();
List<TagObject> list = Lists.newArrayList();
for (int k2 = 0; k2 < inv.getSizeInventory(); ++k2)
{
ItemStack itemstack3 = inv.getStackInSlot(k2);
if (itemstack3 != null && itemstack3.getItem() == Items.firework_charge && itemstack3.hasTag() && itemstack3.getTag().hasObject("Explosion"))
{
list.add(itemstack3.getTag().getObject("Explosion"));
}
}
data.setList("Explosions", list);
data.setByte("Flight", (byte)j);
tag.setObject("Fireworks", data);
this.field_92102_a.setTag(tag);
}
return true;
}
else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1)
{
this.field_92102_a = new ItemStack(Items.firework_charge);
TagObject tag = new TagObject();
TagObject data = new TagObject();
byte b0 = 0;
List<Integer> list = Lists.<Integer>newArrayList();
for (int l1 = 0; l1 < inv.getSizeInventory(); ++l1)
{
ItemStack itemstack2 = inv.getStackInSlot(l1);
if (itemstack2 != null)
{
if (itemstack2.getItem() instanceof ItemDye dye)
{
list.add(dye.getColor().getColor());
}
else if (itemstack2.getItem() == Items.glowstone_dust)
{
data.setBool("Flicker", true);
}
else if (itemstack2.getItem() == Items.diamond)
{
data.setBool("Trail", true);
}
else if (itemstack2.getItem() == Items.fire_charge)
{
b0 = 1;
}
else if (itemstack2.getItem() == Items.feather)
{
b0 = 4;
}
else if (itemstack2.getItem() == Items.gold_nugget)
{
b0 = 2;
}
else if (itemstack2.getItem() == Items.skull)
{
b0 = 3;
}
}
}
int[] aint1 = new int[list.size()];
for (int l2 = 0; l2 < aint1.length; ++l2)
{
aint1[l2] = ((Integer)list.get(l2)).intValue();
}
data.setIntArray("Colors", aint1);
data.setByte("Type", b0);
tag.setObject("Explosion", data);
this.field_92102_a.setTag(tag);
return true;
}
else if (j == 0 && i == 0 && l == 1 && k > 0 && k == i1)
{
List<Integer> list1 = Lists.<Integer>newArrayList();
for (int i2 = 0; i2 < inv.getSizeInventory(); ++i2)
{
ItemStack itemstack1 = inv.getStackInSlot(i2);
if (itemstack1 != null)
{
if (itemstack1.getItem() instanceof ItemDye dye)
{
list1.add(dye.getColor().getColor());
}
else if (itemstack1.getItem() == Items.firework_charge)
{
this.field_92102_a = itemstack1.copy();
this.field_92102_a.size = 1;
}
}
}
int[] aint = new int[list1.size()];
for (int j2 = 0; j2 < aint.length; ++j2)
{
aint[j2] = ((Integer)list1.get(j2)).intValue();
}
if (this.field_92102_a != null && this.field_92102_a.hasTag())
{
TagObject tag = this.field_92102_a.getTag().getObject("Explosion");
if (tag == null)
{
return false;
}
else
{
tag.setIntArray("FadeColors", aint);
return true;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
return this.field_92102_a.copy();
}
/**
* Returns the size of the recipe area
*/
public int getRecipeSize()
{
return 10;
}
public ItemStack getRecipeOutput()
{
return this.field_92102_a;
}
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && itemstack.getItem().hasContainerItem())
{
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
}
}
return aitemstack;
}
}
private static class RecipeRepairItem implements IRecipe private static class RecipeRepairItem implements IRecipe
{ {
/** /**

View file

@ -49,6 +49,8 @@ import common.entity.projectile.EntityPotion;
import common.entity.projectile.EntitySnowball; import common.entity.projectile.EntitySnowball;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.entity.types.IObjectData; import common.entity.types.IObjectData;
import common.item.spawner.ItemMonsterPlacer;
import common.item.spawner.ItemNpcSpawner;
import common.log.Log; import common.log.Log;
import common.tags.TagObject; import common.tags.TagObject;
import common.world.World; import common.world.World;
@ -266,5 +268,12 @@ public abstract class EntityRegistry {
registerEntity("Bullet", EntityBullet.class, "Kugel"); registerEntity("Bullet", EntityBullet.class, "Kugel");
registerEggs(); registerEggs();
for(ItemMonsterPlacer item : ItemMonsterPlacer.SPAWNERS) {
item.delegateSetDisplay();
}
for(ItemNpcSpawner item : ItemNpcSpawner.SPAWNERS) {
item.delegateSetDisplay();
}
} }
} }

View file

@ -17,6 +17,7 @@ import common.collect.HashBiMap;
import common.collect.Lists; import common.collect.Lists;
import common.color.DyeColor; import common.color.DyeColor;
import common.color.TextColor; import common.color.TextColor;
import common.enchantment.Enchantment;
import common.entity.item.EntityCart; import common.entity.item.EntityCart;
import common.entity.npc.CharacterInfo; import common.entity.npc.CharacterInfo;
import common.entity.npc.SpeciesInfo; import common.entity.npc.SpeciesInfo;
@ -30,6 +31,7 @@ import common.item.ItemSmall;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.ItemStick; import common.item.ItemStick;
import common.item.ItemTiny; import common.item.ItemTiny;
import common.item.StackSize;
import common.item.material.ItemBook; import common.item.material.ItemBook;
import common.item.material.ItemDye; import common.item.material.ItemDye;
import common.item.material.ItemEnchantedBook; import common.item.material.ItemEnchantedBook;
@ -61,7 +63,6 @@ import common.item.tool.ItemExpBottle;
import common.item.tool.ItemExterminator; import common.item.tool.ItemExterminator;
import common.item.tool.ItemFireball; import common.item.tool.ItemFireball;
import common.item.tool.ItemFirework; import common.item.tool.ItemFirework;
import common.item.tool.ItemFireworkCharge;
import common.item.tool.ItemFishFood; import common.item.tool.ItemFishFood;
import common.item.tool.ItemFishingRod; import common.item.tool.ItemFishingRod;
import common.item.tool.ItemFlintAndSteel; import common.item.tool.ItemFlintAndSteel;
@ -165,7 +166,7 @@ public abstract class ItemRegistry {
if(item != null) { if(item != null) {
if(item.getTab() == null || !item.getTab().isBlockTab()) if(item.getTab() == null || !item.getTab().isBlockTab())
throw new IllegalArgumentException("Gegenstand für " + BlockRegistry.getName(block) + " muss einen Block-Tab besitzen"); throw new IllegalArgumentException("Gegenstand für " + BlockRegistry.getName(block) + " muss einen Block-Tab besitzen");
if(item.getItemStackLimit() == 1) if(item.getMaxAmount() == 1)
throw new IllegalArgumentException("Gegenstand für " + BlockRegistry.getName(block) + " muss stapelbar sein"); throw new IllegalArgumentException("Gegenstand für " + BlockRegistry.getName(block) + " muss stapelbar sein");
ITEMS.add(item); ITEMS.add(item);
ITEM_MAP.put(BlockRegistry.getName(block), item); ITEM_MAP.put(BlockRegistry.getName(block), item);
@ -173,17 +174,17 @@ public abstract class ItemRegistry {
} }
} }
Item bucket = (new ItemBucket(null, false)).setDisplay("Eimer"); Item bucket = (new ItemBucket(null, false));
register("bucket", bucket); register("bucket", bucket);
for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) { for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) {
register(BlockRegistry.getName(liquid.first()) + register(BlockRegistry.getName(liquid.first()) +
"_bucket", new ItemBucket(liquid.second(), false).setDisplay("Eimer") "_bucket", new ItemBucket(liquid.second(), false)
.setContainerItem(bucket)); .setContainerItem(bucket));
} }
register("recursive_bucket", (new ItemBucket(null, true)).setDisplay("Unendlicher Eimer")); register("recursive_bucket", (new ItemBucket(null, true)));
for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) { for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) {
register("recursive_" + BlockRegistry.getName(liquid.first()) + register("recursive_" + BlockRegistry.getName(liquid.first()) +
"_bucket", new ItemBucket(liquid.second(), true).setDisplay("Flutender Eimer")); "_bucket", new ItemBucket(liquid.second(), true));
} }
register("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket)); register("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket));
@ -195,13 +196,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()) {
register(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id())) register(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id()))
.setDisplay("Spawner").setMaxAmount(128)); .setMaxAmount(StackSize.L));
} }
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)
register(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner") register(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo))
.setMaxAmount(128)); .setMaxAmount(StackSize.L));
} }
} }
@ -209,37 +210,37 @@ public abstract class ItemRegistry {
register("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug")); register("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug"));
register("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter")); register("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter"));
register("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung")); register("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung"));
register("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxAmount(128)); register("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxAmount(StackSize.L));
for(Pair<Integer, TextColor> sides : ItemDie.DIE_SIDES) { for(Pair<Integer, TextColor> sides : ItemDie.DIE_SIDES) {
register("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("Würfel").setMaxAmount(128)); register("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setMaxAmount(StackSize.L));
} }
register("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet")); register("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
register("magnet", (new ItemMagnet(false)).setDisplay("Magnet")); register("magnet", (new ItemMagnet(false)).setDisplay("Magnet"));
register("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS)); register("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS));
for(Weather weather : Weather.values()) { for(Weather weather : Weather.values()) {
register("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setDisplay("Wetterkristall").setTab(CheatTab.MAGIC)); register("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setTab(CheatTab.MAGIC));
} }
register("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug")); register("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug"));
register("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele")); register("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele"));
register("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug")); register("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug"));
register("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(128)); register("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(StackSize.L));
register("bow", (new ItemBow()).setDisplay("Bogen")); register("bow", (new ItemBow()).setDisplay("Bogen"));
register("boltgun", (new ItemBoltgun()).setDisplay("Bolter")); register("boltgun", (new ItemBoltgun()).setDisplay("Bolter"));
register("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition")); register("bolt", (new ItemAmmo(5, 1.0f, StackSize.L)).setDisplay("Bolter-Munition"));
register("arrow", (new ItemArrow()).setDisplay("Pfeil").setTab(CheatTab.WEAPONS).setMaxAmount(128)); register("arrow", (new ItemArrow()).setDisplay("Pfeil").setTab(CheatTab.WEAPONS).setMaxAmount(StackSize.L));
Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS); Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS);
register("coal", coal); register("coal", coal);
register("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS)); register("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS));
register("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC)); register("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
register("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe")); register("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(512)); register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("bread", (new ItemFood(5, false)).setDisplay("Brot")); register("bread", (new ItemFood(5, false)).setDisplay("Brot"));
register("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch")); register("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
register("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch")); register("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch"));
register("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F) register("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
@ -247,34 +248,34 @@ public abstract class ItemRegistry {
register("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F) register("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
.setDisplay("Geladener Apfel")); .setDisplay("Geladener Apfel"));
register("saddle", (new ItemSaddle()).setDisplay("Sattel")); register("saddle", (new ItemSaddle()).setDisplay("Sattel"));
register("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128)); register("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(StackSize.L));
register("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS)); register("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS));
register("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS)); register("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS));
register("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC)); register("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC));
register("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128)); register("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(StackSize.L));
register("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS)); register("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS));
register("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer")); register("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer"));
register("fishing_rod", (new ItemFishingRod()).setDisplay("Angel")); register("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
register("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect) register("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
.setTab(CheatTab.MATERIALS).setMaxAmount(256)); .setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) { for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) {
register(type.getName(), (new ItemFishFood(false, type)).setDisplay(type.getDisplay())); register(type.getName(), (new ItemFishFood(false, type)));
if(type.canCook()) if(type.canCook())
register("cooked_" + type.getName(), (new ItemFishFood(true, type)).setDisplay(type.getDisplay())); register("cooked_" + type.getName(), (new ItemFishFood(true, type)));
} }
Item lapis = null; Item lapis = null;
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(512); Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(StackSize.XXL);
if(color == DyeColor.BLUE) if(color == DyeColor.BLUE)
lapis = dye; lapis = dye;
register(color.getDye(), dye); register(color.getDye(), dye);
} }
register("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512)); register("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(128)); register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(StackSize.L));
register("melon", (new ItemFood(2, false)).setDisplay("Melone")); register("melon", (new ItemFood(2, false)).setDisplay("Melone"));
register("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch")); register("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch"));
register("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak")); register("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak"));
@ -282,47 +283,53 @@ public abstract class ItemRegistry {
register("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen")); register("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
register("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch")); register("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.MAGIC)); register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.MAGIC));
register("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256)); register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(StackSize.XL));
for(int data : ItemPotion.getValidDataValues()) { for(int data : ItemPotion.getValidDataValues()) {
ItemPotion potion = new ItemPotion(data); ItemPotion potion = new ItemPotion(data);
register(ItemPotion.getPotionName(potion), potion.setDisplay("Trank")); register(ItemPotion.getPotionName(potion), potion);
} }
register("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche")); register("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
register("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge") register("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(128)); .setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(StackSize.L));
register("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge") register("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge")
.setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(128)); .setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(StackSize.L));
register("blazing_powder", (new Item()).setDisplay("Glühender Staub").setPotionEffect(PotionHelper.blazingPowderEffect) register("blazing_powder", (new Item()).setDisplay("Glühender Staub").setPotionEffect(PotionHelper.blazingPowderEffect)
.setTab(CheatTab.MATERIALS).setMaxAmount(256)); .setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
register("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
register("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel")); register("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
register("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect) register("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect)
.setTab(CheatTab.MISC)); .setTab(CheatTab.MISC));
register("experience_bottle", (new ItemExpBottle()).setDisplay("Erfahrungsfläschchen")); register("experience_bottle", (new ItemExpBottle()).setDisplay("Erfahrungsfläschchen"));
register("fire_charge", (new ItemFireball()).setDisplay("Feuerkugel")); register("fireball", (new ItemFireball()).setDisplay("Feuerkugel"));
register("writable_book", (new Item()).setDisplay("Buch und Feder").setTab(CheatTab.TOOLS)); register("writable_book", (new Item()).setDisplay("Buch und Feder").setTab(CheatTab.TOOLS));
register("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC)); register("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC));
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS); Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS);
register("emerald", emerald); register("emerald", emerald);
register("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(128)); register("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(StackSize.L));
register("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(128)); register("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(StackSize.L));
register("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte") register("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
.setPotionEffect(PotionHelper.goldenCarrotEffect)); .setPotionEffect(PotionHelper.goldenCarrotEffect));
register("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute")); register("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute"));
register("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA)); register("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA));
register("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.FOOD)); register("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.FOOD));
register("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete").setTab(CheatTab.EXPLOSIVES)); register("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete").setTab(CheatTab.EXPLOSIVES));
register("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS)); for(Enchantment ench : Enchantment.values()) {
register("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.ENCHANTMENTS)); register("enchanted_book_" + ench.getName(), (new ItemEnchantedBook(ench, 1)).setUnstackable().setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(1)).setTab(CheatTab.ENCHANTMENTS));
int max = ench.getMaxLevel();
for(int level = 2; level <= max; level++) {
if((level % 2 == 1 || level == max) && (level != max - 1))
register("enchanted_book_" + ench.getName() + "_" + level, (new ItemEnchantedBook(ench, level)).setUnstackable().setDisplay("Verzaubertes Buch mit " + ench.getFormattedName(level)).setTab(CheatTab.ENCHANTMENTS));
}
}
register("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS)); register("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
register("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS)); register("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS));
Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS); Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS);
register("quartz", quartz); register("quartz", quartz);
Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS); Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS);
register("black_quartz", bquartz); register("black_quartz", bquartz);
register("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(128)); register("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(StackSize.L));
register("name_tag", (new ItemNameTag()).setDisplay("Namensschild")); register("name_tag", (new ItemNameTag()).setDisplay("Namensschild"));
for(int z = 0; z < ItemDynamite.DYNAMITE.length; z++) { for(int z = 0; z < ItemDynamite.DYNAMITE.length; z++) {
register("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(TextColor.RED)); register("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(TextColor.RED));

View file

@ -61,7 +61,6 @@ import common.item.tool.ItemExpBottle;
import common.item.tool.ItemExterminator; import common.item.tool.ItemExterminator;
import common.item.tool.ItemFireball; import common.item.tool.ItemFireball;
import common.item.tool.ItemFirework; import common.item.tool.ItemFirework;
import common.item.tool.ItemFireworkCharge;
import common.item.tool.ItemFishFood; import common.item.tool.ItemFishFood;
import common.item.tool.ItemFishingRod; import common.item.tool.ItemFishingRod;
import common.item.tool.ItemFlintAndSteel; import common.item.tool.ItemFlintAndSteel;
@ -366,7 +365,6 @@ public abstract class Items {
public static final Item emerald = get("emerald"); public static final Item emerald = get("emerald");
public static final ItemBlock emerald_block = get("emerald_block"); public static final ItemBlock emerald_block = get("emerald_block");
public static final ItemBlock emerald_ore = get("emerald_ore"); public static final ItemBlock emerald_ore = get("emerald_ore");
public static final ItemEnchantedBook enchanted_book = get("enchanted_book");
public static final ItemBlock enchanting_table = get("enchanting_table"); public static final ItemBlock enchanting_table = get("enchanting_table");
public static final ItemExpBottle experience_bottle = get("experience_bottle"); public static final ItemExpBottle experience_bottle = get("experience_bottle");
public static final ItemExterminator exterminator = get("exterminator"); public static final ItemExterminator exterminator = get("exterminator");
@ -374,8 +372,7 @@ public abstract class Items {
public static final Item feather = get("feather"); public static final Item feather = get("feather");
public static final Item fermented_spider_eye = get("fermented_spider_eye"); public static final Item fermented_spider_eye = get("fermented_spider_eye");
public static final ItemColored fern = get("fern"); public static final ItemColored fern = get("fern");
public static final ItemFireball fire_charge = get("fire_charge"); public static final ItemFireball fireball = get("fireball");
public static final ItemFireworkCharge firework_charge = get("firework_charge");
public static final ItemFirework fireworks = get("fireworks"); public static final ItemFirework fireworks = get("fireworks");
public static final ItemFishingRod fishing_rod = get("fishing_rod"); public static final ItemFishingRod fishing_rod = get("fishing_rod");
public static final Item flint = get("flint"); public static final Item flint = get("flint");
@ -973,6 +970,54 @@ public abstract class Items {
public static final ItemBlock display = get("display"); public static final ItemBlock display = get("display");
public static final ItemBlock display2 = get("display2"); public static final ItemBlock display2 = get("display2");
public static final ItemBlock display4 = get("display4"); public static final ItemBlock display4 = get("display4");
public static final ItemEnchantedBook enchanted_book_blast_protection = get("enchanted_book_blast_protection");
public static final ItemEnchantedBook enchanted_book_blast_protection_4 = get("enchanted_book_blast_protection_4");
public static final ItemEnchantedBook enchanted_book_draining = get("enchanted_book_draining");
public static final ItemEnchantedBook enchanted_book_draining_11 = get("enchanted_book_draining_11");
public static final ItemEnchantedBook enchanted_book_draining_13 = get("enchanted_book_draining_13");
public static final ItemEnchantedBook enchanted_book_draining_16 = get("enchanted_book_draining_16");
public static final ItemEnchantedBook enchanted_book_draining_3 = get("enchanted_book_draining_3");
public static final ItemEnchantedBook enchanted_book_draining_5 = get("enchanted_book_draining_5");
public static final ItemEnchantedBook enchanted_book_draining_7 = get("enchanted_book_draining_7");
public static final ItemEnchantedBook enchanted_book_draining_9 = get("enchanted_book_draining_9");
public static final ItemEnchantedBook enchanted_book_efficiency = get("enchanted_book_efficiency");
public static final ItemEnchantedBook enchanted_book_efficiency_3 = get("enchanted_book_efficiency_3");
public static final ItemEnchantedBook enchanted_book_efficiency_5 = get("enchanted_book_efficiency_5");
public static final ItemEnchantedBook enchanted_book_feather_falling = get("enchanted_book_feather_falling");
public static final ItemEnchantedBook enchanted_book_feather_falling_4 = get("enchanted_book_feather_falling_4");
public static final ItemEnchantedBook enchanted_book_fire_aspect = get("enchanted_book_fire_aspect");
public static final ItemEnchantedBook enchanted_book_fire_aspect_2 = get("enchanted_book_fire_aspect_2");
public static final ItemEnchantedBook enchanted_book_fire_protection = get("enchanted_book_fire_protection");
public static final ItemEnchantedBook enchanted_book_fire_protection_4 = get("enchanted_book_fire_protection_4");
public static final ItemEnchantedBook enchanted_book_flame = get("enchanted_book_flame");
public static final ItemEnchantedBook enchanted_book_fortune = get("enchanted_book_fortune");
public static final ItemEnchantedBook enchanted_book_fortune_3 = get("enchanted_book_fortune_3");
public static final ItemEnchantedBook enchanted_book_infinity = get("enchanted_book_infinity");
public static final ItemEnchantedBook enchanted_book_knockback = get("enchanted_book_knockback");
public static final ItemEnchantedBook enchanted_book_knockback_2 = get("enchanted_book_knockback_2");
public static final ItemEnchantedBook enchanted_book_looting = get("enchanted_book_looting");
public static final ItemEnchantedBook enchanted_book_looting_3 = get("enchanted_book_looting_3");
public static final ItemEnchantedBook enchanted_book_luck_of_the_sea = get("enchanted_book_luck_of_the_sea");
public static final ItemEnchantedBook enchanted_book_luck_of_the_sea_3 = get("enchanted_book_luck_of_the_sea_3");
public static final ItemEnchantedBook enchanted_book_lure = get("enchanted_book_lure");
public static final ItemEnchantedBook enchanted_book_lure_3 = get("enchanted_book_lure_3");
public static final ItemEnchantedBook enchanted_book_power = get("enchanted_book_power");
public static final ItemEnchantedBook enchanted_book_power_3 = get("enchanted_book_power_3");
public static final ItemEnchantedBook enchanted_book_power_5 = get("enchanted_book_power_5");
public static final ItemEnchantedBook enchanted_book_projectile_protection = get("enchanted_book_projectile_protection");
public static final ItemEnchantedBook enchanted_book_projectile_protection_4 = get("enchanted_book_projectile_protection_4");
public static final ItemEnchantedBook enchanted_book_protection = get("enchanted_book_protection");
public static final ItemEnchantedBook enchanted_book_protection_4 = get("enchanted_book_protection_4");
public static final ItemEnchantedBook enchanted_book_punch = get("enchanted_book_punch");
public static final ItemEnchantedBook enchanted_book_punch_2 = get("enchanted_book_punch_2");
public static final ItemEnchantedBook enchanted_book_sharpness = get("enchanted_book_sharpness");
public static final ItemEnchantedBook enchanted_book_sharpness_3 = get("enchanted_book_sharpness_3");
public static final ItemEnchantedBook enchanted_book_sharpness_5 = get("enchanted_book_sharpness_5");
public static final ItemEnchantedBook enchanted_book_silk_touch = get("enchanted_book_silk_touch");
public static final ItemEnchantedBook enchanted_book_thorns = get("enchanted_book_thorns");
public static final ItemEnchantedBook enchanted_book_thorns_3 = get("enchanted_book_thorns_3");
public static final ItemEnchantedBook enchanted_book_unbreaking = get("enchanted_book_unbreaking");
public static final ItemEnchantedBook enchanted_book_unbreaking_3 = get("enchanted_book_unbreaking_3");
private static <T extends Item> T get(String id) { private static <T extends Item> T get(String id) {
T item = (T)ItemRegistry.byName(id); T item = (T)ItemRegistry.byName(id);

View file

@ -2,9 +2,9 @@ package common.init;
import common.enchantment.Enchantment; import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper; import common.enchantment.EnchantmentHelper;
import common.enchantment.RngEnchantment;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.village.MerchantRecipe; import common.village.MerchantRecipe;
import common.village.MerchantRecipeList; import common.village.MerchantRecipeList;
@ -149,7 +149,7 @@ public abstract class TradeRegistry {
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
Enchantment enchantment = random.pick(Enchantment.values()); Enchantment enchantment = random.pick(Enchantment.values());
int i = random.range(enchantment.getMinLevel(), enchantment.getMaxLevel()); int i = random.range(enchantment.getMinLevel(), enchantment.getMaxLevel());
ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new RngEnchantment(enchantment, i)); ItemStack itemstack = new ItemStack(ItemEnchantedBook.getEnchantedBook(enchantment, i));
int j = 2 + random.zrange(5 + i * 10) + 3 * i; int j = 2 + random.zrange(5 + i * 10) + 3 * i;
if(j > 64) { if(j > 64) {

View file

@ -757,7 +757,7 @@ public abstract class Container
break; break;
case 2: case 2:
p_94525_2_.size = p_94525_2_.getItem().getItemStackLimit(); p_94525_2_.size = p_94525_2_.getItem().getMaxAmount();
} }
p_94525_2_.size += p_94525_3_; p_94525_2_.size += p_94525_3_;

View file

@ -9,6 +9,7 @@ import common.entity.npc.EntityNPC;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.Pair; import common.util.Pair;
@ -240,20 +241,20 @@ public class ContainerEnchantment extends Container
List<RngEnchantment> ench = this.getRandomEnchantments(stack, id, this.mana[id]); List<RngEnchantment> ench = this.getRandomEnchantments(stack, id, this.mana[id]);
boolean book = stack.getItem() == Items.book; boolean book = stack.getItem() == Items.book;
if(ench != null) { if(ench != null && !ench.isEmpty()) {
player.useMana(cost); player.useMana(cost);
player.updateEnchSeed(); player.updateEnchSeed();
if(book) if(book) {
stack.setItem(Items.enchanted_book); RngEnchantment itm = this.world.rand.pick(ench);
stack.setItem(ItemEnchantedBook.getEnchantedBook(itm.enchantment, itm.level));
}
else {
for(int z = 0; z < ench.size(); z++) {
RngEnchantment itm = ench.get(z);
for(int z = 0; z < ench.size(); z++) {
RngEnchantment itm = ench.get(z);
if(book)
Items.enchanted_book.addEnchantment(stack, itm);
else
stack.addEnchantment(itm.enchantment, itm.level); stack.addEnchantment(itm.enchantment, itm.level);
}
} }
this.table.markDirty(); this.table.markDirty();

View file

@ -7,8 +7,8 @@ import common.block.tech.BlockAnvil;
import common.enchantment.Enchantment; import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper; import common.enchantment.EnchantmentHelper;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.Items;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.material.ItemEnchantedBook;
import common.util.BlockPos; import common.util.BlockPos;
import common.vars.Vars; import common.vars.Vars;
import common.world.State; import common.world.State;
@ -195,7 +195,7 @@ public class ContainerRepair extends Container
if (repStack != null) if (repStack != null)
{ {
isBook = repStack.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(repStack).size() > 0; isBook = repStack.getItem() instanceof ItemEnchantedBook;
if (newStack.isItemStackDamageable() && newStack.getItem().getIsRepairable(stack, repStack)) if (newStack.isItemStackDamageable() && newStack.getItem().getIsRepairable(stack, repStack))
{ {
@ -275,7 +275,7 @@ public class ContainerRepair extends Container
level = diff; level = diff;
boolean applies = enchantment.canApply(stack); boolean applies = enchantment.canApply(stack);
if (/* this.thePlayer.creative || */ stack.getItem() == Items.enchanted_book) if (/* this.thePlayer.creative || */ stack.getItem() instanceof ItemEnchantedBook)
{ {
applies = true; applies = true;
} }

View file

@ -13,7 +13,7 @@ public enum CheatTab {
public void filter(List<ItemStack> list) { public void filter(List<ItemStack> list) {
for(Item item : ItemRegistry.items()) { for(Item item : ItemRegistry.items()) {
item.getSubItems(list); list.add(new ItemStack(item));
} }
} }
}, },
@ -99,7 +99,7 @@ public enum CheatTab {
}, },
ENCHANTMENTS("Verzauberungen", false) { ENCHANTMENTS("Verzauberungen", false) {
protected Item getIconItem() { protected Item getIconItem() {
return Items.enchanted_book; return Items.enchanted_book_unbreaking;
} }
}, },
MAGIC("Magie", false) { MAGIC("Magie", false) {
@ -140,7 +140,7 @@ public enum CheatTab {
public void filter(List<ItemStack> list) { public void filter(List<ItemStack> list) {
for(Item item : ItemRegistry.items()) { for(Item item : ItemRegistry.items()) {
if(item.getBlock() != null) if(item.getBlock() != null)
item.getSubItems(list); list.add(new ItemStack(item));
} }
} }
}, },
@ -152,7 +152,7 @@ public enum CheatTab {
public void filter(List<ItemStack> list) { public void filter(List<ItemStack> list) {
for(Item item : ItemRegistry.items()) { for(Item item : ItemRegistry.items()) {
if(item.getBlock() == null) if(item.getBlock() == null)
item.getSubItems(list); list.add(new ItemStack(item));
} }
} }
}; };
@ -202,7 +202,7 @@ public enum CheatTab {
public void filter(List<ItemStack> list) { public void filter(List<ItemStack> list) {
for(Item item : ItemRegistry.items()) { for(Item item : ItemRegistry.items()) {
if(item.getTab() == this) if(item.getTab() == this)
item.getSubItems(list); list.add(new ItemStack(item));
} }
} }
} }

View file

@ -14,7 +14,6 @@ import common.entity.types.IProjectile;
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.tags.TagObject;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.ExtMath; import common.util.ExtMath;
@ -24,9 +23,7 @@ import common.util.Vec3;
import common.world.World; import common.world.World;
public class Item { public class Item {
private final List<TagObject> validTags; private int maxAmount = StackSize.M.getAmount();
private int maxAmount = 64;
private int maxDamage = 0; private int maxDamage = 0;
private Item containerItem; private Item containerItem;
private String potionEffect; private String potionEffect;
@ -34,18 +31,14 @@ public class Item {
private CheatTab tab; private CheatTab tab;
private TextColor color = null; private TextColor color = null;
public Item() {
this.validTags = this.getItemTags();
}
public final Item setUnstackable() { public final Item setUnstackable() {
this.maxAmount = 1; this.maxAmount = 1;
this.maxDamage = 0; this.maxDamage = 0;
return this; return this;
} }
public final Item setMaxAmount(int max) { public final Item setMaxAmount(StackSize size) {
this.maxAmount = max; this.maxAmount = size.getAmount();
this.maxDamage = 0; this.maxDamage = 0;
return this; return this;
} }
@ -81,7 +74,7 @@ public class Item {
return this; return this;
} }
public final int getItemStackLimit() { public final int getMaxAmount() {
return this.maxAmount; return this.maxAmount;
} }
@ -93,6 +86,64 @@ public class Item {
return this.maxDamage > 0; return this.maxDamage > 0;
} }
public final String getDisplay(ItemStack stack) {
return this.display;
}
public final Item getContainerItem() {
return this.containerItem;
}
public final boolean hasContainerItem() {
return this.containerItem != null;
}
public final String getPotionEffect(ItemStack stack) {
return this.potionEffect;
}
public final boolean isPotionIngredient(ItemStack stack) {
return this.getPotionEffect(stack) != null;
}
public final TextColor getColor(ItemStack stack) {
return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE);
}
public final CheatTab getTab() {
return this.tab;
}
protected final HitPosition getMovingObjectPositionFromPlayer(World worldIn, EntityNPC playerIn, boolean useLiquids) {
float f = playerIn.rotPitch;
float f1 = playerIn.rotYaw;
double d0 = playerIn.posX;
double d1 = playerIn.posY + (double)playerIn.getEyeHeight();
double d2 = playerIn.posZ;
Vec3 vec3 = new Vec3(d0, d1, d2);
float f2 = ExtMath.cos(-f1 * 0.017453292F - (float)Math.PI);
float f3 = ExtMath.sin(-f1 * 0.017453292F - (float)Math.PI);
float f4 = -ExtMath.cos(-f * 0.017453292F);
float f5 = ExtMath.sin(-f * 0.017453292F);
float f6 = f3 * f4;
float f7 = f2 * f4;
double d3 = 5.0D;
Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
}
protected final ItemStack dispenseProjectile(World world, Facing facing, ItemStack stack, IProjectile entity) {
return this.dispenseProjectile(world, facing, stack, entity, 1.1f, 6.0f);
}
protected final ItemStack dispenseProjectile(World world, Facing facing, ItemStack stack, IProjectile entity, float velocity, float inaccuracy) {
entity.setThrowableHeading((double)facing.getFrontOffsetX(), (double)((float)facing.getFrontOffsetY() + 0.1F),
(double)facing.getFrontOffsetZ(), velocity, inaccuracy);
world.spawnEntityInWorld((Entity)entity);
stack.splitStack(1);
return stack;
}
public Block getBlock() { public Block getBlock() {
return null; return null;
} }
@ -133,18 +184,6 @@ public class Item {
return false; return false;
} }
public String getDisplay(ItemStack stack) {
return this.display;
}
public Item getContainerItem() {
return this.containerItem;
}
public boolean hasContainerItem() {
return this.containerItem != null;
}
public int getColorFromItemStack(ItemStack stack, int renderPass) { public int getColorFromItemStack(ItemStack stack, int renderPass) {
return 16777215; return 16777215;
} }
@ -164,14 +203,6 @@ public class Item {
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) { public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) {
} }
public String getPotionEffect(ItemStack stack) {
return this.potionEffect;
}
public boolean isPotionIngredient(ItemStack stack) {
return this.getPotionEffect(stack) != null;
}
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) { public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
} }
@ -179,57 +210,14 @@ public class Item {
return stack.isItemEnchanted(); return stack.isItemEnchanted();
} }
public TextColor getColor(ItemStack stack) { public boolean canEnchant(ItemStack stack) {
return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE); return this.getMaxAmount() == 1 && this.isDamageable();
}
public boolean isItemTool(ItemStack stack) {
return this.getItemStackLimit() == 1 && this.isDamageable();
}
protected HitPosition getMovingObjectPositionFromPlayer(World worldIn, EntityNPC playerIn, boolean useLiquids) {
float f = playerIn.rotPitch;
float f1 = playerIn.rotYaw;
double d0 = playerIn.posX;
double d1 = playerIn.posY + (double)playerIn.getEyeHeight();
double d2 = playerIn.posZ;
Vec3 vec3 = new Vec3(d0, d1, d2);
float f2 = ExtMath.cos(-f1 * 0.017453292F - (float)Math.PI);
float f3 = ExtMath.sin(-f1 * 0.017453292F - (float)Math.PI);
float f4 = -ExtMath.cos(-f * 0.017453292F);
float f5 = ExtMath.sin(-f * 0.017453292F);
float f6 = f3 * f4;
float f7 = f2 * f4;
double d3 = 5.0D;
Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
} }
public int getItemEnchantability() { public int getItemEnchantability() {
return 0; return 0;
} }
protected List<TagObject> getItemTags() {
return null;
}
public final void getSubItems(List<ItemStack> subItems) {
if(this.validTags != null) {
for(TagObject valid : this.validTags) {
ItemStack stack = new ItemStack(this);
stack.setTag(valid);
subItems.add(stack);
}
}
else {
subItems.add(new ItemStack(this));
}
}
public CheatTab getTab() {
return this.tab;
}
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
return false; return false;
} }
@ -245,18 +233,6 @@ public class Item {
return false; return false;
} }
public final boolean hasTags() {
return this.validTags != null;
}
public final TagObject getItemTag(int index) {
return this.validTags == null || index < 0 || index >= this.validTags.size() ? null : this.validTags.get(index);
}
public final int getTagIndex(TagObject tag) {
return tag == null || this.validTags == null ? -1 : this.validTags.indexOf(tag);
}
public float getRadiation(ItemStack stack) { public float getRadiation(ItemStack stack) {
return 0.0f; return 0.0f;
} }
@ -298,18 +274,6 @@ public class Item {
return stack; return stack;
} }
protected final ItemStack dispenseProjectile(World world, Facing facing, ItemStack stack, IProjectile entity) {
return this.dispenseProjectile(world, facing, stack, entity, 1.1f, 6.0f);
}
protected final ItemStack dispenseProjectile(World world, Facing facing, ItemStack stack, IProjectile entity, float velocity, float inaccuracy) {
entity.setThrowableHeading((double)facing.getFrontOffsetX(), (double)((float)facing.getFrontOffsetY() + 0.1F),
(double)facing.getFrontOffsetZ(), velocity, inaccuracy);
world.spawnEntityInWorld((Entity)entity);
stack.splitStack(1);
return stack;
}
public int getDispenseSoundId() { public int getDispenseSoundId() {
return 1000; return 1000;
} }

View file

@ -30,6 +30,7 @@ public final class ItemStack
public int size; public int size;
private Item item; private Item item;
private int color;
private TagObject tag; private TagObject tag;
public ItemStack(Item item) public ItemStack(Item item)
@ -160,7 +161,7 @@ public final class ItemStack
public int getMaxStackSize() public int getMaxStackSize()
{ {
return this.getItem().getItemStackLimit(); return this.getItem().getMaxAmount();
} }
public boolean isStackable() public boolean isStackable()
@ -441,24 +442,6 @@ public final class ItemStack
return this.tag; return this.tag;
} }
public TagObject getSubTag(String key, boolean create)
{
if (this.tag != null && this.tag.hasObject(key))
{
return this.tag.getObject(key);
}
else if (create)
{
TagObject tag = new TagObject();
this.setTagInfo(key, tag);
return tag;
}
else
{
return null;
}
}
public List<TagObject> getEnchantmentTagList() public List<TagObject> getEnchantmentTagList()
{ {
return this.tag == null ? null : this.tag.getList("ench"); return this.tag == null ? null : this.tag.getList("ench");
@ -592,6 +575,11 @@ public final class ItemStack
if(this.getRepairCost() > 0) if(this.getRepairCost() > 0)
list.add("Reparaturkosten: " + this.getRepairCost() + " Mana"); list.add("Reparaturkosten: " + this.getRepairCost() + " Mana");
if(this.getMaxStackSize() == 1)
list.add("Nicht stapelbar");
else
list.add("Stapelbar bis " + this.getMaxStackSize());
list.add(TextColor.GRAY + ItemRegistry.getName(this.item)); list.add(TextColor.GRAY + ItemRegistry.getName(this.item));
if (this.hasTag()) if (this.hasTag())
@ -617,7 +605,7 @@ public final class ItemStack
*/ */
public boolean isItemEnchantable() public boolean isItemEnchantable()
{ {
return !this.getItem().isItemTool(this) ? false : !this.isItemEnchanted(); return !this.getItem().canEnchant(this) ? false : !this.isItemEnchanted();
} }
/** /**

View file

@ -0,0 +1,22 @@
package common.item;
public enum StackSize {
XXS(8),
XS(16),
S(32),
M(64),
L(128),
XL(256),
XXL(512),
XXXL(1024);
private final int amount;
private StackSize(int amount) {
this.amount = amount;
}
public int getAmount() {
return this.amount;
}
}

View file

@ -6,6 +6,7 @@ import common.entity.npc.EntityNPC;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.ExtMath; import common.util.ExtMath;
import common.util.Facing; import common.util.Facing;
@ -20,7 +21,7 @@ public class ItemBed extends Item
{ {
this.bedBlock = bedBlock; this.bedBlock = bedBlock;
this.setTab(CheatTab.DECORATION); this.setTab(CheatTab.DECORATION);
this.setMaxAmount(32); this.setMaxAmount(StackSize.S);
} }
public Block getBlock() public Block getBlock()

View file

@ -6,7 +6,6 @@ import common.entity.Entity;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.BlockRegistry; import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.model.Model; import common.model.Model;
@ -28,6 +27,8 @@ public class ItemBlock extends Item
{ {
this.block = block; this.block = block;
this.flatTexture = flatTexture; this.flatTexture = flatTexture;
this.setDisplay(this.block.getDisplay());
this.setTab(this.block.getTab());
} }
public ItemBlock(Block block, String flatTexture, boolean item) public ItemBlock(Block block, String flatTexture, boolean item)
@ -143,16 +144,6 @@ public class ItemBlock extends Item
return worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack); return worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack);
} }
public String getDisplay(ItemStack stack)
{
return this.block.getDisplay();
}
public CheatTab getTab()
{
return this.block.getTab();
}
public Block getBlock() public Block getBlock()
{ {
return this.block; return this.block;

View file

@ -8,6 +8,7 @@ import common.init.Blocks;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.Facing; import common.util.Facing;
import common.world.State; import common.world.State;
@ -21,6 +22,8 @@ public class ItemDoor extends Item
{ {
this.block = block; this.block = block;
this.setTab(block.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY); this.setTab(block.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
this.setDisplay(this.block.getDisplay());
this.setMaxAmount(StackSize.S);
} }
public Block getBlock() public Block getBlock()
@ -92,9 +95,4 @@ public class ItemDoor extends Item
public boolean isMagnetic() { public boolean isMagnetic() {
return this.block == Blocks.iron_door; return this.block == Blocks.iron_door;
} }
public String getDisplay(ItemStack stack)
{
return this.block.getDisplay();
}
} }

View file

@ -4,6 +4,7 @@ import common.block.foliage.BlockDoublePlant;
import common.block.foliage.BlockDoublePlant.EnumPlantType; import common.block.foliage.BlockDoublePlant.EnumPlantType;
import common.color.Colorizer; import common.color.Colorizer;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
import common.model.Model; import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
@ -15,6 +16,7 @@ public class ItemDoublePlant extends ItemBlock
{ {
super(block, ""); super(block, "");
this.type = block.getType(); this.type = block.getType();
this.setMaxAmount(StackSize.S);
} }
public int getColorFromItemStack(ItemStack stack, int renderPass) public int getColorFromItemStack(ItemStack stack, int renderPass)

View file

@ -5,17 +5,11 @@ import common.item.ItemStack;
public class ItemBook extends Item public class ItemBook extends Item
{ {
/** public boolean canEnchant(ItemStack stack)
* Checks isDamagable and if it cannot be stacked
*/
public boolean isItemTool(ItemStack stack)
{ {
return stack.size == 1; return stack.size == 1;
} }
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability() public int getItemEnchantability()
{ {
return 1; return 1;

View file

@ -16,7 +16,6 @@ import common.model.Model;
import common.model.ModelProvider; import common.model.ModelProvider;
import common.model.ParticleType; import common.model.ParticleType;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
import common.tileentity.TileEntityBeacon;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.Facing; import common.util.Facing;
import common.util.Vec3; import common.util.Vec3;
@ -130,14 +129,6 @@ public class ItemDye extends Item {
return true; return true;
} }
} }
else if(iblockstate.getBlock() == Blocks.beacon) {
TileEntity te = worldIn.getTileEntity(pos);
if(te instanceof TileEntityBeacon) {
((TileEntityBeacon)te).setBeamColor(this.color);
// if(!playerIn.creative)
--stack.size;
}
}
return false; return false;
} }

View file

@ -1,24 +1,47 @@
package common.item.material; package common.item.material;
import java.util.List; import java.util.List;
import java.util.Map;
import common.collect.Lists; import common.collect.Lists;
import common.collect.Maps;
import common.color.TextColor; import common.color.TextColor;
import common.enchantment.Enchantment; import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper; import common.enchantment.EnchantmentHelper;
import common.enchantment.RngEnchantment;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.Items; import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.RngLoot; import common.item.RngLoot;
import common.model.Model;
import common.model.ModelProvider;
import common.rng.Random; import common.rng.Random;
import common.tags.TagObject;
public class ItemEnchantedBook extends Item public class ItemEnchantedBook extends Item
{ {
public ItemEnchantedBook() { public static final List<ItemEnchantedBook> BOOKS = Lists.newArrayList();
public static final Map<Enchantment, List<ItemEnchantedBook>> MAPPING = Maps.newEnumMap(Enchantment.class);
private final Enchantment enchantment;
private final int level;
public ItemEnchantedBook(Enchantment enchantment, int level) {
this.setColor(TextColor.YELLOW); this.setColor(TextColor.YELLOW);
this.enchantment = enchantment;
this.level = level;
BOOKS.add(this);
List<ItemEnchantedBook> list = MAPPING.get(enchantment);
if(list == null)
MAPPING.put(enchantment, list = Lists.newArrayList());
list.add(this);
}
public Enchantment getEnchantment() {
return this.enchantment;
}
public int getLevel() {
return this.level;
} }
public boolean hasEffect(ItemStack stack) public boolean hasEffect(ItemStack stack)
@ -26,125 +49,31 @@ public class ItemEnchantedBook extends Item
return true; return true;
} }
/**
* Checks isDamagable and if it cannot be stacked
*/
public boolean isItemTool(ItemStack stack)
{
return false;
}
public List<TagObject> getItemTags()
{
List<TagObject> tags = Lists.newArrayList();
for (Enchantment enchantment : Enchantment.values()) {
if(enchantment != null && enchantment.getType() != null)
tags.add(this.getEnchantedItemStack(new RngEnchantment(enchantment, enchantment.getMaxLevel())).getTag());
}
return tags;
}
// /**
// * Return an item rarity from EnumRarity
// */
// public ChatFormat getColor(ItemStack stack)
// {
// return this.getEnchantments(stack).tagCount() > 0 ? ChatFormat.YELLOW : super.getColor(stack);
// }
public List<TagObject> getEnchantments(ItemStack stack)
{
TagObject nbttagcompound = stack.getTag();
return nbttagcompound != null && nbttagcompound.hasList("StoredEnchantments") ? nbttagcompound.getList("StoredEnchantments") : Lists.newArrayList();
}
/**
* 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)
{ {
super.addInformation(stack, playerIn, tooltip); super.addInformation(stack, playerIn, tooltip);
List<TagObject> nbttaglist = this.getEnchantments(stack); tooltip.add(this.enchantment.getFormattedName(this.level));
if (nbttaglist != null)
{
for (int i = 0; i < nbttaglist.size(); ++i)
{
Enchantment j = Enchantment.getEnchantment(nbttaglist.get(i).getString("id"));
if (j != null)
{
int k = nbttaglist.get(i).getShort("lvl");
tooltip.add(j.getFormattedName(k));
}
}
}
} }
/** public Model getModel(ModelProvider provider, String name) {
* Adds an stored enchantment to an enchanted book ItemStack return provider.getModel(this.getTransform(), "enchanted_book");
*/ }
public void addEnchantment(ItemStack stack, RngEnchantment enchantment)
public static ItemEnchantedBook getEnchantedBook(Enchantment enchantment, int level) {
List<ItemEnchantedBook> list = MAPPING.get(enchantment);
for(ItemEnchantedBook book : list) {
if(book.getLevel() >= level)
return book;
}
return list.getLast();
}
public static RngLoot getRandom(Random rand)
{ {
List<TagObject> nbttaglist = this.getEnchantments(stack); return getRandom(rand, 1, 1, 1);
boolean flag = true;
for (int i = 0; i < nbttaglist.size(); ++i)
{
TagObject nbttagcompound = nbttaglist.get(i);
if (Enchantment.getEnchantment(nbttagcompound.getString("id")) == enchantment.enchantment)
{
if (nbttagcompound.getShort("lvl") < enchantment.level)
{
nbttagcompound.setShort("lvl", (short)enchantment.level);
}
flag = false;
break;
}
}
if (flag)
{
TagObject nbttagcompound1 = new TagObject();
nbttagcompound1.setString("id", enchantment.enchantment.getName());
nbttagcompound1.setShort("lvl", (short)enchantment.level);
nbttaglist.add(nbttagcompound1);
}
if (!stack.hasTag())
{
stack.setTag(new TagObject());
}
stack.getTag().setList("StoredEnchantments", nbttaglist);
} }
/** public static RngLoot getRandom(Random rand, int minChance, int maxChance, int weight)
* Returns the ItemStack of an enchanted version of this item.
*/
public ItemStack getEnchantedItemStack(RngEnchantment data)
{
ItemStack itemstack = new ItemStack(this);
this.addEnchantment(itemstack, data);
return itemstack;
}
public void getAll(Enchantment enchantment, List<ItemStack> list)
{
for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i)
{
list.add(this.getEnchantedItemStack(new RngEnchantment(enchantment, i)));
}
}
public RngLoot getRandom(Random rand)
{
return this.getRandom(rand, 1, 1, 1);
}
public RngLoot getRandom(Random rand, int minChance, int maxChance, int weight)
{ {
ItemStack itemstack = new ItemStack(Items.book); ItemStack itemstack = new ItemStack(Items.book);
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30); EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30);

View file

@ -23,7 +23,7 @@ public class ItemBoat extends Item
{ {
public ItemBoat() public ItemBoat()
{ {
this.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.VEHICLES); this.setTab(CheatTab.VEHICLES);
} }

View file

@ -21,7 +21,7 @@ public class ItemMinecart extends Item
public ItemMinecart(EntityCart.EnumMinecartType type) public ItemMinecart(EntityCart.EnumMinecartType type)
{ {
this.setMaxAmount(1); this.setUnstackable();
this.minecartType = type; this.minecartType = type;
this.setTab(type == EnumMinecartType.TNT ? CheatTab.EXPLOSIVES : CheatTab.VEHICLES); this.setTab(type == EnumMinecartType.TNT ? CheatTab.EXPLOSIVES : CheatTab.VEHICLES);
// if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK) // if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK)

View file

@ -4,6 +4,7 @@ import java.util.List;
import common.block.artificial.BlockFence; import common.block.artificial.BlockFence;
import common.block.liquid.BlockLiquid; import common.block.liquid.BlockLiquid;
import common.collect.Lists;
import common.color.TextColor; import common.color.TextColor;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.entity.Entity; import common.entity.Entity;
@ -28,6 +29,8 @@ import common.world.World;
public class ItemMonsterPlacer extends Item public class ItemMonsterPlacer extends Item
{ {
public static final List<ItemMonsterPlacer> SPAWNERS = Lists.newArrayList();
private final String entityId; private final String entityId;
public ItemMonsterPlacer(String entityId) public ItemMonsterPlacer(String entityId)
@ -35,25 +38,18 @@ public class ItemMonsterPlacer extends Item
// this.setHasSubtypes(true); // this.setHasSubtypes(true);
this.setTab(CheatTab.SPAWNERS); this.setTab(CheatTab.SPAWNERS);
this.entityId = entityId; this.entityId = entityId;
this.setDisplay("delegate");
SPAWNERS.add(this);
}
public void delegateSetDisplay() {
this.setDisplay("Erschaffe " + EntityRegistry.getEntityName(this.entityId));
} }
public String getSpawnedId() { public String getSpawnedId() {
return this.entityId; return this.entityId;
} }
public String getDisplay(ItemStack stack)
{
String s = "Erschaffe";
String s1 = this.entityId;
if (s1 != null)
{
s = s + " " + EntityRegistry.getEntityName(s1);
}
return s;
}
public int getColorFromItemStack(ItemStack stack, int renderPass) public int getColorFromItemStack(ItemStack stack, int renderPass)
{ {
EntityInfo egg = EntityRegistry.SPAWN_EGGS.get(this.entityId); EntityInfo egg = EntityRegistry.SPAWN_EGGS.get(this.entityId);

View file

@ -5,6 +5,7 @@ import java.util.List;
import common.block.artificial.BlockFence; import common.block.artificial.BlockFence;
import common.block.liquid.BlockLiquid; import common.block.liquid.BlockLiquid;
import common.collect.Lists;
import common.color.TextColor; import common.color.TextColor;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.entity.Entity; import common.entity.Entity;
@ -30,6 +31,8 @@ import common.world.World;
public class ItemNpcSpawner extends Item public class ItemNpcSpawner extends Item
{ {
public static final List<ItemNpcSpawner> SPAWNERS = Lists.newArrayList();
private final CharacterInfo spawned; private final CharacterInfo spawned;
public ItemNpcSpawner(CharacterInfo spawned) public ItemNpcSpawner(CharacterInfo spawned)
@ -37,6 +40,12 @@ public class ItemNpcSpawner extends Item
// this.setHasSubtypes(true); // this.setHasSubtypes(true);
this.setTab(CheatTab.NPCS); this.setTab(CheatTab.NPCS);
this.spawned = spawned; this.spawned = spawned;
this.setDisplay("delegate");
SPAWNERS.add(this);
}
public void delegateSetDisplay() {
this.setDisplay("Erschaffe " + this.getCharName());
} }
public CharacterInfo getSpawnedChar() { public CharacterInfo getSpawnedChar() {
@ -52,15 +61,6 @@ public class ItemNpcSpawner extends Item
return species + (character.isEmpty() ? "" : (" " + character)); return species + (character.isEmpty() ? "" : (" " + character));
} }
public String getDisplay(ItemStack stack)
{
String item = "Erschaffe";
item = item + " " + this.getCharName();
return item;
}
public int getColorFromItemStack(ItemStack stack, int renderPass) public int getColorFromItemStack(ItemStack stack, int renderPass)
{ {
return renderPass == 0 ? this.spawned.color1 : this.spawned.color2; return renderPass == 0 ? this.spawned.color1 : this.spawned.color2;

View file

@ -3,12 +3,13 @@ package common.item.tool;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.ItemMagnetic; import common.item.ItemMagnetic;
import common.item.ItemStack; import common.item.ItemStack;
import common.item.StackSize;
public class ItemAmmo extends ItemMagnetic { public class ItemAmmo extends ItemMagnetic {
private final int damage; private final int damage;
private final float explosion; private final float explosion;
public ItemAmmo(int damage, float explosion, int stack) { public ItemAmmo(int damage, float explosion, StackSize stack) {
this.setMaxAmount(stack); this.setMaxAmount(stack);
this.setTab(CheatTab.WEAPONS); this.setTab(CheatTab.WEAPONS);
this.damage = damage; this.damage = damage;

View file

@ -113,7 +113,13 @@ public class ItemBucket extends Item
public ItemBucket(BlockDynamicLiquid liquid, boolean recursive) public ItemBucket(BlockDynamicLiquid liquid, boolean recursive)
{ {
this.setMaxAmount(liquid == null ? 16 : 1); if(liquid != null) {
this.setUnstackable();
this.setDisplay((recursive ? "Flutender" : "") + "Eimer mit " + liquid.getDisplay());
}
else {
this.setDisplay((recursive ? "Unendlicher" : "") + "Eimer");
}
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);
@ -307,17 +313,6 @@ public class ItemBucket extends Item
// } // }
// } // }
public String getDisplay(ItemStack stack)
{
String s = super.getDisplay(stack);
if(this.liquid == null)
return s;
String s1 = this.liquid.getDisplay(); // FluidRegistry.getStaticBlock(this.liquid).getDisplay();
if(s1 != null)
s = s + " mit " + s1; // Strs.get("tile." + s1 + ".name");
return s;
}
// public int getColorFromItemStack(ItemStack stack, int renderPass) // public int getColorFromItemStack(ItemStack stack, int renderPass)
// { // {
// return this.fillBlock == null && renderPass == 1 ? FluidRegistry.getLiquidColor(stack.getMetadata()) : 16777215; // return this.fillBlock == null && renderPass == 1 ? FluidRegistry.getLiquidColor(stack.getMetadata()) : 16777215;

View file

@ -15,7 +15,7 @@ public class ItemBucketMilk extends Item
{ {
public ItemBucketMilk() public ItemBucketMilk()
{ {
this.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }

View file

@ -9,7 +9,7 @@ import common.world.World;
public class ItemCamera extends ItemMagnetic { public class ItemCamera extends ItemMagnetic {
public ItemCamera() { public ItemCamera() {
this.setMaxAmount(1); this.setUnstackable();
} }
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) {

View file

@ -50,6 +50,7 @@ public class ItemDie extends Item
this.sides = sides; this.sides = sides;
this.color = color; this.color = color;
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
this.setDisplay("Würfel W" + this.sides);
DICE.put(sides, this); DICE.put(sides, this);
} }
@ -79,11 +80,6 @@ public class ItemDie extends Item
return itemStackIn; return itemStackIn;
} }
public String getDisplay(ItemStack stack)
{
return super.getDisplay(stack) + " W" + this.sides;
}
public Transforms getTransform() { public Transforms getTransform() {
return Transforms.DICE; return Transforms.DICE;
} }

View file

@ -24,7 +24,6 @@ public class ItemDynamite extends Item {
public ItemDynamite(int power) { public ItemDynamite(int power) {
this.power = power; this.power = power;
this.setMaxAmount(32);
this.setTab(CheatTab.EXPLOSIVES); this.setTab(CheatTab.EXPLOSIVES);
DYNAMITE[power] = this; DYNAMITE[power] = this;
} }

View file

@ -11,7 +11,7 @@ import common.world.World;
public class ItemEditWand extends Item { public class ItemEditWand extends Item {
public ItemEditWand() { public ItemEditWand() {
this.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }

View file

@ -12,7 +12,7 @@ import common.world.AWorldServer;
public class ItemExterminator extends ItemMagnetic { public class ItemExterminator extends ItemMagnetic {
public ItemExterminator() { public ItemExterminator() {
this.setMaxAmount(1); this.setUnstackable();
this.setColor(TextColor.DRED); this.setColor(TextColor.DRED);
this.setTab(CheatTab.WEAPONS); this.setTab(CheatTab.WEAPONS);
} }

View file

@ -1,13 +1,16 @@
package common.item.tool; package common.item.tool;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.entity.projectile.EntityFireCharge;
import common.init.Blocks; import common.init.Blocks;
import common.init.SoundEvent; import common.init.SoundEvent;
import common.item.CheatTab; import common.item.CheatTab;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.tileentity.TileEntity;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.Facing; import common.util.Facing;
import common.util.Vec3;
import common.world.World; import common.world.World;
public class ItemFireball extends Item public class ItemFireball extends Item
@ -51,4 +54,20 @@ public class ItemFireball extends Item
} }
} }
} }
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
double d0 = position.xCoord + (double)((float)facing.getFrontOffsetX() * 0.3F);
double d1 = position.yCoord + (double)((float)facing.getFrontOffsetY() * 0.3F);
double d2 = position.zCoord + (double)((float)facing.getFrontOffsetZ() * 0.3F);
double d3 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetX();
double d4 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetY();
double d5 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetZ();
world.spawnEntityInWorld(new EntityFireCharge(world, d0, d1, d2, d3, d4, d5));
stack.splitStack(1);
return stack;
}
public int getDispenseSoundId() {
return 1009;
}
} }

View file

@ -1,13 +1,9 @@
package common.item.tool; package common.item.tool;
import java.util.List;
import common.collect.Lists;
import common.entity.item.EntityFireworks; import common.entity.item.EntityFireworks;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.tags.TagObject;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.Facing; import common.util.Facing;
@ -16,14 +12,11 @@ import common.world.World;
public class ItemFirework extends Item public class ItemFirework extends Item
{ {
/**
* 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 (!worldIn.client) if (!worldIn.client)
{ {
EntityFireworks entityfireworkrocket = new EntityFireworks(worldIn, (double)((float)pos.getX() + hitX), (double)((float)pos.getY() + hitY), (double)((float)pos.getZ() + hitZ), stack); EntityFireworks entityfireworkrocket = new EntityFireworks(worldIn, (double)((float)pos.getX() + hitX), (double)((float)pos.getY() + hitY), (double)((float)pos.getZ() + hitZ));
worldIn.spawnEntityInWorld(entityfireworkrocket); worldIn.spawnEntityInWorld(entityfireworkrocket);
// if (!playerIn.creative) // if (!playerIn.creative)
@ -39,52 +32,11 @@ public class ItemFirework extends Item
} }
} }
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
{
if (stack.hasTag())
{
TagObject nbttagcompound = stack.getTag().getObject("Fireworks");
if (nbttagcompound != null)
{
if (nbttagcompound.hasByte("Flight"))
{
tooltip.add("Flugdauer: " + nbttagcompound.getByte("Flight"));
}
List<TagObject> nbttaglist = nbttagcompound.getList("Explosions");
if (nbttaglist != null && nbttaglist.size() > 0)
{
for (int i = 0; i < nbttaglist.size(); ++i)
{
TagObject nbttagcompound1 = nbttaglist.get(i);
List<String> list = Lists.<String>newArrayList();
ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);
if (list.size() > 0)
{
for (int j = 1; j < ((List)list).size(); ++j)
{
list.set(j, " " + (String)list.get(j));
}
tooltip.addAll(list);
}
}
}
}
}
}
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
double d0 = blockpos.getX() + 0.5 + (double)facing.getFrontOffsetX(); double d0 = blockpos.getX() + 0.5 + (double)facing.getFrontOffsetX();
double d1 = (double)blockpos.getY() + 0.2; double d1 = (double)blockpos.getY() + 0.2;
double d2 = blockpos.getZ() + 0.5 + (double)facing.getFrontOffsetZ(); double d2 = blockpos.getZ() + 0.5 + (double)facing.getFrontOffsetZ();
EntityFireworks entityfireworkrocket = new EntityFireworks(world, d0, d1, d2, stack); EntityFireworks entityfireworkrocket = new EntityFireworks(world, d0, d1, d2);
world.spawnEntityInWorld(entityfireworkrocket); world.spawnEntityInWorld(entityfireworkrocket);
stack.splitStack(1); stack.splitStack(1);
return stack; return stack;

View file

@ -1,208 +0,0 @@
package common.item.tool;
import java.util.List;
import common.color.DyeColor;
import common.entity.npc.EntityNPC;
import common.entity.projectile.EntityFireCharge;
import common.item.Item;
import common.item.ItemStack;
import common.model.Model;
import common.model.ModelProvider;
import common.tags.TagObject;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.Facing;
import common.util.Vec3;
import common.world.World;
public class ItemFireworkCharge extends Item
{
private static final String[] EXPLOSIONS = new String[] {"Kleine Kugel", "Große Kugel", "Stern", "Pentagramm", "Explosion"};
public int getColorFromItemStack(ItemStack stack, int renderPass)
{
if (renderPass != 1)
{
return super.getColorFromItemStack(stack, renderPass);
}
else
{
if (stack.hasTag())
{
TagObject nbttagcompound = stack.getTag().getObject("Explosion");
if (nbttagcompound != null)
{
if(nbttagcompound.hasIntArray("Colors")) {
int[] aint = nbttagcompound.getIntArray("Colors");
if (aint.length == 1)
{
return aint[0];
}
else
{
int i = 0;
int j = 0;
int k = 0;
for (int l : aint)
{
i += (l & 16711680) >> 16;
j += (l & 65280) >> 8;
k += (l & 255) >> 0;
}
i = i / aint.length;
j = j / aint.length;
k = k / aint.length;
return i << 16 | j << 8 | k;
}
}
}
}
return 9079434;
}
}
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
{
if (stack.hasTag())
{
TagObject nbttagcompound = stack.getTag().getObject("Explosion");
if (nbttagcompound != null)
{
addExplosionInfo(nbttagcompound, tooltip);
}
}
}
public static void addExplosionInfo(TagObject nbt, List<String> tooltip)
{
byte b0 = nbt.getByte("Type");
if (b0 >= 0 && b0 <= 4)
{
tooltip.add(EXPLOSIONS[b0]);
}
else
{
tooltip.add("Unbekannte Form");
}
int[] aint = nbt.getIntArray("Colors");
if (aint.length > 0)
{
boolean flag = true;
String s = "";
for (int i : aint)
{
if (!flag)
{
s = s + ", ";
}
flag = false;
boolean flag1 = false;
for (DyeColor color : DyeColor.values())
{
if (i == color.getColor())
{
flag1 = true;
s = s + color.getDisplay();
break;
}
}
if (!flag1)
{
s = s + "Benutzerdefiniert";
}
}
tooltip.add(s);
}
int[] aint1 = nbt.getIntArray("FadeColors");
if (aint1.length > 0)
{
boolean flag2 = true;
String s1 = "Übergang zu ";
for (int l : aint1)
{
if (!flag2)
{
s1 = s1 + ", ";
}
flag2 = false;
boolean flag5 = false;
for (DyeColor color : DyeColor.values())
{
if (l == color.getColor())
{
flag5 = true;
s1 = s1 + color.getDisplay();
break;
}
}
if (!flag5)
{
s1 = s1 + "Benutzerdefiniert";
}
}
tooltip.add(s1);
}
boolean flag3 = nbt.getBool("Trail");
if (flag3)
{
tooltip.add("Schweif");
}
boolean flag4 = nbt.getBool("Flicker");
if (flag4)
{
tooltip.add("Funkeln");
}
}
// public Set<String> getValidTags() {
// return Sets.newHashSet("Explosion");
// }
public Model getModel(ModelProvider provider, String name) {
return provider.getModel(this.getTransform(), "firework_charge", "firework_charge_overlay");
}
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
double d0 = position.xCoord + (double)((float)facing.getFrontOffsetX() * 0.3F);
double d1 = position.yCoord + (double)((float)facing.getFrontOffsetY() * 0.3F);
double d2 = position.zCoord + (double)((float)facing.getFrontOffsetZ() * 0.3F);
double d3 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetX();
double d4 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetY();
double d5 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetZ();
world.spawnEntityInWorld(new EntityFireCharge(world, d0, d1, d2, d3, d4, d5));
stack.splitStack(1);
return stack;
}
public int getDispenseSoundId() {
return 1009;
}
}

View file

@ -19,6 +19,9 @@ public class ItemFishFood extends ItemFood
super(0, false); super(0, false);
this.cooked = cooked; this.cooked = cooked;
this.type = type; this.type = type;
if(type == FishType.PUFFERFISH)
this.setPotionEffect(PotionHelper.pufferfishEffect);
this.setDisplay((this.type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + this.type.getDisplay());
} }
public FishType getType() { public FishType getType() {
@ -34,11 +37,6 @@ public class ItemFishFood extends ItemFood
return this.cooked && this.type.canCook() ? this.type.getCookedHealAmount() : this.type.getUncookedHealAmount(); return this.cooked && this.type.canCook() ? this.type.getCookedHealAmount() : this.type.getUncookedHealAmount();
} }
public String getPotionEffect(ItemStack stack)
{
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)
{ {
if (this.type == ItemFishFood.FishType.PUFFERFISH) if (this.type == ItemFishFood.FishType.PUFFERFISH)
@ -50,11 +48,6 @@ public class ItemFishFood extends ItemFood
super.onFoodEaten(stack, worldIn, player); super.onFoodEaten(stack, worldIn, player);
} }
public String getDisplay(ItemStack stack)
{
return (this.type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + this.type.getDisplay();
}
public Model getModel(ModelProvider provider, String name) { public Model getModel(ModelProvider provider, String name) {
return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + this.type.getName()); return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + this.type.getName());
} }

View file

@ -61,14 +61,6 @@ public class ItemFishingRod extends Item
return itemStackIn; return itemStackIn;
} }
/**
* Checks isDamagable and if it cannot be stacked
*/
public boolean isItemTool(ItemStack stack)
{
return super.isItemTool(stack);
}
/** /**
* Return the enchantability factor of the item, most of the time is based on material. * Return the enchantability factor of the item, most of the time is based on material.
*/ */

View file

@ -11,7 +11,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.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.ARMOR); this.setTab(CheatTab.ARMOR);
} }

View file

@ -19,7 +19,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.setMaxAmount(1); this.setUnstackable();
this.chicken = chicken; this.chicken = chicken;
} }

View file

@ -46,9 +46,10 @@ public class ItemPotion extends Item
public ItemPotion(int data) public ItemPotion(int data)
{ {
this.data = data; this.data = data;
this.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.POTIONS); this.setTab(CheatTab.POTIONS);
this.setColor(TextColor.ORK); this.setColor(TextColor.ORK);
this.setDisplay(getDisplay(this));
POTIONS.put(data, this); POTIONS.put(data, this);
} }
@ -191,33 +192,32 @@ public class ItemPotion extends Item
} }
} }
public String getDisplay(ItemStack stack) private static String getDisplay(ItemPotion potion)
{ {
if ((this.data & 16383) == 0) if ((potion.data & 16383) == 0)
{ {
return (this.isSplashPotion() ? "Werfbare " : "") + "Wasserflasche"; return (potion.isSplashPotion() ? "Werfbare " : "") + "Wasserflasche";
} }
else else
{ {
String s = ""; String s = "";
if (this.isSplashPotion()) if (potion.isSplashPotion())
{ {
s = "Werfbarer "; s = "Werfbarer ";
} }
List<PotionEffect> list = this.getEffects(); List<PotionEffect> list = potion.getEffects();
if (list != null && !list.isEmpty()) if (list != null && !list.isEmpty())
{ {
String s2 = list.get(0).getPotionName(); String s2 = list.get(0).getPotionName();
// s2 = s2 + ".postfix";
return s + s2.trim(); return s + s2.trim();
} }
else else
{ {
String s1 = PotionHelper.getPotionPrefix(this.data); String s1 = PotionHelper.getPotionPrefix(potion.data);
return s1.trim() + " " + super.getDisplay(stack); return s1.trim() + " Trank";
} }
} }
} }

View file

@ -11,7 +11,7 @@ public class ItemSaddle extends Item
{ {
public ItemSaddle() public ItemSaddle()
{ {
this.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }

View file

@ -11,7 +11,7 @@ public class ItemSoup extends ItemFood
public ItemSoup(int healAmount) public ItemSoup(int healAmount)
{ {
super(healAmount, false); super(healAmount, false);
this.setMaxAmount(1); this.setUnstackable();
} }
/** /**

View file

@ -27,7 +27,7 @@ public class ItemSpaceNavigator extends ItemMagnetic {
} }
public ItemSpaceNavigator() { public ItemSpaceNavigator() {
this.setMaxAmount(1); this.setUnstackable();
this.setColor(TextColor.DGREEN); this.setColor(TextColor.DGREEN);
} }

View file

@ -18,7 +18,7 @@ import common.world.AWorldServer;
public abstract class ItemWand extends Item { public abstract class ItemWand extends Item {
public ItemWand() { public ItemWand() {
this.setMaxAmount(1); this.setUnstackable();
this.setTab(CheatTab.TOOLS); this.setTab(CheatTab.TOOLS);
} }

View file

@ -14,8 +14,9 @@ public class ItemWeatherToken extends ItemMagnetic {
public ItemWeatherToken(Weather weather) { public ItemWeatherToken(Weather weather) {
this.weather = weather; this.weather = weather;
this.setMaxAmount(1); this.setUnstackable();
this.setColor(TextColor.VIOLET); this.setColor(TextColor.VIOLET);
this.setDisplay("Wetterkristall (" + this.weather.getDisplay() + ")");
} }
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
@ -37,8 +38,4 @@ public class ItemWeatherToken extends ItemMagnetic {
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]); // playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
return itemStackIn; return itemStackIn;
} }
public String getDisplay(ItemStack stack) {
return super.getDisplay(stack) + " (" + this.weather.getDisplay() + ")";
}
} }

View file

@ -97,12 +97,6 @@ public enum Transforms {
Transform.IDENTITY, Transform.IDENTITY,
Transform.IDENTITY Transform.IDENTITY
), ),
BANNER(
transform(0.0f, 90.0f, -90.0f, 0.0f, 0.0f, -4.0f, 0.5f),
transform(0.0f, 225.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f),
transform(0.0f, -65.0f, 0.0f, 0.0f, -3.0f, 0.0f, 0.85f),
Transform.IDENTITY
),
FENCE( FENCE(
transform(0.0f, 0.0f, 180.0f, 0.0f, 1.5f, -2.75f, 0.375f), transform(0.0f, 0.0f, 180.0f, 0.0f, 1.5f, -2.75f, 0.375f),
Transform.IDENTITY, Transform.IDENTITY,

View file

@ -4,23 +4,20 @@ import java.io.IOException;
import common.init.ItemRegistry; import common.init.ItemRegistry;
import common.item.Item; import common.item.Item;
import common.item.ItemStack;
import common.network.IPlayer; import common.network.IPlayer;
import common.network.Packet; import common.network.Packet;
import common.network.PacketBuffer; import common.network.PacketBuffer;
public class CPacketCheat implements Packet<IPlayer> { public class CPacketCheat implements Packet<IPlayer> {
private Item item; private Item item;
private int tagIndex;
private int slot; private int slot;
private boolean stacked; private boolean stacked;
public CPacketCheat() { public CPacketCheat() {
} }
public CPacketCheat(ItemStack stack, int slot, boolean full) { public CPacketCheat(Item item, int slot, boolean full) {
this.item = stack.getItem(); this.item = item;
this.tagIndex = this.item.getTagIndex(stack.getTag());
this.slot = slot; this.slot = slot;
this.stacked = full; this.stacked = full;
} }
@ -31,14 +28,12 @@ public class CPacketCheat implements Packet<IPlayer> {
public void readPacketData(PacketBuffer buf) throws IOException { public void readPacketData(PacketBuffer buf) throws IOException {
this.item = ItemRegistry.byId(buf.readShort()); this.item = ItemRegistry.byId(buf.readShort());
this.tagIndex = buf.readVarInt();
this.slot = buf.readShort(); this.slot = buf.readShort();
this.stacked = buf.readBoolean(); this.stacked = buf.readBoolean();
} }
public void writePacketData(PacketBuffer buf) throws IOException { public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeShort(ItemRegistry.getId(this.item)); buf.writeShort(ItemRegistry.getId(this.item));
buf.writeVarInt(this.tagIndex);
buf.writeShort(this.slot); buf.writeShort(this.slot);
buf.writeBoolean(this.stacked); buf.writeBoolean(this.stacked);
} }
@ -47,10 +42,6 @@ public class CPacketCheat implements Packet<IPlayer> {
return this.item; return this.item;
} }
public int getTagIndex() {
return this.tagIndex;
}
public boolean isStacked() { public boolean isStacked() {
return this.stacked; return this.stacked;
} }

View file

@ -5,11 +5,8 @@ import java.util.List;
import common.block.Block; import common.block.Block;
import common.block.artificial.BlockStainedGlass; import common.block.artificial.BlockStainedGlass;
import common.block.artificial.BlockStainedGlassPane; import common.block.artificial.BlockStainedGlassPane;
import common.color.DyeColor;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.init.Blocks; import common.init.Blocks;
import common.network.Packet;
import common.packet.SPacketUpdateTileEntity;
import common.potion.Potion; import common.potion.Potion;
import common.potion.PotionEffect; import common.potion.PotionEffect;
import common.tags.TagObject; import common.tags.TagObject;
@ -21,27 +18,13 @@ import common.world.AWorldServer;
public class TileEntityBeacon extends TileEntity implements ITickable public class TileEntityBeacon extends TileEntity implements ITickable
{ {
/** List of effects that Beacon can apply */ private static final Potion[][] effectsList = new Potion[][] {{Potion.SPEED, Potion.HASTE}, {Potion.RESISTANCE, Potion.JUMP}, {Potion.STRENGTH}, {Potion.REGENERATION}};
public static final Potion[][] effectsList = new Potion[][] {{Potion.SPEED, Potion.HASTE}, {Potion.RESISTANCE, Potion.JUMP}, {Potion.STRENGTH}, {Potion.REGENERATION}};
// private final List<TileEntityBeacon.BeamSegment> beamSegments = Lists.<TileEntityBeacon.BeamSegment>newArrayList();
// private long lastRenderUpdate;
// private float charge;
private boolean isComplete; private boolean isComplete;
/** Level of this beacon's pyramid. */
private int levels = -1; private int levels = -1;
/** Primary potion effect given by this beacon. */
private Potion primaryEffect; private Potion primaryEffect;
/** Secondary potion effect given by this beacon. */
private Potion secondaryEffect; private Potion secondaryEffect;
/** Item given to this beacon as payment. */
// private ItemStack payment;
private String customName;
private DyeColor beamColor = DyeColor.WHITE;
/** /**
* Like the old updateEntity(), except more generic. * Like the old updateEntity(), except more generic.
*/ */
@ -276,20 +259,6 @@ public class TileEntityBeacon extends TileEntity implements ITickable
// } // }
// } // }
/**
* Allows for a specialized description packet to be created. This is often used to sync tile entity data from the
* server to the client easily. For example this is used by signs to synchronise the text to be displayed.
*/
public Packet getDescriptionPacket()
{
return new SPacketUpdateTileEntity(this);
}
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
private Potion getEffect(String id) private Potion getEffect(String id)
{ {
Potion potion = Potion.getByName(id); Potion potion = Potion.getByName(id);
@ -309,12 +278,6 @@ public class TileEntityBeacon extends TileEntity implements ITickable
this.primaryEffect = compound.hasString("Primary") ? this.getEffect(compound.getString("Primary")) : null; this.primaryEffect = compound.hasString("Primary") ? this.getEffect(compound.getString("Primary")) : null;
this.secondaryEffect = compound.hasString("Secondary") ? this.getEffect(compound.getString("Secondary")) : null; this.secondaryEffect = compound.hasString("Secondary") ? this.getEffect(compound.getString("Secondary")) : null;
this.levels = compound.getInt("Levels"); this.levels = compound.getInt("Levels");
// try {
this.beamColor = DyeColor.byName(compound.getString("Color"));
// }
// catch(IllegalArgumentException e) {
// this.beamColor = DyeColor.WHITE;
// }
} }
public void writeTags(TagObject compound) public void writeTags(TagObject compound)
@ -325,237 +288,9 @@ public class TileEntityBeacon extends TileEntity implements ITickable
if(this.secondaryEffect != null) if(this.secondaryEffect != null)
compound.setString("Secondary", this.secondaryEffect.getName()); compound.setString("Secondary", this.secondaryEffect.getName());
compound.setInt("Levels", this.levels); compound.setInt("Levels", this.levels);
compound.setString("Color", this.beamColor.getName());
}
/**
* Returns the number of slots in the inventory.
*/
// public int getSizeInventory()
// {
// return 1;
// }
/**
* Returns the stack in the given slot.
*/
// public ItemStack getStackInSlot(int index)
// {
// return index == 0 ? this.payment : null;
// }
/**
* Removes up to a specified number of items from an inventory slot and returns them in a new stack.
*/
// public ItemStack decrStackSize(int index, int count)
// {
// if (index == 0 && this.payment != null)
// {
// if (count >= this.payment.stackSize)
// {
// ItemStack itemstack = this.payment;
// this.payment = null;
// return itemstack;
// }
// else
// {
// this.payment.stackSize -= count;
// return new ItemStack(this.payment.getItem(), count, this.payment.getMetadata());
// }
// }
// else
// {
// return null;
// }
// }
//
// /**
// * Removes a stack from the given slot and returns it.
// */
// public ItemStack removeStackFromSlot(int index)
// {
// if (index == 0 && this.payment != null)
// {
// ItemStack itemstack = this.payment;
// this.payment = null;
// return itemstack;
// }
// else
// {
// return null;
// }
// }
//
// /**
// * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
// */
// public void setInventorySlotContents(int index, ItemStack stack)
// {
// if (index == 0)
// {
// this.payment = stack;
// }
// }
/**
* Get the name of this object. For players this returns their username
*/
// public String getName()
// {
// return this.hasCustomName() ? this.customName : "Leuchtfeuer";
// }
/**
* Returns true if this thing is named
*/
// public boolean hasCustomName()
// {
// return this.customName != null && this.customName.length() > 0;
// }
//
// public void setName(String name)
// {
// this.customName = name;
// }
/**
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended.
*/
// public int getInventoryStackLimit()
// {
// return 1;
// }
/**
* Do not make give this method the name canInteractWith because it clashes with Container
*/
// public boolean isUseableByPlayer(EntityNPC player)
// {
// return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
// }
//
// public void openInventory(EntityNPC player)
// {
// }
//
// public void closeInventory(EntityNPC player)
// {
// }
/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
// public boolean isItemValidForSlot(int index, ItemStack stack)
// {
// return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot;
// }
//
// public String getGuiID()
// {
// return "beacon";
// }
//
// public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn)
// {
// return new ContainerBeacon(playerInventory, this);
// }
//
// public int getField(int id)
// {
// switch (id)
// {
// case 0:
// return this.levels;
//
// case 1:
// return this.primaryEffect;
//
// case 2:
// return this.secondaryEffect;
//
// default:
// return 0;
// }
// }
//
// public void setField(int id, int value)
// {
// switch (id)
// {
// case 0:
// this.levels = value;
// break;
//
// case 1:
// this.primaryEffect = this.func_183001_h(value);
// break;
//
// case 2:
// this.secondaryEffect = this.func_183001_h(value);
// }
// }
//
// public int getFieldCount()
// {
// return 3;
// }
//
// public void clear()
// {
// this.payment = null;
// }
public boolean receiveClientEvent(int id, int type)
{
if (id == 1)
{
this.beamColor = DyeColor.values()[type % DyeColor.values().length];
return true;
}
else
{
return super.receiveClientEvent(id, type);
}
} }
public int getColor() { public int getColor() {
return 0xff00ff; return 0xff00ff;
} }
public int getBeamColor() {
return this.beamColor.getColor();
}
public void setBeamColor(DyeColor color) {
this.beamColor = color;
if(!this.worldObj.client)
this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, color.ordinal());
}
// public static class BeamSegment
// {
// private final float[] colors;
// private int height;
//
// public BeamSegment(float[] p_i45669_1_)
// {
// this.colors = p_i45669_1_;
// this.height = 1;
// }
//
// protected void incrementHeight()
// {
// ++this.height;
// }
//
// public float[] getColors()
// {
// return this.colors;
// }
//
// public int getHeight()
// {
// return this.height;
// }
// }
} }

View file

@ -2,7 +2,6 @@ package common.world;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.init.SoundEvent; import common.init.SoundEvent;
import common.tags.TagObject;
public abstract class AWorldClient extends World { public abstract class AWorldClient extends World {
protected AWorldClient(Dimension dim) { protected AWorldClient(Dimension dim) {
@ -10,6 +9,5 @@ public abstract class AWorldClient extends World {
} }
public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume); public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume);
public abstract void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, TagObject compund);
public abstract void setLastLightning(int last, int color); public abstract void setLastLightning(int last, int color);
} }

View file

@ -228,8 +228,6 @@ public abstract class ReorderRegistry {
for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { for(BlockDoublePlant block : BlockDoublePlant.PLANTS) {
addAttach(block, Facing.DOWN); addAttach(block, Facing.DOWN);
} }
addAttach(Blocks.banner, Facing.DOWN);
addCardinals(Blocks.wall_banner, 4, 2, 5, 3);
addAttach(Blocks.oak_door, Facing.DOWN); addAttach(Blocks.oak_door, Facing.DOWN);
addAttach(Blocks.spruce_door, Facing.DOWN); addAttach(Blocks.spruce_door, Facing.DOWN);
addAttach(Blocks.birch_door, Facing.DOWN); addAttach(Blocks.birch_door, Facing.DOWN);

View file

@ -2900,10 +2900,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer
Item item = packet.getItem(); Item item = packet.getItem();
if(item == null) if(item == null)
return; return;
ItemStack stack = new ItemStack(item, packet.isStacked() ? item.getItemStackLimit() : 1); ItemStack stack = new ItemStack(item, packet.isStacked() ? item.getMaxAmount() : 1);
stack.setTag(item.getItemTag(packet.getTagIndex()));
if(item.hasTags() != stack.hasTag())
return;
int amount = stack.size; int amount = stack.size;
if(amount <= 0) if(amount <= 0)
return; return;

View file

@ -8,8 +8,8 @@ import common.entity.npc.EntityUndead;
import common.entity.npc.EntityZombie; import common.entity.npc.EntityZombie;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items;
import common.item.RngLoot; import common.item.RngLoot;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.rng.WeightedList; import common.rng.WeightedList;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
@ -140,7 +140,7 @@ public class FeatureDungeons
if (j3 == 1) if (j3 == 1)
{ {
worldIn.setState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getState()), 2); worldIn.setState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getState()), 2);
WeightedList<RngLoot> list = RngLoot.addToList(LootConstants.DUNGEON_CHEST, Items.enchanted_book.getRandom(rand)); WeightedList<RngLoot> list = RngLoot.addToList(LootConstants.DUNGEON_CHEST, ItemEnchantedBook.getRandom(rand));
TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); TileEntity tileentity1 = worldIn.getTileEntity(blockpos2);
if (tileentity1 instanceof TileEntityChest) if (tileentity1 instanceof TileEntityChest)

View file

@ -9,8 +9,8 @@ import common.block.tech.BlockTorch;
import common.entity.item.EntityChestCart; import common.entity.item.EntityChestCart;
import common.entity.npc.EntityArachnoid; import common.entity.npc.EntityArachnoid;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items;
import common.item.RngLoot; import common.item.RngLoot;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.rng.WeightedList; import common.rng.WeightedList;
import common.tags.TagObject; import common.tags.TagObject;
@ -355,12 +355,12 @@ public class StructureMineshaft
if (randomIn.zrange(100) == 0) if (randomIn.zrange(100) == 0)
{ {
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, RngLoot.addToList(LootConstants.MINESHAFT_CHEST, Items.enchanted_book.getRandom(randomIn)), 3 + randomIn.zrange(4)); this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, RngLoot.addToList(LootConstants.MINESHAFT_CHEST, ItemEnchantedBook.getRandom(randomIn)), 3 + randomIn.zrange(4));
} }
if (randomIn.zrange(100) == 0) if (randomIn.zrange(100) == 0)
{ {
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, RngLoot.addToList(LootConstants.MINESHAFT_CHEST, Items.enchanted_book.getRandom(randomIn)), 3 + randomIn.zrange(4)); this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, RngLoot.addToList(LootConstants.MINESHAFT_CHEST, ItemEnchantedBook.getRandom(randomIn)), 3 + randomIn.zrange(4));
} }
if (this.hasSpiders && !this.spawnerPlaced && SVars.mobs && SVars.spawnMineshaftMobs) if (this.hasSpiders && !this.spawnerPlaced && SVars.mobs && SVars.spawnMineshaftMobs)

View file

@ -9,8 +9,8 @@ import common.block.tech.BlockTripWire;
import common.block.tech.BlockTripWireHook; import common.block.tech.BlockTripWireHook;
import common.entity.npc.EntityMage; import common.entity.npc.EntityMage;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items;
import common.item.RngLoot; import common.item.RngLoot;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.tags.TagObject; import common.tags.TagObject;
import common.util.BlockPos; import common.util.BlockPos;
@ -252,7 +252,7 @@ public class StructureScattered
{ {
int l1 = enumfacing.getFrontOffsetX() * 2; int l1 = enumfacing.getFrontOffsetX() * 2;
int i2 = enumfacing.getFrontOffsetZ() * 2; int i2 = enumfacing.getFrontOffsetZ() * 2;
this.hasPlacedChest[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, RngLoot.addToList(LootConstants.DESERT_PYRAMID, Items.enchanted_book.getRandom(randomIn)), 2 + randomIn.zrange(5)); this.hasPlacedChest[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, RngLoot.addToList(LootConstants.DESERT_PYRAMID, ItemEnchantedBook.getRandom(randomIn)), 2 + randomIn.zrange(5));
} }
} }
@ -538,7 +538,7 @@ public class StructureScattered
if (!this.placedMainChest) if (!this.placedMainChest)
{ {
this.placedMainChest = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, RngLoot.addToList(LootConstants.JUNGLE_MAIN, Items.enchanted_book.getRandom(randomIn)), 2 + randomIn.zrange(5)); this.placedMainChest = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, RngLoot.addToList(LootConstants.JUNGLE_MAIN, ItemEnchantedBook.getRandom(randomIn)), 2 + randomIn.zrange(5));
} }
this.setBlockState(worldIn, Blocks.mossy_cobblestone.getState(), 9, -3, 2, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.mossy_cobblestone.getState(), 9, -3, 2, structureBoundingBoxIn);
@ -571,7 +571,7 @@ public class StructureScattered
if (!this.placedHiddenChest) if (!this.placedHiddenChest)
{ {
this.placedHiddenChest = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, RngLoot.addToList(LootConstants.JUNGLE_MAIN, Items.enchanted_book.getRandom(randomIn)), 2 + randomIn.zrange(5)); this.placedHiddenChest = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, RngLoot.addToList(LootConstants.JUNGLE_MAIN, ItemEnchantedBook.getRandom(randomIn)), 2 + randomIn.zrange(5));
} }
return true; return true;

View file

@ -11,8 +11,8 @@ import common.collect.Lists;
import common.collect.Maps; import common.collect.Maps;
import common.entity.npc.EntityHaunter; import common.entity.npc.EntityHaunter;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items;
import common.item.RngLoot; import common.item.RngLoot;
import common.item.material.ItemEnchantedBook;
import common.rng.Random; import common.rng.Random;
import common.tags.TagObject; import common.tags.TagObject;
import common.util.BlockPos; import common.util.BlockPos;
@ -303,7 +303,7 @@ public class StructureStronghold
if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3))))
{ {
this.hasMadeChest = true; this.hasMadeChest = true;
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, RngLoot.addToList(LootConstants.STRONGHOLD_CHEST, Items.enchanted_book.getRandom(randomIn)), 2 + randomIn.zrange(2)); this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, RngLoot.addToList(LootConstants.STRONGHOLD_CHEST, ItemEnchantedBook.getRandom(randomIn)), 2 + randomIn.zrange(2));
} }
return true; return true;
@ -742,12 +742,12 @@ public class StructureStronghold
this.setBlockState(worldIn, Blocks.torch.getState(), i1, 8, j1 + 1, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.torch.getState(), i1, 8, j1 + 1, structureBoundingBoxIn);
} }
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, RngLoot.addToList(LootConstants.STRONGHOLD_LIBRARY, Items.enchanted_book.getRandom(randomIn, 1, 5, 2)), 1 + randomIn.zrange(4)); this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, RngLoot.addToList(LootConstants.STRONGHOLD_LIBRARY, ItemEnchantedBook.getRandom(randomIn, 1, 5, 2)), 1 + randomIn.zrange(4));
if (this.isLargeRoom) if (this.isLargeRoom)
{ {
this.setBlockState(worldIn, Blocks.air.getState(), 12, 9, 1, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 12, 9, 1, structureBoundingBoxIn);
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, RngLoot.addToList(LootConstants.STRONGHOLD_LIBRARY, Items.enchanted_book.getRandom(randomIn, 1, 5, 2)), 1 + randomIn.zrange(4)); this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, RngLoot.addToList(LootConstants.STRONGHOLD_LIBRARY, ItemEnchantedBook.getRandom(randomIn, 1, 5, 2)), 1 + randomIn.zrange(4));
} }
return true; return true;
@ -1155,7 +1155,7 @@ public class StructureStronghold
this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST)), 9, 1, 3, structureBoundingBoxIn); this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST)), 9, 1, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST)), 9, 2, 3, structureBoundingBoxIn); this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST)), 9, 2, 3, structureBoundingBoxIn);
this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST)), 9, 3, 3, structureBoundingBoxIn); this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.ladder.getState().withProperty(BlockLadder.FACING, Facing.WEST)), 9, 3, 3, structureBoundingBoxIn);
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, RngLoot.addToList(LootConstants.STRONGHOLD_CROSS, Items.enchanted_book.getRandom(randomIn)), 1 + randomIn.zrange(4)); this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, RngLoot.addToList(LootConstants.STRONGHOLD_CROSS, ItemEnchantedBook.getRandom(randomIn)), 1 + randomIn.zrange(4));
} }
return true; return true;