3
0

Rollback to the state of .152 build with some critical fixes and updates

This commit is contained in:
Sergey Shatunov
2016-01-04 12:38:37 +07:00
parent 40c95e49c0
commit f722fccdce
38 changed files with 406 additions and 1452 deletions

View File

@ -80,7 +80,7 @@
private static final String __OBFID = "CL_00001533";
/** Forge: Used to store custom data for each entity. */
private NBTTagCompound customEntityData;
@@ -135,7 +175,17 @@
@@ -135,7 +175,16 @@
public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
private UUID persistentID;
@ -94,11 +94,10 @@
+ // Spigot end
protected HashMap<String, IExtendedEntityProperties> extendedProperties;
+ public String spawnReason; // Cauldron - used to handle CraftBukkit's SpawnReason with CustomSpawners
+ public boolean markedForRemoval = false;
public int getEntityId()
{
@@ -159,7 +209,7 @@
@@ -159,7 +208,7 @@
this.rand = new Random();
this.fireResistance = 1;
this.firstUpdate = true;
@ -107,7 +106,7 @@
this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
this.worldObj = p_i1582_1_;
this.setPosition(0.0D, 0.0D, 0.0D);
@@ -167,8 +217,15 @@
@@ -167,8 +216,15 @@
if (p_i1582_1_ != null)
{
this.dimension = p_i1582_1_.provider.dimensionId;
@ -123,7 +122,7 @@
this.dataWatcher = new DataWatcher(this);
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
this.dataWatcher.addObject(1, Short.valueOf((short)300));
@@ -277,6 +334,41 @@
@@ -277,6 +333,41 @@
protected void setRotation(float p_70101_1_, float p_70101_2_)
{
@ -165,7 +164,7 @@
this.rotationYaw = p_70101_1_ % 360.0F;
this.rotationPitch = p_70101_2_ % 360.0F;
}
@@ -343,7 +435,7 @@
@@ -343,7 +434,7 @@
if (this.inPortal)
{
@ -174,7 +173,7 @@
{
if (this.ridingEntity == null && this.portalCounter++ >= i)
{
@@ -457,7 +549,35 @@
@@ -457,7 +548,35 @@
{
if (!this.isImmuneToFire)
{
@ -211,7 +210,7 @@
this.setFire(15);
}
}
@@ -492,6 +612,30 @@
@@ -492,6 +611,30 @@
public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_)
{
@ -242,7 +241,7 @@
if (this.noClip)
{
this.boundingBox.offset(p_70091_1_, p_70091_3_, p_70091_5_);
@@ -756,6 +900,34 @@
@@ -756,6 +899,34 @@
d10 = this.posY - d4;
d11 = this.posZ - d5;
@ -277,7 +276,7 @@
if (this.canTriggerWalking() && !flag && this.ridingEntity == null)
{
int j1 = MathHelper.floor_double(this.posX);
@@ -798,6 +970,8 @@
@@ -798,6 +969,8 @@
}
}
@ -286,7 +285,7 @@
try
{
this.func_145775_I();
@@ -809,7 +983,8 @@
@@ -809,7 +982,8 @@
this.addEntityCrashInfo(crashreportcategory);
throw new ReportedException(crashreport);
}
@ -296,7 +295,7 @@
boolean flag2 = this.isWet();
if (this.worldObj.func_147470_e(this.boundingBox.contract(0.001D, 0.001D, 0.001D)))
@@ -820,8 +995,20 @@
@@ -820,8 +994,20 @@
{
++this.fire;
@ -318,7 +317,7 @@
this.setFire(8);
}
}
@@ -839,6 +1026,8 @@
@@ -839,6 +1025,8 @@
this.worldObj.theProfiler.endSection();
}
@ -327,7 +326,7 @@
}
protected String getSwimSound()
@@ -867,7 +1056,18 @@
@@ -867,7 +1055,18 @@
try
{
@ -347,7 +346,7 @@
}
catch (Throwable throwable)
{
@@ -928,6 +1128,7 @@
@@ -928,6 +1127,7 @@
return null;
}
@ -355,7 +354,7 @@
protected void dealFireDamage(int p_70081_1_)
{
if (!this.isImmuneToFire)
@@ -935,7 +1136,16 @@
@@ -935,7 +1135,16 @@
this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
}
}
@ -372,7 +371,7 @@
public final boolean isImmuneToFire()
{
return this.isImmuneToFire;
@@ -1184,6 +1394,8 @@
@@ -1184,6 +1393,8 @@
public void onCollideWithPlayer(EntityPlayer p_70100_1_) {}
@ -381,7 +380,7 @@
public void applyEntityCollision(Entity p_70108_1_)
{
if (p_70108_1_.riddenByEntity != this && p_70108_1_.ridingEntity != this)
@@ -1310,6 +1522,20 @@
@@ -1310,6 +1521,20 @@
{
p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
@ -402,7 +401,7 @@
p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
p_70109_1_.setFloat("FallDistance", this.fallDistance);
p_70109_1_.setShort("Fire", (short)this.fire);
@@ -1320,6 +1546,12 @@
@@ -1320,6 +1545,12 @@
p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
@ -415,7 +414,7 @@
if (customEntityData != null)
{
p_70109_1_.setTag("ForgeData", customEntityData);
@@ -1370,7 +1602,7 @@
@@ -1370,7 +1601,7 @@
this.motionX = nbttaglist1.func_150309_d(0);
this.motionY = nbttaglist1.func_150309_d(1);
this.motionZ = nbttaglist1.func_150309_d(2);
@ -424,7 +423,7 @@
if (Math.abs(this.motionX) > 10.0D)
{
this.motionX = 0.0D;
@@ -1385,7 +1617,7 @@
@@ -1385,7 +1616,7 @@
{
this.motionZ = 0.0D;
}
@ -433,7 +432,7 @@
this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.func_150309_d(0);
this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.func_150309_d(1);
this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.func_150309_d(2);
@@ -1436,6 +1668,76 @@
@@ -1436,6 +1667,76 @@
{
this.setPosition(this.posX, this.posY, this.posZ);
}
@ -510,7 +509,7 @@
}
catch (Throwable throwable)
{
@@ -1653,6 +1955,31 @@
@@ -1653,6 +1954,31 @@
public void mountEntity(Entity p_70078_1_)
{
@ -542,7 +541,7 @@
this.entityRiderPitchDelta = 0.0D;
this.entityRiderYawDelta = 0.0D;
@@ -1660,6 +1987,20 @@
@@ -1660,6 +1986,20 @@
{
if (this.ridingEntity != null)
{
@ -563,7 +562,7 @@
this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch);
this.ridingEntity.riddenByEntity = null;
}
@@ -1668,22 +2009,61 @@
@@ -1668,22 +2008,61 @@
}
else
{
@ -632,7 +631,7 @@
this.ridingEntity = p_70078_1_;
p_70078_1_.riddenByEntity = this;
}
@@ -1860,12 +2240,59 @@
@@ -1860,12 +2239,59 @@
public void onStruckByLightning(EntityLightningBolt p_70077_1_)
{
@ -694,7 +693,7 @@
}
}
@@ -2038,36 +2465,62 @@
@@ -2038,36 +2464,62 @@
{
this.worldObj.theProfiler.startSection("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer();
@ -773,7 +772,7 @@
}
this.isDead = true;
@@ -2077,7 +2530,6 @@
@@ -2077,7 +2529,6 @@
this.worldObj.theProfiler.endSection();
}
}
@ -781,7 +780,7 @@
public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_)
{
return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_4_, p_145772_5_, posX, posY + getEyeHeight(), posZ);
@@ -2474,4 +2926,14 @@
@@ -2474,4 +2925,14 @@
}
}
}

View File

@ -1,9 +1,7 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java
@@ -1,13 +1,16 @@
package net.minecraft.entity;
@@ -2,12 +2,14 @@
+import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
@ -17,7 +15,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -50,14 +53,30 @@
@@ -50,14 +52,30 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ForgeHooks;
@ -50,7 +48,7 @@
private final ItemStack[] previousEquipment = new ItemStack[5];
public boolean isSwingInProgress;
public int swingProgressInt;
@@ -83,7 +102,7 @@
@@ -83,7 +101,7 @@
public float rotationYawHead;
public float prevRotationYawHead;
public float jumpMovementFactor = 0.02F;
@ -59,7 +57,7 @@
protected int recentlyHit;
protected boolean dead;
protected int entityAge;
@@ -93,7 +112,7 @@
@@ -93,7 +111,7 @@
protected float field_70763_ax;
protected float field_70741_aB;
protected int scoreValue;
@ -68,7 +66,7 @@
protected boolean isJumping;
public float moveStrafing;
public float moveForward;
@@ -104,21 +123,26 @@
@@ -104,21 +122,26 @@
protected double newPosZ;
protected double newRotationYaw;
protected double newRotationPitch;
@ -98,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 +197,18 @@
@@ -173,7 +196,18 @@
}
else if (!this.worldObj.isRemote && this.fallDistance > 3.0F)
{
@ -118,7 +116,7 @@
}
block.onFallenUpon(this.worldObj, i, j, k, this, this.fallDistance);
@@ -234,7 +269,12 @@
@@ -234,7 +268,12 @@
}
else
{
@ -132,7 +130,7 @@
}
if (this.isEntityAlive() && this.isWet())
@@ -299,6 +339,22 @@
@@ -299,6 +338,22 @@
this.worldObj.theProfiler.endSection();
}
@ -155,7 +153,7 @@
public boolean isChild()
{
return false;
@@ -308,22 +364,21 @@
@@ -308,22 +363,21 @@
{
++this.deathTime;
@ -187,7 +185,7 @@
this.setDead();
for (i = 0; i < 20; ++i)
@@ -485,6 +540,22 @@
@@ -485,6 +539,22 @@
}
}
@ -210,7 +208,7 @@
if (p_70037_1_.hasKey("HealF", 99))
{
this.setHealth(p_70037_1_.getFloat("HealF"));
@@ -614,12 +685,14 @@
@@ -614,12 +684,14 @@
public boolean isPotionActive(int p_82165_1_)
{
@ -227,7 +225,7 @@
}
public PotionEffect getActivePotionEffect(Potion p_70660_1_)
@@ -710,25 +783,66 @@
@@ -710,25 +782,66 @@
}
}
@ -295,7 +293,7 @@
this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(p_70606_1_, 0.0F, this.getMaxHealth())));
}
@@ -757,7 +871,8 @@
@@ -757,7 +870,8 @@
}
else
{
@ -305,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 +888,27 @@
@@ -773,16 +887,27 @@
return false;
}
@ -336,7 +334,7 @@
this.hurtTime = this.maxHurtTime = 10;
}
@@ -938,6 +1064,22 @@
@@ -938,6 +1063,22 @@
if (!ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, recentlyHit > 0, j))
{
@ -359,7 +357,7 @@
for (EntityItem item : capturedDrops)
{
worldObj.spawnEntityInWorld(item);
@@ -1010,8 +1152,17 @@
@@ -1010,8 +1151,17 @@
if (i > 0)
{
@ -378,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 +1216,7 @@
@@ -1065,7 +1215,7 @@
{
int i = 25 - this.getTotalArmorValue();
float f1 = p_70655_2_ * (float)i;
@ -387,7 +385,7 @@
p_70655_2_ = f1 / 25.0F;
}
@@ -1089,7 +1240,8 @@
@@ -1089,7 +1239,8 @@
int j;
float f1;
@ -397,7 +395,7 @@
{
i = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5;
j = 25 - i;
@@ -1122,26 +1274,160 @@
@@ -1122,26 +1273,161 @@
}
}
@ -422,6 +420,7 @@
- p_70665_2_ = Math.max(p_70665_2_ - this.getAbsorptionAmount(), 0.0F);
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - p_70665_2_));
+ final boolean human = this instanceof EntityPlayer;
+ float originalDamage = f;
+ // Cauldron start - apply forge damage hook
+ f = ForgeHooks.onLivingHurt(this, damagesource, f);
+ if (f <= 0) return true;
@ -513,7 +512,7 @@
+ };
+ float absorptionModifier = absorption.apply((double) f).floatValue();
+
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, f, hardHatModifier, blockingModifier,
+ EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier,
+ armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
+ if (event.isCancelled())
{

View File

@ -14,15 +14,6 @@
this.func_146065_b(p_70097_1_.getEntity(), false);
this.setDisplayedItem((ItemStack)null);
}
@@ -115,7 +122,7 @@
if (p_110131_1_.getItem() == Items.filled_map)
{
MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj);
- mapdata.playersVisibleOnMap.remove("frame-" + this.getEntityId());
+ mapdata.playersVisibleOnMap.remove(java.util.UUID.nameUUIDFromBytes(("frame-" + this.getEntityId()).getBytes(org.apache.commons.codec.Charsets.US_ASCII)));
}
p_110131_1_.setItemFrame((EntityItemFrame)null);
@@ -203,4 +210,11 @@
return true;

View File

@ -62,24 +62,6 @@
public int experienceLevel;
public int experienceTotal;
public float experience;
@@ -254,7 +281,7 @@
--this.xpCooldown;
}
- if (this.isPlayerSleeping())
+ /*if (this.isPlayerSleeping()) KCauldron - moved into EntityPlayerMP
{
++this.sleepTimer;
@@ -283,7 +310,7 @@
{
this.sleepTimer = 0;
}
- }
+ }*/
super.onUpdate();
@@ -416,6 +443,42 @@
{
this.updateItemUse(this.itemInUse, 16);
@ -503,15 +485,6 @@
if (p_70999_1_)
{
this.sleepTimer = 0;
@@ -1491,7 +1712,7 @@
}
}
- private boolean isInBed()
+ protected boolean isInBed() // KCauldron - private -> protected
{
return this.worldObj.getBlock(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ).isBed(worldObj, playerLocation.posX, playerLocation.posY, playerLocation.posZ, this);
}
@@ -1606,11 +1827,13 @@
{
this.spawnChunk = new ChunkCoordinates(p_71063_1_);

View File

@ -190,46 +190,7 @@
iterator1.remove();
}
}
@@ -286,6 +384,38 @@
}
}
}
+ // KCauldron start
+ if (this.isPlayerSleeping())
+ {
+ ++this.sleepTimer;
+
+ if (this.sleepTimer > 100)
+ {
+ this.sleepTimer = 100;
+ }
+
+ if (!this.worldObj.isRemote)
+ {
+ if (!this.isInBed())
+ {
+ this.wakeUpPlayer(true, true, false);
+ }
+ else if (this.worldObj.isDaytime())
+ {
+ this.wakeUpPlayer(false, true, true);
+ }
+ }
+ }
+ else if (this.sleepTimer > 0)
+ {
+ ++this.sleepTimer;
+
+ if (this.sleepTimer >= 110)
+ {
+ this.sleepTimer = 0;
+ }
+ }
+ // KCauldron end
}
public void onUpdateEntity()
@@ -309,9 +439,10 @@
@@ -309,9 +407,10 @@
}
}
@ -241,7 +202,7 @@
this.lastHealth = this.getHealth();
this.lastFoodLevel = this.foodStats.getFoodLevel();
this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
@@ -320,16 +451,18 @@
@@ -320,16 +419,18 @@
if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO)
{
this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
@ -267,7 +228,7 @@
if (this.experienceTotal != this.lastExperience)
{
this.lastExperience = this.experienceTotal;
@@ -340,6 +473,20 @@
@@ -340,6 +441,20 @@
{
this.func_147098_j();
}
@ -288,7 +249,7 @@
}
catch (Throwable throwable)
{
@@ -402,34 +549,74 @@
@@ -402,34 +517,74 @@
public void onDeath(DamageSource p_70645_1_)
{
@ -372,7 +333,7 @@
score.func_96648_a();
}
@@ -495,7 +682,8 @@
@@ -495,7 +650,8 @@
public boolean canAttackPlayer(EntityPlayer p_96122_1_)
{
@ -382,7 +343,7 @@
}
public void travelToDimension(int p_71027_1_)
@@ -526,7 +714,10 @@
@@ -526,7 +682,10 @@
this.triggerAchievement(AchievementList.portal);
}
@ -394,7 +355,7 @@
this.lastExperience = -1;
this.lastHealth = -1.0F;
this.lastFoodLevel = -1;
@@ -569,6 +760,11 @@
@@ -569,6 +728,11 @@
public void wakeUpPlayer(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_)
{
@ -406,7 +367,7 @@
if (this.isPlayerSleeping())
{
this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2));
@@ -584,11 +780,27 @@
@@ -584,11 +748,27 @@
public void mountEntity(Entity p_70078_1_)
{
@ -437,7 +398,7 @@
protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {}
public void handleFalling(double p_71122_1_, boolean p_71122_3_)
@@ -610,29 +822,64 @@
@@ -610,29 +790,64 @@
this.currentWindowId = this.currentWindowId % 100 + 1;
}
@ -505,7 +466,7 @@
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
@@ -644,71 +891,150 @@
@@ -644,71 +859,150 @@
this.closeScreen();
}
@ -664,7 +625,7 @@
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant)this.openContainer).getMerchantInventory();
@@ -725,7 +1051,7 @@
@@ -725,7 +1019,7 @@
merchantrecipelist.func_151391_a(packetbuffer);
this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer));
}
@ -673,7 +634,7 @@
{
logger.error("Couldn\'t send trade list", ioexception);
}
@@ -738,6 +1064,17 @@
@@ -738,6 +1032,17 @@
public void displayGUIHorse(EntityHorse p_110298_1_, IInventory p_110298_2_)
{
@ -691,7 +652,7 @@
if (this.openContainer != this.inventoryContainer)
{
this.closeScreen();
@@ -745,7 +1082,7 @@
@@ -745,7 +1050,7 @@
this.getNextWindowId();
this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 11, p_110298_2_.getInventoryName(), p_110298_2_.getSizeInventory(), p_110298_2_.hasCustomInventoryName(), p_110298_1_.getEntityId()));
@ -700,7 +661,7 @@
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addCraftingToCrafters(this);
}
@@ -770,6 +1107,15 @@
@@ -770,6 +1075,15 @@
{
this.playerNetServerHandler.sendPacket(new S30PacketWindowItems(p_71110_1_.windowId, p_71110_2_));
this.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(-1, -1, this.inventory.getItemStack()));
@ -716,7 +677,7 @@
}
public void sendProgressBarUpdate(Container p_71112_1_, int p_71112_2_, int p_71112_3_)
@@ -779,6 +1125,7 @@
@@ -779,6 +1093,7 @@
public void closeScreen()
{
@ -724,7 +685,7 @@
this.playerNetServerHandler.sendPacket(new S2EPacketCloseWindow(this.openContainer.windowId));
this.closeContainer();
}
@@ -853,8 +1200,19 @@
@@ -853,8 +1168,19 @@
public void setPlayerHealthUpdated()
{
this.lastHealth = -1.0E8F;
@ -744,7 +705,7 @@
public void addChatComponentMessage(IChatComponent p_146105_1_)
{
this.playerNetServerHandler.sendPacket(new S02PacketChat(p_146105_1_));
@@ -1037,6 +1395,114 @@
@@ -1037,6 +1363,114 @@
return this.field_143005_bX;
}