Fixed MCP mappings again. Fixed the Entity NBT code.
Added a new hook to support custom enchantments.
This commit is contained in:
parent
61d9b78704
commit
bdda88d74e
8 changed files with 72 additions and 14 deletions
|
@ -35,7 +35,7 @@
|
|||
+ */
|
||||
+ public int quantityDropped(int meta, int fortune, Random random)
|
||||
+ {
|
||||
+ return func_40198_a(fortune, random);
|
||||
+ return quantityDroppedWithBonus(fortune, random);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -109,6 +109,13 @@
|
||||
return (new StringBuilder()).append(s).append(" ").append(StatCollector.translateToLocal((new StringBuilder()).append("enchantment.level.").append(i).toString())).toString();
|
||||
}
|
||||
|
||||
+ /* FORGE: Can enchantment be applied to item. Redirected to allow users to
|
||||
+ * override it in their Enchantment class.
|
||||
+ */
|
||||
+ public boolean canEnchantItem(ItemStack ist) {
|
||||
+ return type.canEnchantItem(ist.getItem());
|
||||
+ }
|
||||
+
|
||||
static
|
||||
{
|
||||
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);
|
|
@ -0,0 +1,11 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -271,7 +271,7 @@
|
||||
for(int k = 0; k < j; k++)
|
||||
{
|
||||
Enchantment enchantment = aenchantment[k];
|
||||
- if(enchantment == null || !enchantment.type.canEnchantItem(item))
|
||||
+ if(enchantment == null || !enchantment.canEnchantItem(itemstack))
|
||||
{
|
||||
continue;
|
||||
}
|
|
@ -31,21 +31,23 @@
|
|||
|
||||
public DataWatcher getDataWatcher()
|
||||
{
|
||||
@@ -955,6 +972,7 @@
|
||||
@@ -955,6 +972,10 @@
|
||||
nbttagcompound.setShort("Fire", (short)fire);
|
||||
nbttagcompound.setShort("Air", (short)getAir());
|
||||
nbttagcompound.setBoolean("OnGround", onGround);
|
||||
+ nbttagcompound.setCompoundTag("ForgeEntityData", customEntityData);
|
||||
+ if(customEntityData!=null) {
|
||||
+ nbttagcompound.setCompoundTag("ForgeData",
|
||||
+ customEntityData);
|
||||
+ }
|
||||
writeEntityToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -989,6 +1007,10 @@
|
||||
@@ -989,6 +1010,9 @@
|
||||
onGround = nbttagcompound.getBoolean("OnGround");
|
||||
setPosition(posX, posY, posZ);
|
||||
setRotation(rotationYaw, rotationPitch);
|
||||
+ if (nbttagcompound.hasKey("ForgeEntityData"))
|
||||
+ {
|
||||
+ customEntityData.getCompoundTag("ForgeEntityData");
|
||||
+ if(nbttagcompound.hasKey("ForgeData")) {
|
||||
+ customEntityData=nbttagcompound.getCompoundTag("ForgeData");
|
||||
+ }
|
||||
readEntityFromNBT(nbttagcompound);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
+ */
|
||||
+ public int quantityDropped(int meta, int fortune, Random random)
|
||||
+ {
|
||||
+ return func_40162_a(fortune, random);
|
||||
+ return quantityDroppedWithBonus(fortune, random);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
--- ../src_base/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -98,6 +98,13 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
+ /* FORGE: Can enchantment be applied to item. Redirected to allow users to
|
||||
+ * override it in their Enchantment class.
|
||||
+ */
|
||||
+ public boolean canEnchantItem(ItemStack ist) {
|
||||
+ return type.canEnchantItem(ist.getItem());
|
||||
+ }
|
||||
+
|
||||
static
|
||||
{
|
||||
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);
|
|
@ -0,0 +1,11 @@
|
|||
--- ../src_base/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -271,7 +271,7 @@
|
||||
for(int k = 0; k < j; k++)
|
||||
{
|
||||
Enchantment enchantment = aenchantment[k];
|
||||
- if(enchantment == null || !enchantment.type.canEnchantItem(item))
|
||||
+ if(enchantment == null || !enchantment.canEnchantItem(itemstack))
|
||||
{
|
||||
continue;
|
||||
}
|
|
@ -23,21 +23,23 @@
|
|||
public DataWatcher getDataWatcher()
|
||||
{
|
||||
return dataWatcher;
|
||||
@@ -873,6 +889,7 @@
|
||||
@@ -873,6 +889,10 @@
|
||||
nbttagcompound.setShort("Fire", (short)fire);
|
||||
nbttagcompound.setShort("Air", (short)getAir());
|
||||
nbttagcompound.setBoolean("OnGround", onGround);
|
||||
+ nbttagcompound.setCompoundTag("ForgeEntityData", customEntityData);
|
||||
+ if(customEntityData!=null) {
|
||||
+ nbttagcompound.setCompoundTag("ForgeData",
|
||||
+ customEntityData);
|
||||
+ }
|
||||
writeEntityToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -907,6 +924,10 @@
|
||||
@@ -907,6 +927,9 @@
|
||||
onGround = nbttagcompound.getBoolean("OnGround");
|
||||
setPosition(posX, posY, posZ);
|
||||
setRotation(rotationYaw, rotationPitch);
|
||||
+ if (nbttagcompound.hasKey("ForgeEntityData"))
|
||||
+ {
|
||||
+ customEntityData.getCompoundTag("ForgeEntityData");
|
||||
+ if(nbttagcompound.hasKey("ForgeData")) {
|
||||
+ customEntityData=nbttagcompound.getCompoundTag("ForgeData");
|
||||
+ }
|
||||
readEntityFromNBT(nbttagcompound);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue