From d4a181d43109c191045d6dcaa8cbd3bac883c83e Mon Sep 17 00:00:00 2001 From: Prototik Date: Wed, 13 May 2015 23:39:40 +0700 Subject: [PATCH] MPS patches --- .gitmodules | 2 +- build.gradle | 3 +- .../entity/EntityLivingBase.java.patch | 76 ++++++++++++------- .../entity/player/EntityPlayer.java.patch | 2 +- .../net/minecraft/item/ItemStack.java.patch | 43 +++++++++-- 5 files changed, 89 insertions(+), 37 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6f8f134..ba64289 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "bukkit"] path = bukkit - url = https://github.com/gamerforEA/Bukkit.git + url = https://prok.pw/git/prototik/bukkit.git [submodule "forge"] path = forge url = https://github.com/MinecraftForge/MinecraftForge.git diff --git a/build.gradle b/build.gradle index 3d105b6..a908a50 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,8 @@ ext.mcVersion = "1.7.10" ext.cauldronVersion = "2" ext.forgeVersion = "1403" ext.bukkitVersion = "1" -version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${bukkitVersion}.49" +ext.revision = "54" +version = "${mcVersion}-${cauldronVersion}.${forgeVersion}.${bukkitVersion}.${revision}" jenkins { job = 'Cauldron' diff --git a/patches/net/minecraft/entity/EntityLivingBase.java.patch b/patches/net/minecraft/entity/EntityLivingBase.java.patch index d60ba62..9af8a24 100644 --- a/patches/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,6 +1,21 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -50,14 +50,28 @@ +@@ -2,12 +2,14 @@ + + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++ + import java.util.Collection; + import java.util.HashMap; + import java.util.Iterator; + import java.util.List; + import java.util.Random; + import java.util.UUID; ++ + import net.minecraft.block.Block; + import net.minecraft.block.material.Material; + import net.minecraft.enchantment.EnchantmentHelper; +@@ -50,14 +52,30 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.ForgeHooks; @@ -9,10 +24,12 @@ +// CraftBukkit start +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.network.play.server.S28PacketEffect; ++ +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; +import org.bukkit.event.entity.EntityRegainHealthEvent; ++import org.bukkit.inventory.Inventory; +// CraftBukkit end +import org.bukkit.craftbukkit.SpigotTimings; // Spigot +import org.bukkit.craftbukkit.inventory.CraftItemStack; // Cauldron @@ -31,7 +48,7 @@ private final ItemStack[] previousEquipment = new ItemStack[5]; public boolean isSwingInProgress; public int swingProgressInt; -@@ -83,7 +97,7 @@ +@@ -83,7 +101,7 @@ public float rotationYawHead; public float prevRotationYawHead; public float jumpMovementFactor = 0.02F; @@ -40,7 +57,7 @@ protected int recentlyHit; protected boolean dead; protected int entityAge; -@@ -93,7 +107,7 @@ +@@ -93,7 +111,7 @@ protected float field_70763_ax; protected float field_70741_aB; protected int scoreValue; @@ -49,7 +66,7 @@ protected boolean isJumping; public float moveStrafing; public float moveForward; -@@ -104,21 +118,26 @@ +@@ -104,21 +122,26 @@ protected double newPosZ; protected double newRotationYaw; protected double newRotationPitch; @@ -79,7 +96,7 @@ this.preventEntitySpawning = true; this.field_70770_ap = (float)(Math.random() + 1.0D) * 0.01F; this.setPosition(this.posX, this.posY, this.posZ); -@@ -173,7 +192,18 @@ +@@ -173,7 +196,18 @@ } else if (!this.worldObj.isRemote && this.fallDistance > 3.0F) { @@ -99,7 +116,7 @@ } block.onFallenUpon(this.worldObj, i, j, k, this, this.fallDistance); -@@ -234,7 +264,12 @@ +@@ -234,7 +268,12 @@ } else { @@ -113,7 +130,7 @@ } if (this.isEntityAlive() && this.isWet()) -@@ -299,6 +334,22 @@ +@@ -299,6 +338,22 @@ this.worldObj.theProfiler.endSection(); } @@ -136,7 +153,7 @@ public boolean isChild() { return false; -@@ -308,22 +359,21 @@ +@@ -308,22 +363,21 @@ { ++this.deathTime; @@ -168,7 +185,7 @@ this.setDead(); for (i = 0; i < 20; ++i) -@@ -485,6 +535,22 @@ +@@ -485,6 +539,22 @@ } } @@ -191,7 +208,7 @@ if (p_70037_1_.hasKey("HealF", 99)) { this.setHealth(p_70037_1_.getFloat("HealF")); -@@ -614,12 +680,14 @@ +@@ -614,12 +684,14 @@ public boolean isPotionActive(int p_82165_1_) { @@ -208,7 +225,7 @@ } public PotionEffect getActivePotionEffect(Potion p_70660_1_) -@@ -710,25 +778,66 @@ +@@ -710,25 +782,66 @@ } } @@ -276,7 +293,7 @@ this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(p_70606_1_, 0.0F, this.getMaxHealth()))); } -@@ -757,7 +866,8 @@ +@@ -757,7 +870,8 @@ } else { @@ -286,7 +303,7 @@ { this.getEquipmentInSlot(4).damageItem((int)(p_70097_2_ * 4.0F + this.rand.nextFloat() * p_70097_2_ * 2.0F), this); p_70097_2_ *= 0.75F; -@@ -773,16 +883,27 @@ +@@ -773,16 +887,27 @@ return false; } @@ -317,7 +334,7 @@ this.hurtTime = this.maxHurtTime = 10; } -@@ -938,6 +1059,22 @@ +@@ -938,6 +1063,22 @@ if (!ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, recentlyHit > 0, j)) { @@ -340,7 +357,7 @@ for (EntityItem item : capturedDrops) { worldObj.spawnEntityInWorld(item); -@@ -1010,8 +1147,17 @@ +@@ -1010,8 +1151,17 @@ if (i > 0) { @@ -359,7 +376,7 @@ int j = MathHelper.floor_double(this.posX); int k = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); int l = MathHelper.floor_double(this.posZ); -@@ -1065,7 +1211,7 @@ +@@ -1065,7 +1215,7 @@ { int i = 25 - this.getTotalArmorValue(); float f1 = p_70655_2_ * (float)i; @@ -368,7 +385,7 @@ p_70655_2_ = f1 / 25.0F; } -@@ -1089,7 +1235,8 @@ +@@ -1089,7 +1239,8 @@ int j; float f1; @@ -378,7 +395,7 @@ { i = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5; j = 25 - i; -@@ -1122,26 +1269,156 @@ +@@ -1122,26 +1273,161 @@ } } @@ -514,7 +531,12 @@ + if (!damagesource.isUnblockable()) + { + float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT)); -+ this.damageArmor(armorDamage); ++ if (this instanceof EntityPlayer) { ++ EntityPlayer player = (EntityPlayer) this; ++ armorDamage = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, damagesource, armorDamage, true); ++ } else { ++ this.damageArmor(armorDamage); ++ } + } + + absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION); @@ -546,7 +568,7 @@ } public CombatTracker func_110142_aN() -@@ -1558,6 +1835,7 @@ +@@ -1558,6 +1844,7 @@ public void onUpdate() { if (ForgeHooks.onLivingUpdate(this)) return; @@ -554,7 +576,7 @@ super.onUpdate(); if (!this.worldObj.isRemote) -@@ -1608,7 +1886,9 @@ +@@ -1608,7 +1895,9 @@ } } @@ -564,7 +586,7 @@ double d0 = this.posX - this.prevPosX; double d1 = this.posZ - this.prevPosZ; float f = (float)(d0 * d0 + d1 * d1); -@@ -1621,7 +1901,8 @@ +@@ -1621,7 +1910,8 @@ { f3 = 1.0F; f2 = (float)Math.sqrt((double)f) * 3.0F; @@ -574,7 +596,7 @@ } if (this.swingProgress > 0.0F) -@@ -1682,6 +1963,7 @@ +@@ -1682,6 +1972,7 @@ this.worldObj.theProfiler.endSection(); this.field_70764_aw += f2; @@ -582,7 +604,7 @@ } protected float func_110146_f(float p_110146_1_, float p_110146_2_) -@@ -1757,6 +2039,7 @@ +@@ -1757,6 +2048,7 @@ this.motionZ = 0.0D; } @@ -590,7 +612,7 @@ this.worldObj.theProfiler.startSection("ai"); if (this.isMovementBlocked()) -@@ -1783,6 +2066,7 @@ +@@ -1783,6 +2075,7 @@ } } @@ -598,7 +620,7 @@ this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.startSection("jump"); -@@ -1811,13 +2095,17 @@ +@@ -1811,13 +2104,17 @@ this.moveStrafing *= 0.98F; this.moveForward *= 0.98F; this.randomYawVelocity *= 0.9F; @@ -616,7 +638,7 @@ } this.worldObj.theProfiler.endSection(); -@@ -1829,17 +2117,36 @@ +@@ -1829,17 +2126,36 @@ { List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); diff --git a/patches/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/net/minecraft/entity/player/EntityPlayer.java.patch index 9b3a121..279978c 100644 --- a/patches/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/net/minecraft/entity/player/EntityPlayer.java.patch @@ -383,7 +383,7 @@ this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_); } } -+ return false; ++ return true; } public void func_146101_a(TileEntityFurnace p_146101_1_) {} diff --git a/patches/net/minecraft/item/ItemStack.java.patch b/patches/net/minecraft/item/ItemStack.java.patch index 6af0bf5..484b1b9 100644 --- a/patches/net/minecraft/item/ItemStack.java.patch +++ b/patches/net/minecraft/item/ItemStack.java.patch @@ -1,10 +1,30 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -35,6 +35,20 @@ +@@ -2,14 +2,18 @@ + + import com.google.common.collect.HashMultimap; + import com.google.common.collect.Multimap; ++ ++import cpw.mods.fml.common.FMLLog; + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++ + import java.text.DecimalFormat; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import java.util.Random; + import java.util.Map.Entry; ++ + import net.minecraft.block.Block; + import net.minecraft.enchantment.Enchantment; + import net.minecraft.enchantment.EnchantmentDurability; +@@ -35,6 +39,21 @@ import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; +import org.bukkit.craftbukkit.util.CraftMagicNumbers; // CraftBukkit ++ +import net.minecraft.entity.player.EntityPlayerMP; // Spigot +// Cauldron start +import net.minecraft.block.BlockSapling; @@ -21,7 +41,7 @@ public final class ItemStack { public static final DecimalFormat field_111284_a = new DecimalFormat("#.###"); -@@ -43,7 +57,12 @@ +@@ -43,7 +62,12 @@ private Item field_151002_e; public NBTTagCompound stackTagCompound; int itemDamage; @@ -35,7 +55,7 @@ private static final String __OBFID = "CL_00000043"; private cpw.mods.fml.common.registry.RegistryDelegate delegate; -@@ -126,12 +145,14 @@ +@@ -126,12 +150,14 @@ public boolean tryPlaceItemIntoWorld(EntityPlayer p_77943_1_, World p_77943_2_, int p_77943_3_, int p_77943_4_, int p_77943_5_, int p_77943_6_, float p_77943_7_, float p_77943_8_, float p_77943_9_) { if (!p_77943_2_.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_77943_1_, p_77943_2_, p_77943_3_, p_77943_4_, p_77943_5_, p_77943_6_, p_77943_7_, p_77943_8_, p_77943_9_); @@ -51,7 +71,7 @@ return flag; } -@@ -227,8 +248,22 @@ +@@ -227,8 +253,22 @@ return getItem().getMaxDamage(this); } @@ -74,7 +94,7 @@ if (!this.isItemStackDamageable()) { return false; -@@ -250,6 +285,23 @@ +@@ -250,6 +290,23 @@ p_96631_1_ -= k; @@ -98,7 +118,16 @@ if (p_96631_1_ <= 0) { return false; -@@ -288,6 +340,12 @@ +@@ -267,7 +324,7 @@ + { + if (this.isItemStackDamageable()) + { +- if (this.attemptDamageItem(p_77972_1_, p_77972_2_.getRNG())) ++ if (this.isDamaged(p_77972_1_, p_77972_2_.getRNG(), p_77972_2_)) + { + p_77972_2_.renderBrokenItemStack(this); + --this.stackSize; +@@ -288,6 +345,12 @@ this.stackSize = 0; } @@ -111,7 +140,7 @@ this.itemDamage = 0; } } -@@ -419,6 +477,7 @@ +@@ -419,6 +482,7 @@ public void setTagCompound(NBTTagCompound p_77982_1_) {