From b14a99dc050cc507485679e395d937d715a15d5c Mon Sep 17 00:00:00 2001 From: Sen Date: Sun, 6 Jul 2025 21:43:15 +0200 Subject: [PATCH] data changes --- client/src/main/java/client/Client.java | 4 +- .../client/gui/container/GuiContainer.java | 4 +- .../renderer/entity/RenderFireball.java | 2 +- .../client/renderer/model/ModelBanner.java | 31 -- .../renderer/particle/EntityFirework.java | 285 ------------------ .../main/java/client/world/WorldClient.java | 7 - .../items/{fire_charge.png => fireball.png} | Bin .../textures/items/firework_charge.png | Bin 298 -> 0 bytes .../items/firework_charge_overlay.png | Bin 225 -> 0 bytes .../src/main/java/common/block/Material.java | 2 +- .../common/block/foliage/BlockCarrot.java | 3 +- .../java/common/block/foliage/BlockCrops.java | 3 +- .../common/block/foliage/BlockPotato.java | 3 +- .../java/common/block/foliage/BlockReed.java | 3 +- .../java/common/block/foliage/BlockStem.java | 3 +- .../java/common/block/foliage/BlockWart.java | 3 +- .../common/block/tech/BlockRedstoneWire.java | 3 +- .../main/java/common/block/tech/BlockTNT.java | 2 +- .../java/common/block/tech/BlockTripWire.java | 3 +- .../common/enchantment/EnchantmentHelper.java | 93 +++--- .../common/entity/item/EntityFireworks.java | 86 +----- .../java/common/init/CraftingRegistry.java | 265 +--------------- .../main/java/common/init/EntityRegistry.java | 9 + .../main/java/common/init/ItemRegistry.java | 99 +++--- common/src/main/java/common/init/Items.java | 53 +++- .../main/java/common/init/TradeRegistry.java | 4 +- .../main/java/common/inventory/Container.java | 2 +- .../inventory/ContainerEnchantment.java | 21 +- .../common/inventory/ContainerRepair.java | 6 +- .../src/main/java/common/item/CheatTab.java | 10 +- common/src/main/java/common/item/Item.java | 164 ++++------ .../src/main/java/common/item/ItemStack.java | 28 +- .../src/main/java/common/item/StackSize.java | 22 ++ .../main/java/common/item/block/ItemBed.java | 3 +- .../java/common/item/block/ItemBlock.java | 13 +- .../main/java/common/item/block/ItemDoor.java | 8 +- .../common/item/block/ItemDoublePlant.java | 2 + .../java/common/item/material/ItemBook.java | 8 +- .../java/common/item/material/ItemDye.java | 9 - .../item/material/ItemEnchantedBook.java | 157 +++------- .../java/common/item/spawner/ItemBoat.java | 2 +- .../common/item/spawner/ItemMinecart.java | 2 +- .../item/spawner/ItemMonsterPlacer.java | 22 +- .../common/item/spawner/ItemNpcSpawner.java | 18 +- .../main/java/common/item/tool/ItemAmmo.java | 3 +- .../java/common/item/tool/ItemBucket.java | 19 +- .../java/common/item/tool/ItemBucketMilk.java | 2 +- .../java/common/item/tool/ItemCamera.java | 2 +- .../main/java/common/item/tool/ItemDie.java | 6 +- .../java/common/item/tool/ItemDynamite.java | 1 - .../java/common/item/tool/ItemEditWand.java | 2 +- .../common/item/tool/ItemExterminator.java | 2 +- .../java/common/item/tool/ItemFireball.java | 19 ++ .../java/common/item/tool/ItemFirework.java | 52 +--- .../common/item/tool/ItemFireworkCharge.java | 208 ------------- .../java/common/item/tool/ItemFishFood.java | 13 +- .../java/common/item/tool/ItemFishingRod.java | 8 - .../java/common/item/tool/ItemHorseArmor.java | 2 +- .../java/common/item/tool/ItemMagnet.java | 2 +- .../java/common/item/tool/ItemPotion.java | 18 +- .../java/common/item/tool/ItemSaddle.java | 2 +- .../main/java/common/item/tool/ItemSoup.java | 2 +- .../common/item/tool/ItemSpaceNavigator.java | 2 +- .../main/java/common/item/tool/ItemWand.java | 2 +- .../common/item/tool/ItemWeatherToken.java | 7 +- .../main/java/common/model/Transforms.java | 6 - .../main/java/common/packet/CPacketCheat.java | 13 +- .../common/tileentity/TileEntityBeacon.java | 269 +---------------- .../main/java/common/world/AWorldClient.java | 2 - .../server/clipboard/ReorderRegistry.java | 2 - .../src/main/java/server/network/Player.java | 5 +- .../java/server/worldgen/FeatureDungeons.java | 4 +- .../structure/StructureMineshaft.java | 6 +- .../structure/StructureScattered.java | 8 +- .../structure/StructureStronghold.java | 10 +- 75 files changed, 449 insertions(+), 1717 deletions(-) delete mode 100755 client/src/main/java/client/renderer/model/ModelBanner.java rename client/src/main/resources/textures/items/{fire_charge.png => fireball.png} (100%) delete mode 100755 client/src/main/resources/textures/items/firework_charge.png delete mode 100755 client/src/main/resources/textures/items/firework_charge_overlay.png create mode 100644 common/src/main/java/common/item/StackSize.java delete mode 100755 common/src/main/java/common/item/tool/ItemFireworkCharge.java diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index c2f74d1e..5f5b303a 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -1560,7 +1560,7 @@ public class Client implements IThreadListener { inventoryplayer.setCurrentItem(item); 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); } 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); } else if(this.open == null) { diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index 49085a90..0eea6d1e 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -507,7 +507,7 @@ public abstract class GuiContainer extends Gui if(this.cheatStack != null) { Slot slot = this.getSlotAtPosition(mouseX, mouseY); 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()) this.cheatStack = null; return; @@ -885,7 +885,7 @@ public abstract class GuiContainer extends Gui if(idx >= 0 && idx < ITEM_LIST.size()) { 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 { this.cheatStack = ITEM_LIST.get(idx).copy(); diff --git a/client/src/main/java/client/renderer/entity/RenderFireball.java b/client/src/main/java/client/renderer/entity/RenderFireball.java index 36068f60..0ed71d93 100755 --- a/client/src/main/java/client/renderer/entity/RenderFireball.java +++ b/client/src/main/java/client/renderer/entity/RenderFireball.java @@ -33,7 +33,7 @@ public class RenderFireball extends Render GL11.glTranslatef((float)x, (float)y, (float)z); GlState.enableRescaleNormal(); 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(); RenderBuffer worldrenderer = Tessellator.getBuffer(); float f = textureatlassprite.getMinU(); diff --git a/client/src/main/java/client/renderer/model/ModelBanner.java b/client/src/main/java/client/renderer/model/ModelBanner.java deleted file mode 100755 index bd7157e1..00000000 --- a/client/src/main/java/client/renderer/model/ModelBanner.java +++ /dev/null @@ -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); - } -} diff --git a/client/src/main/java/client/renderer/particle/EntityFirework.java b/client/src/main/java/client/renderer/particle/EntityFirework.java index f8fa2a4d..cbe4f00b 100755 --- a/client/src/main/java/client/renderer/particle/EntityFirework.java +++ b/client/src/main/java/client/renderer/particle/EntityFirework.java @@ -2,12 +2,7 @@ package client.renderer.particle; import client.Client; import client.renderer.RenderBuffer; -import client.world.WorldClient; -import common.color.DyeColor; import common.entity.Entity; -import common.init.SoundEvent; -import common.tags.TagObject; -import java.util.List; import common.util.BoundingBox; import common.util.ExtMath; import common.world.World; @@ -76,33 +71,6 @@ public class EntityFirework 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() { return null; @@ -187,257 +155,4 @@ public class EntityFirework return 1.0F; } } - - public static class StarterFX extends EntityFX - { - private int fireworkAge; - private final EffectRenderer theEffectRenderer; - private List 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; - } - } } diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index 8f6e1548..3a5f68da 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -5,7 +5,6 @@ import java.util.Set; import client.Client; import client.renderer.particle.EntityFX; -import client.renderer.particle.EntityFirework; import common.biome.Biome; import common.collect.Lists; import common.collect.Sets; @@ -25,7 +24,6 @@ import common.model.ParticleType; import common.rng.Random; import common.sound.MovingSoundMinecart; import common.sound.PositionedSound; -import common.tags.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.ChunkPos; @@ -381,11 +379,6 @@ public class WorldClient extends AWorldClient this.gm.getSoundManager().playSound(positionedsoundrecord); // } } - - 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) { diff --git a/client/src/main/resources/textures/items/fire_charge.png b/client/src/main/resources/textures/items/fireball.png similarity index 100% rename from client/src/main/resources/textures/items/fire_charge.png rename to client/src/main/resources/textures/items/fireball.png diff --git a/client/src/main/resources/textures/items/firework_charge.png b/client/src/main/resources/textures/items/firework_charge.png deleted file mode 100755 index 5c8936277d82af7a12bf22e5471a3b30da638d12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL9r6oh?3y^w370~qEv>0#LT=By}Z;C1rt33 z>la@$fhy*Dx;Tbd_-~zjk@JXxfJ^QPr!@!ay*KdezwDrO_T!$p8$3*Q9^mEKb#v}< zwFwixz5SxSm(NSv!RzILFuUs#e>jgMtlheM>$Tjq_cp)YDzeRpV@dkbDaywz+AAE+ z{p8uqs{U8g;dO5|x5j}IZvFs{jhxFF?o5w1s7S41@-gN6S-$*POr6UU#eaQyhlQFW q7_MHcTetf`{Qt#EIqLSd^7rjruz2y)0%xE@89ZJ6T-G@yGywo)gL1C` diff --git a/client/src/main/resources/textures/items/firework_charge_overlay.png b/client/src/main/resources/textures/items/firework_charge_overlay.png deleted file mode 100755 index d8b91a92c236463ca9c798bd92d149c577a42c35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 225 zcmV<703QE|P)>GBIn$f&!_nF*)g8p!7l{B3 getEnchantments(ItemStack stack) { Map map = Maps.newLinkedHashMap(); - List 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 list = stack.getEnchantmentTagList(); if (list != null) { @@ -78,34 +84,38 @@ public class EnchantmentHelper public static void setEnchantments(Map enchMap, ItemStack stack) { - List list = Lists.newArrayList(); - Iterator iterator = enchMap.keySet().iterator(); - - while (iterator.hasNext()) + if (stack.getItem() instanceof ItemEnchantedBook) { - Enchantment enchantment = iterator.next(); - - TagObject tag = new TagObject(); - tag.setString("id", enchantment.getName()); - 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())); - } + Entry entry = new Random().pick(Lists.newArrayList(enchMap.entrySet())); + stack.setItem(ItemEnchantedBook.getEnchantedBook(entry.getKey(), entry.getValue())); + if(stack.hasTag()) + stack.getTag().remove("ench"); } + else { + List list = Lists.newArrayList(); + Iterator iterator = enchMap.keySet().iterator(); + + while (iterator.hasNext()) + { + Enchantment enchantment = iterator.next(); + + TagObject tag = new TagObject(); + tag.setString("id", enchantment.getName()); + tag.setShort("lvl", (short)enchMap.get(enchantment).intValue()); + list.add(tag); + } - if (list.size() > 0) - { - if (stack.getItem() != Items.enchanted_book) - { - stack.setTagInfo("ench", list); - } - } - else if (stack.hasTag()) - { - 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 */ - 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 list = buildEnchantmentList(p_77504_0_, p_77504_1_, p_77504_2_); - boolean flag = p_77504_1_.getItem() == Items.book; + List list = buildEnchantmentList(rand, stack, enchantability); + boolean flag = stack.getItem() == Items.book; - if (flag) + if (list != null && !list.isEmpty()) { - p_77504_1_.setItem(Items.enchanted_book); - } - - if (list != null) - { - for (RngEnchantment enchantmentdata : list) - { - if (flag) - { - Items.enchanted_book.addEnchantment(p_77504_1_, enchantmentdata); - } - else - { - p_77504_1_.addEnchantment(enchantmentdata.enchantment, enchantmentdata.level); - } + if(flag) { + RngEnchantment enchantmentdata = rand.pick(list); + stack.setItem(ItemEnchantedBook.getEnchantedBook(enchantmentdata.enchantment, enchantmentdata.level)); + } + for (RngEnchantment enchantmentdata : list) { + stack.addEnchantment(enchantmentdata.enchantment, enchantmentdata.level); } } - return p_77504_1_; + return stack; } public static List buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int level) diff --git a/common/src/main/java/common/entity/item/EntityFireworks.java b/common/src/main/java/common/entity/item/EntityFireworks.java index 86b3e8b7..038b7e5f 100755 --- a/common/src/main/java/common/entity/item/EntityFireworks.java +++ b/common/src/main/java/common/entity/item/EntityFireworks.java @@ -3,21 +3,14 @@ package common.entity.item; import common.entity.Entity; import common.entity.EntityType; import common.init.SoundEvent; -import common.item.ItemStack; import common.model.ParticleType; import common.tags.TagObject; import common.util.ExtMath; -import common.world.AWorldClient; import common.world.World; public class EntityFireworks extends Entity { - /** The age of the firework in ticks. */ private int fireworkAge; - - /** - * The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes. - */ private int lifetime; public EntityFireworks(World worldIn) @@ -28,52 +21,26 @@ public class EntityFireworks extends Entity 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) { 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); this.fireworkAge = 0; this.setSize(0.25F, 0.25F); 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.motionZ = this.rand.gaussian() * 0.001D; 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) { this.motionX = x; @@ -88,9 +55,6 @@ public class EntityFireworks extends Entity } } - /** - * Called to update the entity's position/logic. - */ public void onUpdate() { this.lastTickPosX = this.posX; @@ -127,7 +91,7 @@ public class EntityFireworks extends Entity this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 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); } @@ -141,64 +105,23 @@ public class EntityFireworks extends Entity if (!this.worldObj.client && this.fireworkAge > this.lifetime) { - this.worldObj.setEntityState(this, (byte)17); this.setDead(); 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) { tagCompound.setInt("Life", this.fireworkAge); 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) { this.fireworkAge = tagCompund.getInt("Life"); 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) { return super.getBrightness(partialTicks); @@ -209,9 +132,6 @@ public class EntityFireworks extends Entity return super.getBrightnessForRender(partialTicks); } - /** - * If returns false, the item will not inflict any damage against entities. - */ public boolean canAttackWithItem() { return false; diff --git a/common/src/main/java/common/init/CraftingRegistry.java b/common/src/main/java/common/init/CraftingRegistry.java index eeea1b80..7da84baa 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -21,7 +21,6 @@ import common.item.Item; import common.item.ItemStack; import common.item.material.ItemDye; import common.item.tool.ItemArmor; -import common.tags.TagObject; public abstract class CraftingRegistry { @@ -208,7 +207,6 @@ public abstract class CraftingRegistry } recipes.add(new RecipesArmorDyes()); - recipes.add(new RecipeFireworks()); recipes.add(new RecipeRepairItem()); 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.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.fire_charge, 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.coal); + 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); @@ -509,265 +507,6 @@ public abstract class CraftingRegistry 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 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 list = Lists.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 list1 = Lists.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 { /** diff --git a/common/src/main/java/common/init/EntityRegistry.java b/common/src/main/java/common/init/EntityRegistry.java index 436e54f4..0867aa92 100755 --- a/common/src/main/java/common/init/EntityRegistry.java +++ b/common/src/main/java/common/init/EntityRegistry.java @@ -49,6 +49,8 @@ import common.entity.projectile.EntityPotion; import common.entity.projectile.EntitySnowball; import common.entity.types.EntityLiving; import common.entity.types.IObjectData; +import common.item.spawner.ItemMonsterPlacer; +import common.item.spawner.ItemNpcSpawner; import common.log.Log; import common.tags.TagObject; import common.world.World; @@ -266,5 +268,12 @@ public abstract class EntityRegistry { registerEntity("Bullet", EntityBullet.class, "Kugel"); registerEggs(); + + for(ItemMonsterPlacer item : ItemMonsterPlacer.SPAWNERS) { + item.delegateSetDisplay(); + } + for(ItemNpcSpawner item : ItemNpcSpawner.SPAWNERS) { + item.delegateSetDisplay(); + } } } diff --git a/common/src/main/java/common/init/ItemRegistry.java b/common/src/main/java/common/init/ItemRegistry.java index 76191d04..f327117f 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -17,6 +17,7 @@ import common.collect.HashBiMap; import common.collect.Lists; import common.color.DyeColor; import common.color.TextColor; +import common.enchantment.Enchantment; import common.entity.item.EntityCart; import common.entity.npc.CharacterInfo; import common.entity.npc.SpeciesInfo; @@ -30,6 +31,7 @@ import common.item.ItemSmall; import common.item.ItemStack; import common.item.ItemStick; import common.item.ItemTiny; +import common.item.StackSize; import common.item.material.ItemBook; import common.item.material.ItemDye; import common.item.material.ItemEnchantedBook; @@ -61,7 +63,6 @@ import common.item.tool.ItemExpBottle; import common.item.tool.ItemExterminator; import common.item.tool.ItemFireball; import common.item.tool.ItemFirework; -import common.item.tool.ItemFireworkCharge; import common.item.tool.ItemFishFood; import common.item.tool.ItemFishingRod; import common.item.tool.ItemFlintAndSteel; @@ -165,7 +166,7 @@ public abstract class ItemRegistry { if(item != null) { if(item.getTab() == null || !item.getTab().isBlockTab()) 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"); ITEMS.add(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); for(Pair liquid : BlockLiquid.LIQUIDS) { register(BlockRegistry.getName(liquid.first()) + - "_bucket", new ItemBucket(liquid.second(), false).setDisplay("Eimer") + "_bucket", new ItemBucket(liquid.second(), false) .setContainerItem(bucket)); } - register("recursive_bucket", (new ItemBucket(null, true)).setDisplay("Unendlicher Eimer")); + register("recursive_bucket", (new ItemBucket(null, true))); for(Pair liquid : BlockLiquid.LIQUIDS) { 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)); @@ -195,13 +196,13 @@ public abstract class ItemRegistry { .setColor(TextColor.RED)); for(EntityInfo egg : EntityRegistry.SPAWN_EGGS.values()) { register(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id())) - .setDisplay("Spawner").setMaxAmount(128)); + .setMaxAmount(StackSize.L)); } for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) { for(CharacterInfo charinfo : species.chars) { if(charinfo.spawner) - register(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner") - .setMaxAmount(128)); + register(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)) + .setMaxAmount(StackSize.L)); } } @@ -209,37 +210,37 @@ public abstract class ItemRegistry { register("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug")); register("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter")); 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 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("magnet", (new ItemMagnet(false)).setDisplay("Magnet")); register("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS)); 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("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele")); 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("boltgun", (new ItemBoltgun()).setDisplay("Bolter")); - register("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition")); - register("arrow", (new ItemArrow()).setDisplay("Pfeil").setTab(CheatTab.WEAPONS).setMaxAmount(128)); + register("bolt", (new ItemAmmo(5, 1.0f, StackSize.L)).setDisplay("Bolter-Munition")); + register("arrow", (new ItemArrow()).setDisplay("Pfeil").setTab(CheatTab.WEAPONS).setMaxAmount(StackSize.L)); Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS); register("coal", coal); 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("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe")); - register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(512)); - register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); - register("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); + 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(StackSize.XL)); + register("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L)); 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("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch")); 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) .setDisplay("Geladener Apfel")); 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("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS)); - register("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(128)); - register("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(256)); + register("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L)); + register("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL)); register("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC)); - register("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128)); - register("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128)); + register("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L)); + register("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(StackSize.L)); register("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS)); register("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer")); register("fishing_rod", (new ItemFishingRod()).setDisplay("Angel")); 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()) { - register(type.getName(), (new ItemFishFood(false, type)).setDisplay(type.getDisplay())); + register(type.getName(), (new ItemFishFood(false, type))); 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; 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) lapis = dye; register(color.getDye(), dye); } - register("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); - register("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512)); - register("cookie", (new ItemFood(2, false)).setDisplay("Keks").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(StackSize.XXL)); + register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(StackSize.L)); register("melon", (new ItemFood(2, false)).setDisplay("Melone")); register("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch")); 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("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch")); register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.MAGIC)); - register("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256)); - register("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); - register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).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(StackSize.XL)); + register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(StackSize.XL)); for(int data : ItemPotion.getValidDataValues()) { 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("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") - .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) - .setTab(CheatTab.MATERIALS).setMaxAmount(256)); - register("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128)); + .setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL)); + 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("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect) .setTab(CheatTab.MISC)); 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("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC)); Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS); register("emerald", emerald); - register("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(128)); - register("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").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(StackSize.L)); register("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte") .setPotionEffect(PotionHelper.goldenCarrotEffect)); register("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute")); 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("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete").setTab(CheatTab.EXPLOSIVES)); - register("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS)); - register("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.ENCHANTMENTS)); + for(Enchantment ench : Enchantment.values()) { + 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("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS)); Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS); register("quartz", quartz); Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS); 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")); 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)); diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index 0094f66e..9796c999 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -61,7 +61,6 @@ import common.item.tool.ItemExpBottle; import common.item.tool.ItemExterminator; import common.item.tool.ItemFireball; import common.item.tool.ItemFirework; -import common.item.tool.ItemFireworkCharge; import common.item.tool.ItemFishFood; import common.item.tool.ItemFishingRod; import common.item.tool.ItemFlintAndSteel; @@ -366,7 +365,6 @@ public abstract class Items { public static final Item emerald = get("emerald"); public static final ItemBlock emerald_block = get("emerald_block"); 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 ItemExpBottle experience_bottle = get("experience_bottle"); 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 fermented_spider_eye = get("fermented_spider_eye"); public static final ItemColored fern = get("fern"); - public static final ItemFireball fire_charge = get("fire_charge"); - public static final ItemFireworkCharge firework_charge = get("firework_charge"); + public static final ItemFireball fireball = get("fireball"); public static final ItemFirework fireworks = get("fireworks"); public static final ItemFishingRod fishing_rod = get("fishing_rod"); 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 display2 = get("display2"); 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 get(String id) { T item = (T)ItemRegistry.byName(id); diff --git a/common/src/main/java/common/init/TradeRegistry.java b/common/src/main/java/common/init/TradeRegistry.java index b7bec960..b060397f 100755 --- a/common/src/main/java/common/init/TradeRegistry.java +++ b/common/src/main/java/common/init/TradeRegistry.java @@ -2,9 +2,9 @@ package common.init; import common.enchantment.Enchantment; import common.enchantment.EnchantmentHelper; -import common.enchantment.RngEnchantment; import common.item.Item; import common.item.ItemStack; +import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.village.MerchantRecipe; import common.village.MerchantRecipeList; @@ -149,7 +149,7 @@ public abstract class TradeRegistry { public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { Enchantment enchantment = random.pick(Enchantment.values()); 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; if(j > 64) { diff --git a/common/src/main/java/common/inventory/Container.java b/common/src/main/java/common/inventory/Container.java index 25537022..6a9e1543 100755 --- a/common/src/main/java/common/inventory/Container.java +++ b/common/src/main/java/common/inventory/Container.java @@ -757,7 +757,7 @@ public abstract class Container break; 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_; diff --git a/common/src/main/java/common/inventory/ContainerEnchantment.java b/common/src/main/java/common/inventory/ContainerEnchantment.java index 46adf6de..8ab7cc09 100755 --- a/common/src/main/java/common/inventory/ContainerEnchantment.java +++ b/common/src/main/java/common/inventory/ContainerEnchantment.java @@ -9,6 +9,7 @@ import common.entity.npc.EntityNPC; import common.init.Blocks; import common.init.Items; import common.item.ItemStack; +import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.util.BlockPos; import common.util.Pair; @@ -240,20 +241,20 @@ public class ContainerEnchantment extends Container List ench = this.getRandomEnchantments(stack, id, this.mana[id]); boolean book = stack.getItem() == Items.book; - if(ench != null) { + if(ench != null && !ench.isEmpty()) { player.useMana(cost); player.updateEnchSeed(); - if(book) - stack.setItem(Items.enchanted_book); - - for(int z = 0; z < ench.size(); z++) { - RngEnchantment itm = ench.get(z); - - if(book) - Items.enchanted_book.addEnchantment(stack, itm); - else + if(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); + stack.addEnchantment(itm.enchantment, itm.level); + } } this.table.markDirty(); diff --git a/common/src/main/java/common/inventory/ContainerRepair.java b/common/src/main/java/common/inventory/ContainerRepair.java index 4f601d28..2066a428 100755 --- a/common/src/main/java/common/inventory/ContainerRepair.java +++ b/common/src/main/java/common/inventory/ContainerRepair.java @@ -7,8 +7,8 @@ import common.block.tech.BlockAnvil; import common.enchantment.Enchantment; import common.enchantment.EnchantmentHelper; import common.entity.npc.EntityNPC; -import common.init.Items; import common.item.ItemStack; +import common.item.material.ItemEnchantedBook; import common.util.BlockPos; import common.vars.Vars; import common.world.State; @@ -195,7 +195,7 @@ public class ContainerRepair extends Container 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)) { @@ -275,7 +275,7 @@ public class ContainerRepair extends Container level = diff; boolean applies = enchantment.canApply(stack); - if (/* this.thePlayer.creative || */ stack.getItem() == Items.enchanted_book) + if (/* this.thePlayer.creative || */ stack.getItem() instanceof ItemEnchantedBook) { applies = true; } diff --git a/common/src/main/java/common/item/CheatTab.java b/common/src/main/java/common/item/CheatTab.java index 1943e142..0eb5cd8a 100755 --- a/common/src/main/java/common/item/CheatTab.java +++ b/common/src/main/java/common/item/CheatTab.java @@ -13,7 +13,7 @@ public enum CheatTab { public void filter(List list) { for(Item item : ItemRegistry.items()) { - item.getSubItems(list); + list.add(new ItemStack(item)); } } }, @@ -99,7 +99,7 @@ public enum CheatTab { }, ENCHANTMENTS("Verzauberungen", false) { protected Item getIconItem() { - return Items.enchanted_book; + return Items.enchanted_book_unbreaking; } }, MAGIC("Magie", false) { @@ -140,7 +140,7 @@ public enum CheatTab { public void filter(List list) { for(Item item : ItemRegistry.items()) { if(item.getBlock() != null) - item.getSubItems(list); + list.add(new ItemStack(item)); } } }, @@ -152,7 +152,7 @@ public enum CheatTab { public void filter(List list) { for(Item item : ItemRegistry.items()) { if(item.getBlock() == null) - item.getSubItems(list); + list.add(new ItemStack(item)); } } }; @@ -202,7 +202,7 @@ public enum CheatTab { public void filter(List list) { for(Item item : ItemRegistry.items()) { if(item.getTab() == this) - item.getSubItems(list); + list.add(new ItemStack(item)); } } } diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index 24301b60..2fda41a1 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -14,7 +14,6 @@ import common.entity.types.IProjectile; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.tags.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.ExtMath; @@ -24,19 +23,13 @@ import common.util.Vec3; import common.world.World; public class Item { - private final List validTags; - - private int maxAmount = 64; + private int maxAmount = StackSize.M.getAmount(); private int maxDamage = 0; private Item containerItem; private String potionEffect; private String display; private CheatTab tab; private TextColor color = null; - - public Item() { - this.validTags = this.getItemTags(); - } public final Item setUnstackable() { this.maxAmount = 1; @@ -44,8 +37,8 @@ public class Item { return this; } - public final Item setMaxAmount(int max) { - this.maxAmount = max; + public final Item setMaxAmount(StackSize size) { + this.maxAmount = size.getAmount(); this.maxDamage = 0; return this; } @@ -81,7 +74,7 @@ public class Item { return this; } - public final int getItemStackLimit() { + public final int getMaxAmount() { return this.maxAmount; } @@ -93,6 +86,64 @@ public class Item { 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() { return null; } @@ -133,18 +184,6 @@ public class Item { 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) { return 16777215; } @@ -164,14 +203,6 @@ public class Item { 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 tooltip) { } @@ -179,56 +210,13 @@ public class Item { return stack.isItemEnchanted(); } - public TextColor getColor(ItemStack stack) { - return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE); - } - - 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 boolean canEnchant(ItemStack stack) { + return this.getMaxAmount() == 1 && this.isDamageable(); } public int getItemEnchantability() { return 0; } - - protected List getItemTags() { - return null; - } - - public final void getSubItems(List 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) { return false; @@ -245,18 +233,6 @@ public class Item { 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) { return 0.0f; } @@ -298,18 +274,6 @@ public class Item { 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() { return 1000; } diff --git a/common/src/main/java/common/item/ItemStack.java b/common/src/main/java/common/item/ItemStack.java index 23936587..dd99a53f 100755 --- a/common/src/main/java/common/item/ItemStack.java +++ b/common/src/main/java/common/item/ItemStack.java @@ -30,6 +30,7 @@ public final class ItemStack public int size; private Item item; + private int color; private TagObject tag; public ItemStack(Item item) @@ -160,7 +161,7 @@ public final class ItemStack public int getMaxStackSize() { - return this.getItem().getItemStackLimit(); + return this.getItem().getMaxAmount(); } public boolean isStackable() @@ -441,24 +442,6 @@ public final class ItemStack 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 getEnchantmentTagList() { return this.tag == null ? null : this.tag.getList("ench"); @@ -592,6 +575,11 @@ public final class ItemStack if(this.getRepairCost() > 0) 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)); if (this.hasTag()) @@ -617,7 +605,7 @@ public final class ItemStack */ public boolean isItemEnchantable() { - return !this.getItem().isItemTool(this) ? false : !this.isItemEnchanted(); + return !this.getItem().canEnchant(this) ? false : !this.isItemEnchanted(); } /** diff --git a/common/src/main/java/common/item/StackSize.java b/common/src/main/java/common/item/StackSize.java new file mode 100644 index 00000000..a0445f39 --- /dev/null +++ b/common/src/main/java/common/item/StackSize.java @@ -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; + } +} diff --git a/common/src/main/java/common/item/block/ItemBed.java b/common/src/main/java/common/item/block/ItemBed.java index 2475a9ba..904ed742 100755 --- a/common/src/main/java/common/item/block/ItemBed.java +++ b/common/src/main/java/common/item/block/ItemBed.java @@ -6,6 +6,7 @@ import common.entity.npc.EntityNPC; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; +import common.item.StackSize; import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; @@ -20,7 +21,7 @@ public class ItemBed extends Item { this.bedBlock = bedBlock; this.setTab(CheatTab.DECORATION); - this.setMaxAmount(32); + this.setMaxAmount(StackSize.S); } public Block getBlock() diff --git a/common/src/main/java/common/item/block/ItemBlock.java b/common/src/main/java/common/item/block/ItemBlock.java index 5fa3c516..87d4365c 100755 --- a/common/src/main/java/common/item/block/ItemBlock.java +++ b/common/src/main/java/common/item/block/ItemBlock.java @@ -6,7 +6,6 @@ import common.entity.Entity; import common.entity.npc.EntityNPC; import common.init.BlockRegistry; import common.init.Blocks; -import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.model.Model; @@ -28,6 +27,8 @@ public class ItemBlock extends Item { this.block = block; this.flatTexture = flatTexture; + this.setDisplay(this.block.getDisplay()); + this.setTab(this.block.getTab()); } 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); } - public String getDisplay(ItemStack stack) - { - return this.block.getDisplay(); - } - - public CheatTab getTab() - { - return this.block.getTab(); - } - public Block getBlock() { return this.block; diff --git a/common/src/main/java/common/item/block/ItemDoor.java b/common/src/main/java/common/item/block/ItemDoor.java index 2bb646f2..c56ae605 100755 --- a/common/src/main/java/common/item/block/ItemDoor.java +++ b/common/src/main/java/common/item/block/ItemDoor.java @@ -8,6 +8,7 @@ import common.init.Blocks; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; +import common.item.StackSize; import common.util.BlockPos; import common.util.Facing; import common.world.State; @@ -21,6 +22,8 @@ public class ItemDoor extends Item { this.block = block; this.setTab(block.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY); + this.setDisplay(this.block.getDisplay()); + this.setMaxAmount(StackSize.S); } public Block getBlock() @@ -92,9 +95,4 @@ public class ItemDoor extends Item public boolean isMagnetic() { return this.block == Blocks.iron_door; } - - public String getDisplay(ItemStack stack) - { - return this.block.getDisplay(); - } } diff --git a/common/src/main/java/common/item/block/ItemDoublePlant.java b/common/src/main/java/common/item/block/ItemDoublePlant.java index b3fbb867..121a4474 100755 --- a/common/src/main/java/common/item/block/ItemDoublePlant.java +++ b/common/src/main/java/common/item/block/ItemDoublePlant.java @@ -4,6 +4,7 @@ import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockDoublePlant.EnumPlantType; import common.color.Colorizer; import common.item.ItemStack; +import common.item.StackSize; import common.model.Model; import common.model.ModelProvider; @@ -15,6 +16,7 @@ public class ItemDoublePlant extends ItemBlock { super(block, ""); this.type = block.getType(); + this.setMaxAmount(StackSize.S); } public int getColorFromItemStack(ItemStack stack, int renderPass) diff --git a/common/src/main/java/common/item/material/ItemBook.java b/common/src/main/java/common/item/material/ItemBook.java index d9539c30..8b10506d 100755 --- a/common/src/main/java/common/item/material/ItemBook.java +++ b/common/src/main/java/common/item/material/ItemBook.java @@ -5,17 +5,11 @@ import common.item.ItemStack; public class ItemBook extends Item { - /** - * Checks isDamagable and if it cannot be stacked - */ - public boolean isItemTool(ItemStack stack) + public boolean canEnchant(ItemStack stack) { return stack.size == 1; } - /** - * Return the enchantability factor of the item, most of the time is based on material. - */ public int getItemEnchantability() { return 1; diff --git a/common/src/main/java/common/item/material/ItemDye.java b/common/src/main/java/common/item/material/ItemDye.java index 9306f499..baf5d0c1 100755 --- a/common/src/main/java/common/item/material/ItemDye.java +++ b/common/src/main/java/common/item/material/ItemDye.java @@ -16,7 +16,6 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ParticleType; import common.tileentity.TileEntity; -import common.tileentity.TileEntityBeacon; import common.util.BlockPos; import common.util.Facing; import common.util.Vec3; @@ -130,14 +129,6 @@ public class ItemDye extends Item { 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; } diff --git a/common/src/main/java/common/item/material/ItemEnchantedBook.java b/common/src/main/java/common/item/material/ItemEnchantedBook.java index 79129488..76f27931 100755 --- a/common/src/main/java/common/item/material/ItemEnchantedBook.java +++ b/common/src/main/java/common/item/material/ItemEnchantedBook.java @@ -1,24 +1,47 @@ package common.item.material; import java.util.List; +import java.util.Map; import common.collect.Lists; +import common.collect.Maps; import common.color.TextColor; import common.enchantment.Enchantment; import common.enchantment.EnchantmentHelper; -import common.enchantment.RngEnchantment; import common.entity.npc.EntityNPC; import common.init.Items; import common.item.Item; import common.item.ItemStack; import common.item.RngLoot; +import common.model.Model; +import common.model.ModelProvider; import common.rng.Random; -import common.tags.TagObject; public class ItemEnchantedBook extends Item { - public ItemEnchantedBook() { + public static final List BOOKS = Lists.newArrayList(); + public static final Map> MAPPING = Maps.newEnumMap(Enchantment.class); + + private final Enchantment enchantment; + private final int level; + + public ItemEnchantedBook(Enchantment enchantment, int level) { this.setColor(TextColor.YELLOW); + this.enchantment = enchantment; + this.level = level; + BOOKS.add(this); + List 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) @@ -26,125 +49,31 @@ public class ItemEnchantedBook extends Item return true; } - /** - * Checks isDamagable and if it cannot be stacked - */ - public boolean isItemTool(ItemStack stack) - { - return false; - } - - public List getItemTags() - { - List 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 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 tooltip) { super.addInformation(stack, playerIn, tooltip); - List nbttaglist = this.getEnchantments(stack); - - 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)); - } - } - } + tooltip.add(this.enchantment.getFormattedName(this.level)); } - /** - * Adds an stored enchantment to an enchanted book ItemStack - */ - public void addEnchantment(ItemStack stack, RngEnchantment enchantment) + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(this.getTransform(), "enchanted_book"); + } + + public static ItemEnchantedBook getEnchantedBook(Enchantment enchantment, int level) { + List list = MAPPING.get(enchantment); + for(ItemEnchantedBook book : list) { + if(book.getLevel() >= level) + return book; + } + return list.getLast(); + } + + public static RngLoot getRandom(Random rand) { - List nbttaglist = this.getEnchantments(stack); - 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); + return getRandom(rand, 1, 1, 1); } - /** - * 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 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) + public static RngLoot getRandom(Random rand, int minChance, int maxChance, int weight) { ItemStack itemstack = new ItemStack(Items.book); EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30); diff --git a/common/src/main/java/common/item/spawner/ItemBoat.java b/common/src/main/java/common/item/spawner/ItemBoat.java index 05baabfa..3a2d0004 100755 --- a/common/src/main/java/common/item/spawner/ItemBoat.java +++ b/common/src/main/java/common/item/spawner/ItemBoat.java @@ -23,7 +23,7 @@ public class ItemBoat extends Item { public ItemBoat() { - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.VEHICLES); } diff --git a/common/src/main/java/common/item/spawner/ItemMinecart.java b/common/src/main/java/common/item/spawner/ItemMinecart.java index 5c14cacf..6a073df3 100755 --- a/common/src/main/java/common/item/spawner/ItemMinecart.java +++ b/common/src/main/java/common/item/spawner/ItemMinecart.java @@ -21,7 +21,7 @@ public class ItemMinecart extends Item public ItemMinecart(EntityCart.EnumMinecartType type) { - this.setMaxAmount(1); + this.setUnstackable(); this.minecartType = type; this.setTab(type == EnumMinecartType.TNT ? CheatTab.EXPLOSIVES : CheatTab.VEHICLES); // if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK) diff --git a/common/src/main/java/common/item/spawner/ItemMonsterPlacer.java b/common/src/main/java/common/item/spawner/ItemMonsterPlacer.java index 5c2dc6f5..27fbbf10 100755 --- a/common/src/main/java/common/item/spawner/ItemMonsterPlacer.java +++ b/common/src/main/java/common/item/spawner/ItemMonsterPlacer.java @@ -4,6 +4,7 @@ import java.util.List; import common.block.artificial.BlockFence; import common.block.liquid.BlockLiquid; +import common.collect.Lists; import common.color.TextColor; import common.dimension.Dimension; import common.entity.Entity; @@ -28,6 +29,8 @@ import common.world.World; public class ItemMonsterPlacer extends Item { + public static final List SPAWNERS = Lists.newArrayList(); + private final String entityId; public ItemMonsterPlacer(String entityId) @@ -35,25 +38,18 @@ public class ItemMonsterPlacer extends Item // this.setHasSubtypes(true); this.setTab(CheatTab.SPAWNERS); this.entityId = entityId; + this.setDisplay("delegate"); + SPAWNERS.add(this); + } + + public void delegateSetDisplay() { + this.setDisplay("Erschaffe " + EntityRegistry.getEntityName(this.entityId)); } public String getSpawnedId() { 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) { EntityInfo egg = EntityRegistry.SPAWN_EGGS.get(this.entityId); diff --git a/common/src/main/java/common/item/spawner/ItemNpcSpawner.java b/common/src/main/java/common/item/spawner/ItemNpcSpawner.java index d69227ef..357ff0ec 100755 --- a/common/src/main/java/common/item/spawner/ItemNpcSpawner.java +++ b/common/src/main/java/common/item/spawner/ItemNpcSpawner.java @@ -5,6 +5,7 @@ import java.util.List; import common.block.artificial.BlockFence; import common.block.liquid.BlockLiquid; +import common.collect.Lists; import common.color.TextColor; import common.dimension.Dimension; import common.entity.Entity; @@ -30,6 +31,8 @@ import common.world.World; public class ItemNpcSpawner extends Item { + public static final List SPAWNERS = Lists.newArrayList(); + private final CharacterInfo spawned; public ItemNpcSpawner(CharacterInfo spawned) @@ -37,6 +40,12 @@ public class ItemNpcSpawner extends Item // this.setHasSubtypes(true); this.setTab(CheatTab.NPCS); this.spawned = spawned; + this.setDisplay("delegate"); + SPAWNERS.add(this); + } + + public void delegateSetDisplay() { + this.setDisplay("Erschaffe " + this.getCharName()); } public CharacterInfo getSpawnedChar() { @@ -52,15 +61,6 @@ public class ItemNpcSpawner extends Item 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) { return renderPass == 0 ? this.spawned.color1 : this.spawned.color2; diff --git a/common/src/main/java/common/item/tool/ItemAmmo.java b/common/src/main/java/common/item/tool/ItemAmmo.java index 0c2f2591..65a8bae8 100755 --- a/common/src/main/java/common/item/tool/ItemAmmo.java +++ b/common/src/main/java/common/item/tool/ItemAmmo.java @@ -3,12 +3,13 @@ package common.item.tool; import common.item.CheatTab; import common.item.ItemMagnetic; import common.item.ItemStack; +import common.item.StackSize; public class ItemAmmo extends ItemMagnetic { private final int damage; private final float explosion; - public ItemAmmo(int damage, float explosion, int stack) { + public ItemAmmo(int damage, float explosion, StackSize stack) { this.setMaxAmount(stack); this.setTab(CheatTab.WEAPONS); this.damage = damage; diff --git a/common/src/main/java/common/item/tool/ItemBucket.java b/common/src/main/java/common/item/tool/ItemBucket.java index 0e2ec20e..b9946d82 100755 --- a/common/src/main/java/common/item/tool/ItemBucket.java +++ b/common/src/main/java/common/item/tool/ItemBucket.java @@ -113,7 +113,13 @@ public class ItemBucket extends Item 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.recursive = recursive; 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) // { // return this.fillBlock == null && renderPass == 1 ? FluidRegistry.getLiquidColor(stack.getMetadata()) : 16777215; diff --git a/common/src/main/java/common/item/tool/ItemBucketMilk.java b/common/src/main/java/common/item/tool/ItemBucketMilk.java index 404de170..237c4905 100755 --- a/common/src/main/java/common/item/tool/ItemBucketMilk.java +++ b/common/src/main/java/common/item/tool/ItemBucketMilk.java @@ -15,7 +15,7 @@ public class ItemBucketMilk extends Item { public ItemBucketMilk() { - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/tool/ItemCamera.java b/common/src/main/java/common/item/tool/ItemCamera.java index 852f0bea..49332c8f 100755 --- a/common/src/main/java/common/item/tool/ItemCamera.java +++ b/common/src/main/java/common/item/tool/ItemCamera.java @@ -9,7 +9,7 @@ import common.world.World; public class ItemCamera extends ItemMagnetic { public ItemCamera() { - this.setMaxAmount(1); + this.setUnstackable(); } public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { diff --git a/common/src/main/java/common/item/tool/ItemDie.java b/common/src/main/java/common/item/tool/ItemDie.java index c45c33ea..935f1849 100755 --- a/common/src/main/java/common/item/tool/ItemDie.java +++ b/common/src/main/java/common/item/tool/ItemDie.java @@ -50,6 +50,7 @@ public class ItemDie extends Item this.sides = sides; this.color = color; this.setTab(CheatTab.TOOLS); + this.setDisplay("Würfel W" + this.sides); DICE.put(sides, this); } @@ -78,11 +79,6 @@ public class ItemDie extends Item // playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]); return itemStackIn; } - - public String getDisplay(ItemStack stack) - { - return super.getDisplay(stack) + " W" + this.sides; - } public Transforms getTransform() { return Transforms.DICE; diff --git a/common/src/main/java/common/item/tool/ItemDynamite.java b/common/src/main/java/common/item/tool/ItemDynamite.java index 5d06b90d..f1c78e76 100755 --- a/common/src/main/java/common/item/tool/ItemDynamite.java +++ b/common/src/main/java/common/item/tool/ItemDynamite.java @@ -24,7 +24,6 @@ public class ItemDynamite extends Item { public ItemDynamite(int power) { this.power = power; - this.setMaxAmount(32); this.setTab(CheatTab.EXPLOSIVES); DYNAMITE[power] = this; } diff --git a/common/src/main/java/common/item/tool/ItemEditWand.java b/common/src/main/java/common/item/tool/ItemEditWand.java index 1ced388a..8b1524eb 100755 --- a/common/src/main/java/common/item/tool/ItemEditWand.java +++ b/common/src/main/java/common/item/tool/ItemEditWand.java @@ -11,7 +11,7 @@ import common.world.World; public class ItemEditWand extends Item { public ItemEditWand() { - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/tool/ItemExterminator.java b/common/src/main/java/common/item/tool/ItemExterminator.java index ccce9346..8b6beabf 100755 --- a/common/src/main/java/common/item/tool/ItemExterminator.java +++ b/common/src/main/java/common/item/tool/ItemExterminator.java @@ -12,7 +12,7 @@ import common.world.AWorldServer; public class ItemExterminator extends ItemMagnetic { public ItemExterminator() { - this.setMaxAmount(1); + this.setUnstackable(); this.setColor(TextColor.DRED); this.setTab(CheatTab.WEAPONS); } diff --git a/common/src/main/java/common/item/tool/ItemFireball.java b/common/src/main/java/common/item/tool/ItemFireball.java index 198947a4..511440ec 100755 --- a/common/src/main/java/common/item/tool/ItemFireball.java +++ b/common/src/main/java/common/item/tool/ItemFireball.java @@ -1,13 +1,16 @@ package common.item.tool; import common.entity.npc.EntityNPC; +import common.entity.projectile.EntityFireCharge; import common.init.Blocks; import common.init.SoundEvent; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; +import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; +import common.util.Vec3; import common.world.World; 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; + } } diff --git a/common/src/main/java/common/item/tool/ItemFirework.java b/common/src/main/java/common/item/tool/ItemFirework.java index 27ea6d48..05d6880c 100755 --- a/common/src/main/java/common/item/tool/ItemFirework.java +++ b/common/src/main/java/common/item/tool/ItemFirework.java @@ -1,13 +1,9 @@ package common.item.tool; -import java.util.List; - -import common.collect.Lists; import common.entity.item.EntityFireworks; import common.entity.npc.EntityNPC; import common.item.Item; import common.item.ItemStack; -import common.tags.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; import common.util.Facing; @@ -16,14 +12,11 @@ import common.world.World; 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) { 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); // if (!playerIn.creative) @@ -38,53 +31,12 @@ public class ItemFirework extends Item return false; } } - - /** - * allows items to add custom lines of information to the mouseover description - */ - public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) - { - if (stack.hasTag()) - { - TagObject nbttagcompound = stack.getTag().getObject("Fireworks"); - - if (nbttagcompound != null) - { - if (nbttagcompound.hasByte("Flight")) - { - tooltip.add("Flugdauer: " + nbttagcompound.getByte("Flight")); - } - - List nbttaglist = nbttagcompound.getList("Explosions"); - - if (nbttaglist != null && nbttaglist.size() > 0) - { - for (int i = 0; i < nbttaglist.size(); ++i) - { - TagObject nbttagcompound1 = nbttaglist.get(i); - List list = Lists.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) { double d0 = blockpos.getX() + 0.5 + (double)facing.getFrontOffsetX(); double d1 = (double)blockpos.getY() + 0.2; 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); stack.splitStack(1); return stack; diff --git a/common/src/main/java/common/item/tool/ItemFireworkCharge.java b/common/src/main/java/common/item/tool/ItemFireworkCharge.java deleted file mode 100755 index fd8af15c..00000000 --- a/common/src/main/java/common/item/tool/ItemFireworkCharge.java +++ /dev/null @@ -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 tooltip) - { - if (stack.hasTag()) - { - TagObject nbttagcompound = stack.getTag().getObject("Explosion"); - - if (nbttagcompound != null) - { - addExplosionInfo(nbttagcompound, tooltip); - } - } - } - - public static void addExplosionInfo(TagObject nbt, List 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 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; - } -} diff --git a/common/src/main/java/common/item/tool/ItemFishFood.java b/common/src/main/java/common/item/tool/ItemFishFood.java index cecc8371..901249e0 100755 --- a/common/src/main/java/common/item/tool/ItemFishFood.java +++ b/common/src/main/java/common/item/tool/ItemFishFood.java @@ -19,6 +19,9 @@ public class ItemFishFood extends ItemFood super(0, false); this.cooked = cooked; 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() { @@ -34,11 +37,6 @@ public class ItemFishFood extends ItemFood 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) { if (this.type == ItemFishFood.FishType.PUFFERFISH) @@ -50,11 +48,6 @@ public class ItemFishFood extends ItemFood 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) { return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + this.type.getName()); } diff --git a/common/src/main/java/common/item/tool/ItemFishingRod.java b/common/src/main/java/common/item/tool/ItemFishingRod.java index c1e6425c..073dfd7b 100755 --- a/common/src/main/java/common/item/tool/ItemFishingRod.java +++ b/common/src/main/java/common/item/tool/ItemFishingRod.java @@ -61,14 +61,6 @@ public class ItemFishingRod extends Item 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. */ diff --git a/common/src/main/java/common/item/tool/ItemHorseArmor.java b/common/src/main/java/common/item/tool/ItemHorseArmor.java index 9880717c..84406435 100755 --- a/common/src/main/java/common/item/tool/ItemHorseArmor.java +++ b/common/src/main/java/common/item/tool/ItemHorseArmor.java @@ -11,7 +11,7 @@ public class ItemHorseArmor extends Item { public ItemHorseArmor(ToolMaterial material, String texture) { this.material = material; this.texture = texture; - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.ARMOR); } diff --git a/common/src/main/java/common/item/tool/ItemMagnet.java b/common/src/main/java/common/item/tool/ItemMagnet.java index 699c7ce3..5b4edf8f 100755 --- a/common/src/main/java/common/item/tool/ItemMagnet.java +++ b/common/src/main/java/common/item/tool/ItemMagnet.java @@ -19,7 +19,7 @@ public class ItemMagnet extends Item { public ItemMagnet(boolean chicken) { this.setTab(CheatTab.TOOLS); - this.setMaxAmount(1); + this.setUnstackable(); this.chicken = chicken; } diff --git a/common/src/main/java/common/item/tool/ItemPotion.java b/common/src/main/java/common/item/tool/ItemPotion.java index 314d26f2..e8a72b44 100755 --- a/common/src/main/java/common/item/tool/ItemPotion.java +++ b/common/src/main/java/common/item/tool/ItemPotion.java @@ -46,9 +46,10 @@ public class ItemPotion extends Item public ItemPotion(int data) { this.data = data; - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.POTIONS); this.setColor(TextColor.ORK); + this.setDisplay(getDisplay(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 { String s = ""; - if (this.isSplashPotion()) + if (potion.isSplashPotion()) { s = "Werfbarer "; } - List list = this.getEffects(); + List list = potion.getEffects(); if (list != null && !list.isEmpty()) { String s2 = list.get(0).getPotionName(); -// s2 = s2 + ".postfix"; return s + s2.trim(); } else { - String s1 = PotionHelper.getPotionPrefix(this.data); - return s1.trim() + " " + super.getDisplay(stack); + String s1 = PotionHelper.getPotionPrefix(potion.data); + return s1.trim() + " Trank"; } } } diff --git a/common/src/main/java/common/item/tool/ItemSaddle.java b/common/src/main/java/common/item/tool/ItemSaddle.java index 23f84abe..018d02fd 100755 --- a/common/src/main/java/common/item/tool/ItemSaddle.java +++ b/common/src/main/java/common/item/tool/ItemSaddle.java @@ -11,7 +11,7 @@ public class ItemSaddle extends Item { public ItemSaddle() { - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/tool/ItemSoup.java b/common/src/main/java/common/item/tool/ItemSoup.java index 5f69f729..7b7ba918 100755 --- a/common/src/main/java/common/item/tool/ItemSoup.java +++ b/common/src/main/java/common/item/tool/ItemSoup.java @@ -11,7 +11,7 @@ public class ItemSoup extends ItemFood public ItemSoup(int healAmount) { super(healAmount, false); - this.setMaxAmount(1); + this.setUnstackable(); } /** diff --git a/common/src/main/java/common/item/tool/ItemSpaceNavigator.java b/common/src/main/java/common/item/tool/ItemSpaceNavigator.java index 3ed09b16..de8217bc 100755 --- a/common/src/main/java/common/item/tool/ItemSpaceNavigator.java +++ b/common/src/main/java/common/item/tool/ItemSpaceNavigator.java @@ -27,7 +27,7 @@ public class ItemSpaceNavigator extends ItemMagnetic { } public ItemSpaceNavigator() { - this.setMaxAmount(1); + this.setUnstackable(); this.setColor(TextColor.DGREEN); } diff --git a/common/src/main/java/common/item/tool/ItemWand.java b/common/src/main/java/common/item/tool/ItemWand.java index 721afc8e..94452fc9 100755 --- a/common/src/main/java/common/item/tool/ItemWand.java +++ b/common/src/main/java/common/item/tool/ItemWand.java @@ -18,7 +18,7 @@ import common.world.AWorldServer; public abstract class ItemWand extends Item { public ItemWand() { - this.setMaxAmount(1); + this.setUnstackable(); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/tool/ItemWeatherToken.java b/common/src/main/java/common/item/tool/ItemWeatherToken.java index eeded184..a67e589c 100755 --- a/common/src/main/java/common/item/tool/ItemWeatherToken.java +++ b/common/src/main/java/common/item/tool/ItemWeatherToken.java @@ -14,8 +14,9 @@ public class ItemWeatherToken extends ItemMagnetic { public ItemWeatherToken(Weather weather) { this.weather = weather; - this.setMaxAmount(1); + this.setUnstackable(); this.setColor(TextColor.VIOLET); + this.setDisplay("Wetterkristall (" + this.weather.getDisplay() + ")"); } 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)]); return itemStackIn; } - - public String getDisplay(ItemStack stack) { - return super.getDisplay(stack) + " (" + this.weather.getDisplay() + ")"; - } } diff --git a/common/src/main/java/common/model/Transforms.java b/common/src/main/java/common/model/Transforms.java index 4ca6fee8..f125fd2e 100755 --- a/common/src/main/java/common/model/Transforms.java +++ b/common/src/main/java/common/model/Transforms.java @@ -97,12 +97,6 @@ public enum Transforms { 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( transform(0.0f, 0.0f, 180.0f, 0.0f, 1.5f, -2.75f, 0.375f), Transform.IDENTITY, diff --git a/common/src/main/java/common/packet/CPacketCheat.java b/common/src/main/java/common/packet/CPacketCheat.java index 0e414cbb..5cf39314 100755 --- a/common/src/main/java/common/packet/CPacketCheat.java +++ b/common/src/main/java/common/packet/CPacketCheat.java @@ -4,23 +4,20 @@ import java.io.IOException; import common.init.ItemRegistry; import common.item.Item; -import common.item.ItemStack; import common.network.IPlayer; import common.network.Packet; import common.network.PacketBuffer; public class CPacketCheat implements Packet { private Item item; - private int tagIndex; private int slot; private boolean stacked; public CPacketCheat() { } - public CPacketCheat(ItemStack stack, int slot, boolean full) { - this.item = stack.getItem(); - this.tagIndex = this.item.getTagIndex(stack.getTag()); + public CPacketCheat(Item item, int slot, boolean full) { + this.item = item; this.slot = slot; this.stacked = full; } @@ -31,14 +28,12 @@ public class CPacketCheat implements Packet { public void readPacketData(PacketBuffer buf) throws IOException { this.item = ItemRegistry.byId(buf.readShort()); - this.tagIndex = buf.readVarInt(); this.slot = buf.readShort(); this.stacked = buf.readBoolean(); } public void writePacketData(PacketBuffer buf) throws IOException { buf.writeShort(ItemRegistry.getId(this.item)); - buf.writeVarInt(this.tagIndex); buf.writeShort(this.slot); buf.writeBoolean(this.stacked); } @@ -47,10 +42,6 @@ public class CPacketCheat implements Packet { return this.item; } - public int getTagIndex() { - return this.tagIndex; - } - public boolean isStacked() { return this.stacked; } diff --git a/common/src/main/java/common/tileentity/TileEntityBeacon.java b/common/src/main/java/common/tileentity/TileEntityBeacon.java index 8daa16c0..340fe827 100755 --- a/common/src/main/java/common/tileentity/TileEntityBeacon.java +++ b/common/src/main/java/common/tileentity/TileEntityBeacon.java @@ -5,11 +5,8 @@ import java.util.List; import common.block.Block; import common.block.artificial.BlockStainedGlass; import common.block.artificial.BlockStainedGlassPane; -import common.color.DyeColor; import common.entity.types.EntityLiving; import common.init.Blocks; -import common.network.Packet; -import common.packet.SPacketUpdateTileEntity; import common.potion.Potion; import common.potion.PotionEffect; import common.tags.TagObject; @@ -21,27 +18,13 @@ import common.world.AWorldServer; public class TileEntityBeacon extends TileEntity implements ITickable { - /** List of effects that Beacon can apply */ - public static final Potion[][] effectsList = new Potion[][] {{Potion.SPEED, Potion.HASTE}, {Potion.RESISTANCE, Potion.JUMP}, {Potion.STRENGTH}, {Potion.REGENERATION}}; -// private final List beamSegments = Lists.newArrayList(); -// private long lastRenderUpdate; -// private float charge; + private static final Potion[][] effectsList = new Potion[][] {{Potion.SPEED, Potion.HASTE}, {Potion.RESISTANCE, Potion.JUMP}, {Potion.STRENGTH}, {Potion.REGENERATION}}; + private boolean isComplete; - - /** Level of this beacon's pyramid. */ private int levels = -1; - - /** Primary potion effect given by this beacon. */ private Potion primaryEffect; - - /** Secondary potion effect given by this beacon. */ 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. */ @@ -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) { 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.secondaryEffect = compound.hasString("Secondary") ? this.getEffect(compound.getString("Secondary")) : null; 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) @@ -325,237 +288,9 @@ public class TileEntityBeacon extends TileEntity implements ITickable if(this.secondaryEffect != null) compound.setString("Secondary", this.secondaryEffect.getName()); 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() { 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; -// } -// } } diff --git a/common/src/main/java/common/world/AWorldClient.java b/common/src/main/java/common/world/AWorldClient.java index 3b12d013..5f14b10a 100644 --- a/common/src/main/java/common/world/AWorldClient.java +++ b/common/src/main/java/common/world/AWorldClient.java @@ -2,7 +2,6 @@ package common.world; import common.dimension.Dimension; import common.init.SoundEvent; -import common.tags.TagObject; public abstract class AWorldClient extends World { 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 makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, TagObject compund); public abstract void setLastLightning(int last, int color); } diff --git a/server/src/main/java/server/clipboard/ReorderRegistry.java b/server/src/main/java/server/clipboard/ReorderRegistry.java index b503fd72..8a98aef3 100755 --- a/server/src/main/java/server/clipboard/ReorderRegistry.java +++ b/server/src/main/java/server/clipboard/ReorderRegistry.java @@ -228,8 +228,6 @@ public abstract class ReorderRegistry { for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { 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.spruce_door, Facing.DOWN); addAttach(Blocks.birch_door, Facing.DOWN); diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index beaf78c1..31d4fbef 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -2900,10 +2900,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer Item item = packet.getItem(); if(item == null) return; - ItemStack stack = new ItemStack(item, packet.isStacked() ? item.getItemStackLimit() : 1); - stack.setTag(item.getItemTag(packet.getTagIndex())); - if(item.hasTags() != stack.hasTag()) - return; + ItemStack stack = new ItemStack(item, packet.isStacked() ? item.getMaxAmount() : 1); int amount = stack.size; if(amount <= 0) return; diff --git a/server/src/main/java/server/worldgen/FeatureDungeons.java b/server/src/main/java/server/worldgen/FeatureDungeons.java index 719f09b4..0ef84fab 100755 --- a/server/src/main/java/server/worldgen/FeatureDungeons.java +++ b/server/src/main/java/server/worldgen/FeatureDungeons.java @@ -8,8 +8,8 @@ import common.entity.npc.EntityUndead; import common.entity.npc.EntityZombie; import common.entity.types.EntityLiving; import common.init.Blocks; -import common.init.Items; import common.item.RngLoot; +import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.rng.WeightedList; import common.tileentity.TileEntity; @@ -140,7 +140,7 @@ public class FeatureDungeons if (j3 == 1) { worldIn.setState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getState()), 2); - WeightedList list = RngLoot.addToList(LootConstants.DUNGEON_CHEST, Items.enchanted_book.getRandom(rand)); + WeightedList list = RngLoot.addToList(LootConstants.DUNGEON_CHEST, ItemEnchantedBook.getRandom(rand)); TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); if (tileentity1 instanceof TileEntityChest) diff --git a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java index 60be3d5b..1f272416 100755 --- a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java +++ b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java @@ -9,8 +9,8 @@ import common.block.tech.BlockTorch; import common.entity.item.EntityChestCart; import common.entity.npc.EntityArachnoid; import common.init.Blocks; -import common.init.Items; import common.item.RngLoot; +import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.rng.WeightedList; import common.tags.TagObject; @@ -355,12 +355,12 @@ public class StructureMineshaft 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) { - 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) diff --git a/server/src/main/java/server/worldgen/structure/StructureScattered.java b/server/src/main/java/server/worldgen/structure/StructureScattered.java index 9f9d159d..70740ffb 100755 --- a/server/src/main/java/server/worldgen/structure/StructureScattered.java +++ b/server/src/main/java/server/worldgen/structure/StructureScattered.java @@ -9,8 +9,8 @@ import common.block.tech.BlockTripWire; import common.block.tech.BlockTripWireHook; import common.entity.npc.EntityMage; import common.init.Blocks; -import common.init.Items; import common.item.RngLoot; +import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.tags.TagObject; import common.util.BlockPos; @@ -252,7 +252,7 @@ public class StructureScattered { int l1 = enumfacing.getFrontOffsetX() * 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) { - 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); @@ -571,7 +571,7 @@ public class StructureScattered 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; diff --git a/server/src/main/java/server/worldgen/structure/StructureStronghold.java b/server/src/main/java/server/worldgen/structure/StructureStronghold.java index 7b349ce8..491e76bb 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStronghold.java +++ b/server/src/main/java/server/worldgen/structure/StructureStronghold.java @@ -11,8 +11,8 @@ import common.collect.Lists; import common.collect.Maps; import common.entity.npc.EntityHaunter; import common.init.Blocks; -import common.init.Items; import common.item.RngLoot; +import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.tags.TagObject; 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)))) { 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; @@ -742,12 +742,12 @@ public class StructureStronghold 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) { 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; @@ -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, 2, 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;