forked from xjboss/KCauldronX
Initial commit (Forge 1291).
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
--- ../src-base/minecraft/net/minecraft/util/EntityDamageSourceIndirect.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/EntityDamageSourceIndirect.java
|
||||
@@ -33,4 +33,11 @@
|
||||
String s1 = s + ".item";
|
||||
return itemstack != null && itemstack.hasDisplayName() && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {p_151519_1_.func_145748_c_(), ichatcomponent, itemstack.func_151000_E()}): new ChatComponentTranslation(s, new Object[] {p_151519_1_.func_145748_c_(), ichatcomponent});
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public Entity getProximateDamageSource()
|
||||
+ {
|
||||
+ return super.getEntity();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
85
patches/net/minecraft/util/FoodStats.java.patch
Normal file
85
patches/net/minecraft/util/FoodStats.java.patch
Normal file
@ -0,0 +1,85 @@
|
||||
--- ../src-base/minecraft/net/minecraft/util/FoodStats.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/FoodStats.java
|
||||
@@ -7,16 +7,31 @@
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.entity.player.EntityPlayerMP;
|
||||
+import net.minecraft.network.play.server.S06PacketUpdateHealth;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class FoodStats
|
||||
{
|
||||
- private int foodLevel = 20;
|
||||
- private float foodSaturationLevel = 5.0F;
|
||||
- private float foodExhaustionLevel;
|
||||
- private int foodTimer;
|
||||
+ // CraftBukkit start - All made public
|
||||
+ public int foodLevel = 20;
|
||||
+ public float foodSaturationLevel = 5.0F;
|
||||
+ public float foodExhaustionLevel;
|
||||
+ public int foodTimer;
|
||||
+ private EntityPlayer entityplayer;
|
||||
+ // CraftBukkit end
|
||||
private int prevFoodLevel = 20;
|
||||
private static final String __OBFID = "CL_00001729";
|
||||
|
||||
+ // CraftBukkit start - added EntityPlayer constructor
|
||||
+ public FoodStats(EntityPlayer entityplayer)
|
||||
+ {
|
||||
+ org.apache.commons.lang.Validate.notNull(entityplayer);
|
||||
+ this.entityplayer = entityplayer;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void addStats(int p_75122_1_, float p_75122_2_)
|
||||
{
|
||||
this.foodLevel = Math.min(p_75122_1_ + this.foodLevel, 20);
|
||||
@@ -25,7 +40,17 @@
|
||||
|
||||
public void func_151686_a(ItemFood p_151686_1_, ItemStack p_151686_2_)
|
||||
{
|
||||
- this.addStats(p_151686_1_.func_150905_g(p_151686_2_), p_151686_1_.func_150906_h(p_151686_2_));
|
||||
+ // CraftBukkit start
|
||||
+ int oldFoodLevel = foodLevel;
|
||||
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityplayer, p_151686_1_.func_150905_g(p_151686_2_) + oldFoodLevel);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.addStats(event.getFoodLevel() - oldFoodLevel, p_151686_1_.func_150906_h(p_151686_2_));
|
||||
+ }
|
||||
+
|
||||
+ ((EntityPlayerMP) entityplayer).playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(((EntityPlayerMP) entityplayer).getBukkitEntity().getScaledHealth(), entityplayer.getFoodStats().foodLevel, entityplayer.getFoodStats().foodSaturationLevel));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void onUpdate(EntityPlayer p_75118_1_)
|
||||
@@ -43,7 +68,16 @@
|
||||
}
|
||||
else if (enumdifficulty != EnumDifficulty.PEACEFUL)
|
||||
{
|
||||
- this.foodLevel = Math.max(this.foodLevel - 1, 0);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(p_75118_1_, Math.max(this.foodLevel - 1, 0));
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.foodLevel = event.getFoodLevel();
|
||||
+ }
|
||||
+
|
||||
+ ((EntityPlayerMP) p_75118_1_).playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(((EntityPlayerMP) p_75118_1_).getBukkitEntity().getScaledHealth(), this.foodLevel, this.foodSaturationLevel));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +87,8 @@
|
||||
|
||||
if (this.foodTimer >= 80)
|
||||
{
|
||||
- p_75118_1_.heal(1.0F);
|
||||
+ // CraftBukkit - added RegainReason
|
||||
+ p_75118_1_.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
|
||||
this.addExhaustion(3.0F);
|
||||
this.foodTimer = 0;
|
||||
}
|
29
patches/net/minecraft/util/IntHashMap.java.patch
Normal file
29
patches/net/minecraft/util/IntHashMap.java.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- ../src-base/minecraft/net/minecraft/util/IntHashMap.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/IntHashMap.java
|
||||
@@ -10,7 +10,7 @@
|
||||
private int threshold = 12;
|
||||
private final float growFactor = 0.75F;
|
||||
private transient volatile int versionStamp;
|
||||
- private Set keySet = new HashSet();
|
||||
+ // private Set keySet = new HashSet(); // CraftBukkit - expensive and unused
|
||||
private static final String __OBFID = "CL_00001490";
|
||||
|
||||
private static int computeHash(int p_76044_0_)
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
public void addKey(int p_76038_1_, Object p_76038_2_)
|
||||
{
|
||||
- this.keySet.add(Integer.valueOf(p_76038_1_));
|
||||
+ //this.keySet.add(Integer.valueOf(p_76038_1_)); // CraftBukkit
|
||||
int j = computeHash(p_76038_1_);
|
||||
int k = getSlotIndex(j, this.slots.length);
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
public Object removeObject(int p_76049_1_)
|
||||
{
|
||||
- this.keySet.remove(Integer.valueOf(p_76049_1_));
|
||||
+ //this.keySet.remove(Integer.valueOf(p_76049_1_)); // CraftBukkit
|
||||
IntHashMap.Entry entry = this.removeEntry(p_76049_1_);
|
||||
return entry == null ? null : entry.valueEntry;
|
||||
}
|
36
patches/net/minecraft/util/RegistryNamespaced.java.patch
Normal file
36
patches/net/minecraft/util/RegistryNamespaced.java.patch
Normal file
@ -0,0 +1,36 @@
|
||||
--- ../src-base/minecraft/net/minecraft/util/RegistryNamespaced.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/RegistryNamespaced.java
|
||||
@@ -5,6 +5,11 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
+// Cauldron start
|
||||
+import cpw.mods.fml.common.FMLLog;
|
||||
+import net.minecraft.block.Block;
|
||||
+// Cauldron end
|
||||
+
|
||||
public class RegistryNamespaced extends RegistrySimple implements IObjectIntIterable
|
||||
{
|
||||
protected ObjectIntIdentityMap underlyingIntegerMap = new ObjectIntIdentityMap();
|
||||
@@ -18,6 +23,21 @@
|
||||
|
||||
public void addObject(int p_148756_1_, String p_148756_2_, Object p_148756_3_)
|
||||
{
|
||||
+ // Cauldron start - register item/block materials for Bukkit
|
||||
+ boolean isForgeBlock = p_148756_3_ instanceof Block && (p_148756_3_.getClass().getName().length() > 3 && !p_148756_3_.getClass().getName().startsWith("net.minecraft.block")) ? true : false;
|
||||
+ org.bukkit.Material material = org.bukkit.Material.addMaterial(p_148756_1_, p_148756_2_, isForgeBlock);
|
||||
+ if (material != null)
|
||||
+ {
|
||||
+ if (isForgeBlock)
|
||||
+ {
|
||||
+ FMLLog.info("Injected new Forge block material %s with ID %d.", material.name(), material.getId());
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FMLLog.info("Injected new Forge item material %s with ID %d.", material.name(), material.getId());
|
||||
+ }
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
this.underlyingIntegerMap.func_148746_a(p_148756_3_, p_148756_1_);
|
||||
this.putObject(ensureNamespaced(p_148756_2_), p_148756_3_);
|
||||
}
|
17
patches/net/minecraft/util/WeightedRandomFishable.java.patch
Normal file
17
patches/net/minecraft/util/WeightedRandomFishable.java.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- ../src-base/minecraft/net/minecraft/util/WeightedRandomFishable.java
|
||||
+++ ../src-work/minecraft/net/minecraft/util/WeightedRandomFishable.java
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
public class WeightedRandomFishable extends WeightedRandom.Item
|
||||
{
|
||||
- private final ItemStack field_150711_b;
|
||||
- private float field_150712_c;
|
||||
- private boolean field_150710_d;
|
||||
+ // Cauldron start - private -> public
|
||||
+ public final ItemStack field_150711_b;
|
||||
+ public float field_150712_c;
|
||||
+ public boolean field_150710_d;
|
||||
+ // Cauldron end
|
||||
private static final String __OBFID = "CL_00001664";
|
||||
|
||||
public WeightedRandomFishable(ItemStack p_i45317_1_, int p_i45317_2_)
|
Reference in New Issue
Block a user