data changes
This commit is contained in:
parent
575015abd6
commit
b14a99dc05
75 changed files with 449 additions and 1717 deletions
|
@ -43,7 +43,7 @@ public enum Material {
|
|||
EXPLOSIVE {{
|
||||
this.setBurning().setTranslucent();
|
||||
}},
|
||||
BLOCKING {{ // can't be placed next to signs and banners
|
||||
BLOCKING {{ // can't be placed next to signs
|
||||
this.setTranslucent().setNoPushMobility();
|
||||
}},
|
||||
PORTAL {{ // not floodable by liquids
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.foliage;
|
|||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeedFood;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -26,6 +27,6 @@ public class BlockCarrot extends BlockCrops
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeedFood(3, this, Blocks.farmland).setDisplay("Karotte").setMaxAmount(128);
|
||||
return new ItemSeedFood(3, this, Blocks.farmland).setDisplay("Karotte").setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -228,6 +229,6 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeeds(this, Blocks.farmland).setDisplay("Weizenkörner").setMaxAmount(256);
|
||||
return new ItemSeeds(this, Blocks.farmland).setDisplay("Weizenkörner").setMaxAmount(StackSize.XL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import common.init.Blocks;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeedFood;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -45,6 +46,6 @@ public class BlockPotato extends BlockCrops
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeedFood(1, this, Blocks.farmland).setDisplay("Kartoffel").setMaxAmount(128);
|
||||
return new ItemSeedFood(1, this, Blocks.farmland).setDisplay("Kartoffel").setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import common.init.Blocks;
|
|||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
|
@ -179,6 +180,6 @@ public class BlockReed extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(128);
|
||||
return new ItemSmallBlock(this).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -306,7 +307,7 @@ public class BlockStem extends BlockBush implements DirectionalUp, IGrowable
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeeds(this, Blocks.farmland).setDisplay(this.itemName).setMaxAmount(256);
|
||||
return new ItemSeeds(this, Blocks.farmland).setDisplay(this.itemName).setMaxAmount(StackSize.XL);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -7,6 +7,7 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -119,6 +120,6 @@ public class BlockWart extends BlockBush
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(128);
|
||||
return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.collect.Sets;
|
|||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemRedstone;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
|
@ -1014,7 +1015,7 @@ public class BlockRedstoneWire extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemRedstone(Blocks.redstone).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(256);
|
||||
return new ItemRedstone(Blocks.redstone).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(StackSize.XL);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -112,7 +112,7 @@ public class BlockTNT extends Block
|
|||
{
|
||||
Item item = playerIn.getCurrentEquippedItem().getItem();
|
||||
|
||||
if (item == Items.flint_and_steel || item == Items.fire_charge)
|
||||
if (item == Items.flint_and_steel || item == Items.fireball)
|
||||
{
|
||||
this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
|
||||
worldIn.setBlockToAir(pos);
|
||||
|
|
|
@ -10,6 +10,7 @@ import common.init.Blocks;
|
|||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.BlockLayer;
|
||||
|
@ -662,7 +663,7 @@ public class BlockTripWire extends Block
|
|||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSmallBlock(this).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(1024);
|
||||
return new ItemSmallBlock(this).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(StackSize.XXXL);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.enchantment;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
|
@ -12,6 +13,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.material.ItemEnchantedBook;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tags.TagObject;
|
||||
|
@ -59,7 +61,11 @@ public class EnchantmentHelper
|
|||
public static Map<Enchantment, Integer> getEnchantments(ItemStack stack)
|
||||
{
|
||||
Map<Enchantment, Integer> map = Maps.<Enchantment, Integer>newLinkedHashMap();
|
||||
List<TagObject> list = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList();
|
||||
if(stack.getItem() instanceof ItemEnchantedBook book) {
|
||||
map.put(book.getEnchantment(), book.getLevel());
|
||||
return map;
|
||||
}
|
||||
List<TagObject> list = stack.getEnchantmentTagList();
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
|
@ -78,34 +84,38 @@ public class EnchantmentHelper
|
|||
|
||||
public static void setEnchantments(Map<Enchantment, Integer> enchMap, ItemStack stack)
|
||||
{
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
Iterator<Enchantment> 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<Enchantment, Integer> 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<TagObject> list = Lists.newArrayList();
|
||||
Iterator<Enchantment> 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<RngEnchantment> list = buildEnchantmentList(p_77504_0_, p_77504_1_, p_77504_2_);
|
||||
boolean flag = p_77504_1_.getItem() == Items.book;
|
||||
List<RngEnchantment> 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<RngEnchantment> buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int level)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<TagObject> list = Lists.newArrayList();
|
||||
|
||||
for (int k2 = 0; k2 < inv.getSizeInventory(); ++k2)
|
||||
{
|
||||
ItemStack itemstack3 = inv.getStackInSlot(k2);
|
||||
|
||||
if (itemstack3 != null && itemstack3.getItem() == Items.firework_charge && itemstack3.hasTag() && itemstack3.getTag().hasObject("Explosion"))
|
||||
{
|
||||
list.add(itemstack3.getTag().getObject("Explosion"));
|
||||
}
|
||||
}
|
||||
|
||||
data.setList("Explosions", list);
|
||||
data.setByte("Flight", (byte)j);
|
||||
tag.setObject("Fireworks", data);
|
||||
this.field_92102_a.setTag(tag);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1)
|
||||
{
|
||||
this.field_92102_a = new ItemStack(Items.firework_charge);
|
||||
TagObject tag = new TagObject();
|
||||
TagObject data = new TagObject();
|
||||
byte b0 = 0;
|
||||
List<Integer> list = Lists.<Integer>newArrayList();
|
||||
|
||||
for (int l1 = 0; l1 < inv.getSizeInventory(); ++l1)
|
||||
{
|
||||
ItemStack itemstack2 = inv.getStackInSlot(l1);
|
||||
|
||||
if (itemstack2 != null)
|
||||
{
|
||||
if (itemstack2.getItem() instanceof ItemDye dye)
|
||||
{
|
||||
list.add(dye.getColor().getColor());
|
||||
}
|
||||
else if (itemstack2.getItem() == Items.glowstone_dust)
|
||||
{
|
||||
data.setBool("Flicker", true);
|
||||
}
|
||||
else if (itemstack2.getItem() == Items.diamond)
|
||||
{
|
||||
data.setBool("Trail", true);
|
||||
}
|
||||
else if (itemstack2.getItem() == Items.fire_charge)
|
||||
{
|
||||
b0 = 1;
|
||||
}
|
||||
else if (itemstack2.getItem() == Items.feather)
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
else if (itemstack2.getItem() == Items.gold_nugget)
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
else if (itemstack2.getItem() == Items.skull)
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int[] aint1 = new int[list.size()];
|
||||
|
||||
for (int l2 = 0; l2 < aint1.length; ++l2)
|
||||
{
|
||||
aint1[l2] = ((Integer)list.get(l2)).intValue();
|
||||
}
|
||||
|
||||
data.setIntArray("Colors", aint1);
|
||||
data.setByte("Type", b0);
|
||||
tag.setObject("Explosion", data);
|
||||
this.field_92102_a.setTag(tag);
|
||||
return true;
|
||||
}
|
||||
else if (j == 0 && i == 0 && l == 1 && k > 0 && k == i1)
|
||||
{
|
||||
List<Integer> list1 = Lists.<Integer>newArrayList();
|
||||
|
||||
for (int i2 = 0; i2 < inv.getSizeInventory(); ++i2)
|
||||
{
|
||||
ItemStack itemstack1 = inv.getStackInSlot(i2);
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
if (itemstack1.getItem() instanceof ItemDye dye)
|
||||
{
|
||||
list1.add(dye.getColor().getColor());
|
||||
}
|
||||
else if (itemstack1.getItem() == Items.firework_charge)
|
||||
{
|
||||
this.field_92102_a = itemstack1.copy();
|
||||
this.field_92102_a.size = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int[] aint = new int[list1.size()];
|
||||
|
||||
for (int j2 = 0; j2 < aint.length; ++j2)
|
||||
{
|
||||
aint[j2] = ((Integer)list1.get(j2)).intValue();
|
||||
}
|
||||
|
||||
if (this.field_92102_a != null && this.field_92102_a.hasTag())
|
||||
{
|
||||
TagObject tag = this.field_92102_a.getTag().getObject("Explosion");
|
||||
|
||||
if (tag == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.setIntArray("FadeColors", aint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Item that is the result of this recipe
|
||||
*/
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv)
|
||||
{
|
||||
return this.field_92102_a.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the recipe area
|
||||
*/
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.field_92102_a;
|
||||
}
|
||||
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < aitemstack.length; ++i)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null && itemstack.getItem().hasContainerItem())
|
||||
{
|
||||
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
|
||||
}
|
||||
}
|
||||
|
||||
return aitemstack;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecipeRepairItem implements IRecipe
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<BlockStaticLiquid, BlockDynamicLiquid> 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<BlockStaticLiquid, BlockDynamicLiquid> 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<Integer, TextColor> sides : ItemDie.DIE_SIDES) {
|
||||
register("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("Würfel").setMaxAmount(128));
|
||||
register("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setMaxAmount(StackSize.L));
|
||||
}
|
||||
register("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
|
||||
register("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));
|
||||
|
|
|
@ -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 extends Item> T get(String id) {
|
||||
T item = (T)ItemRegistry.byName(id);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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<RngEnchantment> 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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public enum CheatTab {
|
|||
|
||||
public void filter(List<ItemStack> 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<ItemStack> 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<ItemStack> 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<ItemStack> list) {
|
||||
for(Item item : ItemRegistry.items()) {
|
||||
if(item.getTab() == this)
|
||||
item.getSubItems(list);
|
||||
list.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TagObject> 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<String> 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<TagObject> getItemTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final void getSubItems(List<ItemStack> subItems) {
|
||||
if(this.validTags != null) {
|
||||
for(TagObject valid : this.validTags) {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
stack.setTag(valid);
|
||||
subItems.add(stack);
|
||||
}
|
||||
}
|
||||
else {
|
||||
subItems.add(new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
||||
public CheatTab getTab() {
|
||||
return this.tab;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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<TagObject> 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
22
common/src/main/java/common/item/StackSize.java
Normal file
22
common/src/main/java/common/item/StackSize.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package common.item;
|
||||
|
||||
public enum StackSize {
|
||||
XXS(8),
|
||||
XS(16),
|
||||
S(32),
|
||||
M(64),
|
||||
L(128),
|
||||
XL(256),
|
||||
XXL(512),
|
||||
XXXL(1024);
|
||||
|
||||
private final int amount;
|
||||
|
||||
private StackSize(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<ItemEnchantedBook> BOOKS = Lists.newArrayList();
|
||||
public static final Map<Enchantment, List<ItemEnchantedBook>> MAPPING = Maps.newEnumMap(Enchantment.class);
|
||||
|
||||
private final Enchantment enchantment;
|
||||
private final int level;
|
||||
|
||||
public ItemEnchantedBook(Enchantment enchantment, int level) {
|
||||
this.setColor(TextColor.YELLOW);
|
||||
this.enchantment = enchantment;
|
||||
this.level = level;
|
||||
BOOKS.add(this);
|
||||
List<ItemEnchantedBook> list = MAPPING.get(enchantment);
|
||||
if(list == null)
|
||||
MAPPING.put(enchantment, list = Lists.newArrayList());
|
||||
list.add(this);
|
||||
}
|
||||
|
||||
public Enchantment getEnchantment() {
|
||||
return this.enchantment;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
|
@ -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<TagObject> getItemTags()
|
||||
{
|
||||
List<TagObject> tags = Lists.newArrayList();
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if(enchantment != null && enchantment.getType() != null)
|
||||
tags.add(this.getEnchantedItemStack(new RngEnchantment(enchantment, enchantment.getMaxLevel())).getTag());
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Return an item rarity from EnumRarity
|
||||
// */
|
||||
// public ChatFormat getColor(ItemStack stack)
|
||||
// {
|
||||
// return this.getEnchantments(stack).tagCount() > 0 ? ChatFormat.YELLOW : super.getColor(stack);
|
||||
// }
|
||||
|
||||
public List<TagObject> getEnchantments(ItemStack stack)
|
||||
{
|
||||
TagObject nbttagcompound = stack.getTag();
|
||||
return nbttagcompound != null && nbttagcompound.hasList("StoredEnchantments") ? nbttagcompound.getList("StoredEnchantments") : Lists.newArrayList();
|
||||
}
|
||||
|
||||
/**
|
||||
* allows items to add custom lines of information to the mouseover description
|
||||
*/
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
super.addInformation(stack, playerIn, tooltip);
|
||||
List<TagObject> 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<ItemEnchantedBook> list = MAPPING.get(enchantment);
|
||||
for(ItemEnchantedBook book : list) {
|
||||
if(book.getLevel() >= level)
|
||||
return book;
|
||||
}
|
||||
return list.getLast();
|
||||
}
|
||||
|
||||
public static RngLoot getRandom(Random rand)
|
||||
{
|
||||
List<TagObject> nbttaglist = this.getEnchantments(stack);
|
||||
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<ItemStack> list)
|
||||
{
|
||||
for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i)
|
||||
{
|
||||
list.add(this.getEnchantedItemStack(new RngEnchantment(enchantment, i)));
|
||||
}
|
||||
}
|
||||
|
||||
public RngLoot getRandom(Random rand)
|
||||
{
|
||||
return this.getRandom(rand, 1, 1, 1);
|
||||
}
|
||||
|
||||
public RngLoot getRandom(Random rand, int minChance, int maxChance, int weight)
|
||||
public static RngLoot getRandom(Random rand, int minChance, int maxChance, int weight)
|
||||
{
|
||||
ItemStack itemstack = new ItemStack(Items.book);
|
||||
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ItemBoat extends Item
|
|||
{
|
||||
public ItemBoat()
|
||||
{
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.VEHICLES);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<ItemMonsterPlacer> 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);
|
||||
|
|
|
@ -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<ItemNpcSpawner> 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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,7 +15,7 @@ public class ItemBucketMilk extends Item
|
|||
{
|
||||
public ItemBucketMilk()
|
||||
{
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.world.World;
|
|||
|
||||
public class ItemEditWand extends Item {
|
||||
public ItemEditWand() {
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String> tooltip)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
TagObject nbttagcompound = stack.getTag().getObject("Fireworks");
|
||||
|
||||
if (nbttagcompound != null)
|
||||
{
|
||||
if (nbttagcompound.hasByte("Flight"))
|
||||
{
|
||||
tooltip.add("Flugdauer: " + nbttagcompound.getByte("Flight"));
|
||||
}
|
||||
|
||||
List<TagObject> nbttaglist = nbttagcompound.getList("Explosions");
|
||||
|
||||
if (nbttaglist != null && nbttaglist.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < nbttaglist.size(); ++i)
|
||||
{
|
||||
TagObject nbttagcompound1 = nbttaglist.get(i);
|
||||
List<String> list = Lists.<String>newArrayList();
|
||||
ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list);
|
||||
|
||||
if (list.size() > 0)
|
||||
{
|
||||
for (int j = 1; j < ((List)list).size(); ++j)
|
||||
{
|
||||
list.set(j, " " + (String)list.get(j));
|
||||
}
|
||||
|
||||
tooltip.addAll(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
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;
|
||||
|
|
|
@ -1,208 +0,0 @@
|
|||
package common.item.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.color.DyeColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.projectile.EntityFireCharge;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemFireworkCharge extends Item
|
||||
{
|
||||
private static final String[] EXPLOSIONS = new String[] {"Kleine Kugel", "Große Kugel", "Stern", "Pentagramm", "Explosion"};
|
||||
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
if (renderPass != 1)
|
||||
{
|
||||
return super.getColorFromItemStack(stack, renderPass);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
TagObject nbttagcompound = stack.getTag().getObject("Explosion");
|
||||
|
||||
if (nbttagcompound != null)
|
||||
{
|
||||
if(nbttagcompound.hasIntArray("Colors")) {
|
||||
int[] aint = nbttagcompound.getIntArray("Colors");
|
||||
|
||||
if (aint.length == 1)
|
||||
{
|
||||
return aint[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
for (int l : aint)
|
||||
{
|
||||
i += (l & 16711680) >> 16;
|
||||
j += (l & 65280) >> 8;
|
||||
k += (l & 255) >> 0;
|
||||
}
|
||||
|
||||
i = i / aint.length;
|
||||
j = j / aint.length;
|
||||
k = k / aint.length;
|
||||
return i << 16 | j << 8 | k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 9079434;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* allows items to add custom lines of information to the mouseover description
|
||||
*/
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
if (stack.hasTag())
|
||||
{
|
||||
TagObject nbttagcompound = stack.getTag().getObject("Explosion");
|
||||
|
||||
if (nbttagcompound != null)
|
||||
{
|
||||
addExplosionInfo(nbttagcompound, tooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addExplosionInfo(TagObject nbt, List<String> tooltip)
|
||||
{
|
||||
byte b0 = nbt.getByte("Type");
|
||||
|
||||
if (b0 >= 0 && b0 <= 4)
|
||||
{
|
||||
tooltip.add(EXPLOSIONS[b0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip.add("Unbekannte Form");
|
||||
}
|
||||
|
||||
int[] aint = nbt.getIntArray("Colors");
|
||||
|
||||
if (aint.length > 0)
|
||||
{
|
||||
boolean flag = true;
|
||||
String s = "";
|
||||
|
||||
for (int i : aint)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
s = s + ", ";
|
||||
}
|
||||
|
||||
flag = false;
|
||||
boolean flag1 = false;
|
||||
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
if (i == color.getColor())
|
||||
{
|
||||
flag1 = true;
|
||||
s = s + color.getDisplay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
s = s + "Benutzerdefiniert";
|
||||
}
|
||||
}
|
||||
|
||||
tooltip.add(s);
|
||||
}
|
||||
|
||||
int[] aint1 = nbt.getIntArray("FadeColors");
|
||||
|
||||
if (aint1.length > 0)
|
||||
{
|
||||
boolean flag2 = true;
|
||||
String s1 = "Übergang zu ";
|
||||
|
||||
for (int l : aint1)
|
||||
{
|
||||
if (!flag2)
|
||||
{
|
||||
s1 = s1 + ", ";
|
||||
}
|
||||
|
||||
flag2 = false;
|
||||
boolean flag5 = false;
|
||||
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
if (l == color.getColor())
|
||||
{
|
||||
flag5 = true;
|
||||
s1 = s1 + color.getDisplay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag5)
|
||||
{
|
||||
s1 = s1 + "Benutzerdefiniert";
|
||||
}
|
||||
}
|
||||
|
||||
tooltip.add(s1);
|
||||
}
|
||||
|
||||
boolean flag3 = nbt.getBool("Trail");
|
||||
|
||||
if (flag3)
|
||||
{
|
||||
tooltip.add("Schweif");
|
||||
}
|
||||
|
||||
boolean flag4 = nbt.getBool("Flicker");
|
||||
|
||||
if (flag4)
|
||||
{
|
||||
tooltip.add("Funkeln");
|
||||
}
|
||||
}
|
||||
|
||||
// public Set<String> getValidTags() {
|
||||
// return Sets.newHashSet("Explosion");
|
||||
// }
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.getTransform(), "firework_charge", "firework_charge_overlay");
|
||||
}
|
||||
|
||||
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
double d0 = position.xCoord + (double)((float)facing.getFrontOffsetX() * 0.3F);
|
||||
double d1 = position.yCoord + (double)((float)facing.getFrontOffsetY() * 0.3F);
|
||||
double d2 = position.zCoord + (double)((float)facing.getFrontOffsetZ() * 0.3F);
|
||||
double d3 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetX();
|
||||
double d4 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetY();
|
||||
double d5 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetZ();
|
||||
world.spawnEntityInWorld(new EntityFireCharge(world, d0, d1, d2, d3, d4, d5));
|
||||
stack.splitStack(1);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getDispenseSoundId() {
|
||||
return 1009;
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ItemMagnet extends Item {
|
|||
|
||||
public <T extends Entity> ItemMagnet(boolean chicken) {
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
this.chicken = chicken;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<PotionEffect> list = this.getEffects();
|
||||
List<PotionEffect> 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ItemSaddle extends Item
|
|||
{
|
||||
public ItemSaddle()
|
||||
{
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
this.setTab(CheatTab.TOOLS);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ItemSoup extends ItemFood
|
|||
public ItemSoup(int healAmount)
|
||||
{
|
||||
super(healAmount, false);
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ItemSpaceNavigator extends ItemMagnetic {
|
|||
}
|
||||
|
||||
public ItemSpaceNavigator() {
|
||||
this.setMaxAmount(1);
|
||||
this.setUnstackable();
|
||||
this.setColor(TextColor.DGREEN);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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() + ")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<IPlayer> {
|
||||
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<IPlayer> {
|
|||
|
||||
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<IPlayer> {
|
|||
return this.item;
|
||||
}
|
||||
|
||||
public int getTagIndex() {
|
||||
return this.tagIndex;
|
||||
}
|
||||
|
||||
public boolean isStacked() {
|
||||
return this.stacked;
|
||||
}
|
||||
|
|
|
@ -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<TileEntityBeacon.BeamSegment> beamSegments = Lists.<TileEntityBeacon.BeamSegment>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;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue