More entity patch work. ISpecialArmor deleted.
This commit is contained in:
parent
7a77298a60
commit
7265900c62
54 changed files with 1066 additions and 1911 deletions
|
@ -8,3 +8,24 @@
|
|||
field_209347_a.put(p_209346_0_, new EntitySpawnPlacementRegistry.Entry(p_209346_2_, p_209346_1_, p_209346_3_));
|
||||
}
|
||||
|
||||
@@ -109,5 +110,20 @@
|
||||
public static enum SpawnPlacementType {
|
||||
ON_GROUND,
|
||||
IN_WATER;
|
||||
+
|
||||
+ public static SpawnPlacementType create(String name, net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReaderBase, net.minecraft.util.math.BlockPos, EntityType<? extends EntityLiving>> predicate) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ private net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReaderBase, net.minecraft.util.math.BlockPos, EntityType<? extends EntityLiving>> predicate;
|
||||
+ private SpawnPlacementType() { this(null); }
|
||||
+ private SpawnPlacementType(net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReaderBase, net.minecraft.util.math.BlockPos, EntityType<? extends EntityLiving>> predicate) {
|
||||
+ this.predicate = predicate;
|
||||
+ }
|
||||
+
|
||||
+ public boolean canSpawnAt(net.minecraft.world.IWorldReaderBase world, net.minecraft.util.math.BlockPos pos, EntityType<? extends EntityLiving> type) {
|
||||
+ if (predicate == null) return net.minecraft.world.WorldEntitySpawner.canSpawnAtBody(this, world, pos, type);
|
||||
+ return predicate.test(world, pos, type);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
--- a/net/minecraft/entity/passive/EntityMooshroom.java
|
||||
+++ b/net/minecraft/entity/passive/EntityMooshroom.java
|
||||
@@ -15,7 +15,7 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
-public class EntityMooshroom extends EntityCow {
|
||||
+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable {
|
||||
public EntityMooshroom(World p_i1687_1_) {
|
||||
super(EntityType.field_200780_T, p_i1687_1_);
|
||||
this.func_70105_a(0.9F, 1.4F);
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
- } else if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) {
|
||||
+ } else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) { //Forge: Moved to onSheared
|
||||
this.func_70106_y();
|
||||
this.field_70170_p.func_195594_a(Particles.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D);
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
@@ -69,4 +69,31 @@
|
||||
protected ResourceLocation func_184647_J() {
|
||||
return LootTableList.field_186400_H;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, net.minecraft.util.math.BlockPos pos) {
|
||||
+ return this.func_70874_b() >= 0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, net.minecraft.util.math.BlockPos pos, int fortune) {
|
||||
+ java.util.List<ItemStack> ret = new java.util.ArrayList<>();
|
||||
+ this.func_70106_y();
|
||||
+ this.field_70170_p.func_195594_a(Particles.field_197627_t, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D);
|
||||
+ if (!this.field_70170_p.field_72995_K) {
|
||||
+ EntityCow entitycow = new EntityCow(this.field_70170_p);
|
||||
+ entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A);
|
||||
+ entitycow.func_70606_j(this.func_110143_aJ());
|
||||
+ entitycow.field_70761_aq = this.field_70761_aq;
|
||||
+ if (this.func_145818_k_()) {
|
||||
+ entitycow.func_200203_b(this.func_200201_e());
|
||||
+ }
|
||||
+ this.field_70170_p.func_72838_d(entitycow);
|
||||
+ for(int i = 0; i < 5; ++i) {
|
||||
+ ret.add(new ItemStack(Blocks.field_150337_Q));
|
||||
+ }
|
||||
+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F);
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/passive/EntityOcelot.java
|
||||
+++ b/net/minecraft/entity/passive/EntityOcelot.java
|
||||
@@ -181,7 +181,7 @@
|
||||
}
|
||||
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
- if (this.field_70146_Z.nextInt(3) == 0) {
|
||||
+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) {
|
||||
this.func_193101_c(p_184645_1_);
|
||||
this.func_70912_b(1 + this.field_70170_p.field_73012_v.nextInt(3));
|
||||
this.func_70908_e(true);
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/passive/EntityParrot.java
|
||||
+++ b/net/minecraft/entity/passive/EntityParrot.java
|
||||
@@ -219,7 +219,7 @@
|
||||
}
|
||||
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
- if (this.field_70146_Z.nextInt(10) == 0) {
|
||||
+ if (this.field_70146_Z.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_)) {
|
||||
this.func_193101_c(p_184645_1_);
|
||||
this.func_70908_e(true);
|
||||
this.field_70170_p.func_72960_a(this, (byte)7);
|
|
@ -0,0 +1,44 @@
|
|||
--- a/net/minecraft/entity/passive/EntitySheep.java
|
||||
+++ b/net/minecraft/entity/passive/EntitySheep.java
|
||||
@@ -50,7 +50,7 @@
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
-public class EntitySheep extends EntityAnimal {
|
||||
+public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable {
|
||||
private static final DataParameter<Byte> field_184774_bv = EntityDataManager.<Byte>func_187226_a(EntitySheep.class, DataSerializers.field_187191_a);
|
||||
private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() {
|
||||
public boolean func_75145_c(EntityPlayer p_75145_1_) {
|
||||
@@ -214,7 +214,7 @@
|
||||
|
||||
public boolean func_184645_a(EntityPlayer p_184645_1_, EnumHand p_184645_2_) {
|
||||
ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_);
|
||||
- if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) {
|
||||
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) { //Forge: Moved to onSheared
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
this.func_70893_e(true);
|
||||
int i = 1 + this.field_70146_Z.nextInt(3);
|
||||
@@ -344,4 +344,23 @@
|
||||
public float func_70047_e() {
|
||||
return 0.95F * this.field_70131_O;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
|
||||
+ return !this.func_70631_g_();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
|
||||
+ java.util.List<ItemStack> ret = new java.util.ArrayList<>();
|
||||
+ if (!this.field_70170_p.field_72995_K) {
|
||||
+ this.func_70893_e(true);
|
||||
+ int i = 1 + this.field_70146_Z.nextInt(3);
|
||||
+
|
||||
+ for(int j = 0; j < i; ++j) {
|
||||
+ ret.add(new ItemStack(field_200206_bz.get(this.func_175509_cj())));
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
|
@ -94,6 +94,24 @@
|
|||
public boolean func_70941_o() {
|
||||
return this.field_70952_f;
|
||||
}
|
||||
@@ -350,7 +389,7 @@
|
||||
i = -3;
|
||||
}
|
||||
|
||||
- this.field_70954_d.func_82688_a(((EntityPlayer)p_70604_1_).func_146103_bH().getName(), i);
|
||||
+ this.field_70954_d.modifyPlayerReputation(((EntityPlayer)p_70604_1_).func_146103_bH().getId(), i);
|
||||
if (this.func_70089_S()) {
|
||||
this.field_70170_p.func_72960_a(this, (byte)13);
|
||||
}
|
||||
@@ -364,7 +403,7 @@
|
||||
Entity entity = p_70645_1_.func_76346_g();
|
||||
if (entity != null) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
- this.field_70954_d.func_82688_a(((EntityPlayer)entity).func_146103_bH().getName(), -2);
|
||||
+ this.field_70954_d.modifyPlayerReputation(((EntityPlayer)entity).func_146103_bH().getId(), -2);
|
||||
} else if (entity instanceof IMob) {
|
||||
this.field_70954_d.func_82692_h();
|
||||
}
|
||||
@@ -433,7 +472,7 @@
|
||||
this.field_70959_by = true;
|
||||
this.field_175565_bs = true;
|
||||
|
@ -165,14 +183,14 @@
|
|||
}
|
||||
|
||||
this.func_175552_ct();
|
||||
@@ -817,6 +847,10 @@
|
||||
p_190888_2_.add(new MerchantRecipe(itemstack, itemstack1));
|
||||
@@ -818,6 +848,10 @@
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ //MODDERS DO NOT USE OR EDIT THIS IN ANY WAY IT WILL HAVE NO EFFECT, THIS IS JUST IN HERE TO ALLOW FORGE TO ACCESS IT
|
||||
+ @Deprecated
|
||||
+ public static ITradeList[][][][] GET_TRADES_DONT_USE(){ return field_175561_bA; }
|
||||
|
||||
+
|
||||
public static class ListItemForEmeralds implements EntityVillager.ITradeList {
|
||||
public ItemStack field_179403_a;
|
||||
public EntityVillager.PriceInfo field_179402_b;
|
||||
|
|
|
@ -1,15 +1,29 @@
|
|||
--- a/net/minecraft/entity/player/EntityPlayer.java
|
||||
+++ b/net/minecraft/entity/player/EntityPlayer.java
|
||||
@@ -97,6 +97,8 @@
|
||||
@@ -97,6 +97,11 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class EntityPlayer extends EntityLivingBase {
|
||||
+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted";
|
||||
+ protected java.util.HashMap<Integer, BlockPos> spawnPosMap = new java.util.HashMap<Integer, BlockPos>();
|
||||
+ protected java.util.HashMap<Integer, Boolean> spawnForcedMap = new java.util.HashMap<Integer, Boolean>();
|
||||
+ public static final net.minecraft.entity.ai.attributes.IAttribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "generic.reachDistance", 5.0D, 0.0D, 1024.0D).func_111112_a(true);
|
||||
+
|
||||
private static final DataParameter<Float> field_184829_a = EntityDataManager.<Float>func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c);
|
||||
private static final DataParameter<Integer> field_184830_b = EntityDataManager.<Integer>func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b);
|
||||
protected static final DataParameter<Byte> field_184827_bp = EntityDataManager.<Byte>func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a);
|
||||
@@ -161,6 +163,7 @@
|
||||
@@ -143,6 +148,10 @@
|
||||
private final CooldownTracker field_184832_bU = this.func_184815_l();
|
||||
@Nullable
|
||||
public EntityFishHook field_71104_cf;
|
||||
+ private float eyeHeight = this.getDefaultEyeHeight();
|
||||
+ private int spawnDimension = 0;
|
||||
+ private final java.util.Collection<ITextComponent> prefixes = new java.util.LinkedList<ITextComponent>();
|
||||
+ private final java.util.Collection<ITextComponent> suffixes = new java.util.LinkedList<ITextComponent>();
|
||||
|
||||
public EntityPlayer(World p_i45324_1_, GameProfile p_i45324_2_) {
|
||||
super(EntityType.field_200729_aH, p_i45324_1_);
|
||||
@@ -161,6 +170,7 @@
|
||||
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.1F);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188790_f);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188792_h);
|
||||
|
@ -17,7 +31,16 @@
|
|||
}
|
||||
|
||||
protected void func_70088_a() {
|
||||
@@ -433,7 +436,7 @@
|
||||
@@ -192,7 +202,7 @@
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
if (!this.func_175143_p()) {
|
||||
this.func_70999_a(true, true, false);
|
||||
- } else if (this.field_70170_p.func_72935_r()) {
|
||||
+ } else if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, this.field_71081_bT)) {
|
||||
this.func_70999_a(false, true, true);
|
||||
}
|
||||
}
|
||||
@@ -433,10 +443,10 @@
|
||||
this.field_71107_bF = this.field_71109_bG;
|
||||
this.field_71109_bG = 0.0F;
|
||||
this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2);
|
||||
|
@ -25,8 +48,57 @@
|
|||
+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_184187_bx()).shouldRiderFaceForward(this)) {
|
||||
this.field_70125_A = f1;
|
||||
this.field_70177_z = f;
|
||||
this.field_70761_aq = ((EntityPig)this.func_184187_bx()).field_70761_aq;
|
||||
@@ -663,7 +666,12 @@
|
||||
- this.field_70761_aq = ((EntityPig)this.func_184187_bx()).field_70761_aq;
|
||||
+ this.field_70761_aq = ((EntityLivingBase)this.func_184187_bx()).field_70761_aq;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -555,10 +565,12 @@
|
||||
}
|
||||
|
||||
public void func_70645_a(DamageSource p_70645_1_) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
|
||||
super.func_70645_a(p_70645_1_);
|
||||
this.func_70105_a(0.2F, 0.2F);
|
||||
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
||||
this.field_70181_x = (double)0.1F;
|
||||
+ captureDrops(new java.util.ArrayList<>());
|
||||
if ("Notch".equals(this.func_200200_C_().getString())) {
|
||||
this.func_146097_a(new ItemStack(Items.field_151034_e), true, false);
|
||||
}
|
||||
@@ -568,6 +580,8 @@
|
||||
this.field_71071_by.func_70436_m();
|
||||
}
|
||||
|
||||
+ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, captureDrops(null), field_70718_bc > 0);
|
||||
+
|
||||
if (p_70645_1_ != null) {
|
||||
this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * ((float)Math.PI / 180F)) * 0.1F);
|
||||
this.field_70179_y = (double)(-MathHelper.func_76126_a((this.field_70739_aP + this.field_70177_z) * ((float)Math.PI / 180F)) * 0.1F);
|
||||
@@ -607,12 +621,14 @@
|
||||
|
||||
@Nullable
|
||||
public EntityItem func_71040_bB(boolean p_71040_1_) {
|
||||
- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), false, true);
|
||||
+ ItemStack stack = field_71071_by.func_70448_g();
|
||||
+ if (stack.func_190926_b() || !stack.onDroppedByPlayer(this)) return null;
|
||||
+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityItem func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) {
|
||||
- return this.func_146097_a(p_71019_1_, false, p_71019_2_);
|
||||
+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -659,11 +675,18 @@
|
||||
}
|
||||
|
||||
public ItemStack func_184816_a(EntityItem p_184816_1_) {
|
||||
+ if (captureDrops() != null) captureDrops().add(p_184816_1_);
|
||||
+ else
|
||||
this.field_70170_p.func_72838_d(p_184816_1_);
|
||||
return p_184816_1_.func_92059_d();
|
||||
}
|
||||
|
||||
|
@ -39,7 +111,7 @@
|
|||
float f = this.field_71071_by.func_184438_a(p_184813_1_);
|
||||
if (f > 1.0F) {
|
||||
int i = EnchantmentHelper.func_185293_e(this);
|
||||
@@ -705,6 +713,7 @@
|
||||
@@ -705,11 +728,12 @@
|
||||
f /= 5.0F;
|
||||
}
|
||||
|
||||
|
@ -47,7 +119,55 @@
|
|||
return f;
|
||||
}
|
||||
|
||||
@@ -823,7 +832,7 @@
|
||||
public boolean func_184823_b(IBlockState p_184823_1_) {
|
||||
- return p_184823_1_.func_185904_a().func_76229_l() || this.field_71071_by.func_184432_b(p_184823_1_);
|
||||
+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, p_184823_1_.func_185904_a().func_76229_l() || this.field_71071_by.func_184432_b(p_184823_1_));
|
||||
}
|
||||
|
||||
public void func_70037_a(NBTTagCompound p_70037_1_) {
|
||||
@@ -739,6 +763,14 @@
|
||||
this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced");
|
||||
}
|
||||
|
||||
+ p_70037_1_.func_150295_c("Spawns", 10).forEach(e -> {
|
||||
+ NBTTagCompound data = (NBTTagCompound)e;
|
||||
+ int dim = data.func_74762_e("Dim");
|
||||
+ this.spawnPosMap.put(dim, new BlockPos(data.func_74762_e("SpawnX"), data.func_74762_e("SpawnY"), data.func_74762_e("SpawnZ")));
|
||||
+ this.spawnForcedMap.put(dim, data.func_74767_n("DpawnForced"));
|
||||
+ });
|
||||
+ this.spawnDimension = p_70037_1_.func_150297_b("SpawnDimension", 99) ? p_70037_1_.func_74762_e("SpawnDimension") : 0;
|
||||
+
|
||||
this.field_71100_bB.func_75112_a(p_70037_1_);
|
||||
this.field_71075_bZ.func_75095_b(p_70037_1_);
|
||||
if (p_70037_1_.func_150297_b("EnderItems", 9)) {
|
||||
@@ -785,9 +817,26 @@
|
||||
p_70014_1_.func_74782_a("ShoulderEntityRight", this.func_192025_dl());
|
||||
}
|
||||
|
||||
+ NBTTagList spawnlist = new NBTTagList();
|
||||
+ spawnPosMap.forEach((dim, pos) -> {
|
||||
+ if (pos != null) {
|
||||
+ NBTTagCompound data = new NBTTagCompound();
|
||||
+ data.func_74768_a("Dim", dim);
|
||||
+ data.func_74768_a("SpawnX", pos.func_177958_n());
|
||||
+ data.func_74768_a("SpawnY", pos.func_177956_o());
|
||||
+ data.func_74768_a("SpawnZ", pos.func_177952_p());
|
||||
+ data.func_74757_a("SpawnForced", spawnForcedMap.getOrDefault(dim, false));
|
||||
+ spawnlist.add(data);
|
||||
+ }
|
||||
+ });
|
||||
+ p_70014_1_.func_74782_a("Spawns", spawnlist);
|
||||
+ if (spawnDimension != 0) {
|
||||
+ p_70014_1_.func_74768_a("SpawnDimension", spawnDimension);
|
||||
+ }
|
||||
}
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_)) return false;
|
||||
if (this.func_180431_b(p_70097_1_)) {
|
||||
return false;
|
||||
} else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) {
|
||||
@@ -823,7 +872,7 @@
|
||||
|
||||
protected void func_190629_c(EntityLivingBase p_190629_1_) {
|
||||
super.func_190629_c(p_190629_1_);
|
||||
|
@ -56,12 +176,342 @@
|
|||
this.func_190777_m(true);
|
||||
}
|
||||
|
||||
@@ -844,7 +853,7 @@
|
||||
@@ -844,11 +893,13 @@
|
||||
}
|
||||
|
||||
protected void func_184590_k(float p_184590_1_) {
|
||||
- if (p_184590_1_ >= 3.0F && this.field_184627_bm.func_77973_b() == Items.field_185159_cQ) {
|
||||
+ if (p_184590_1_ >= 3.0F && this.field_184627_bm.isShield(this)) {
|
||||
+ ItemStack copy = this.field_184627_bm.func_77946_l();
|
||||
int i = 1 + MathHelper.func_76141_d(p_184590_1_);
|
||||
this.field_184627_bm.func_77972_a(i, this);
|
||||
if (this.field_184627_bm.func_190926_b()) {
|
||||
EnumHand enumhand = this.func_184600_cs();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, enumhand);
|
||||
if (enumhand == EnumHand.MAIN_HAND) {
|
||||
this.func_184201_a(EntityEquipmentSlot.MAINHAND, ItemStack.field_190927_a);
|
||||
} else {
|
||||
@@ -876,11 +927,14 @@
|
||||
|
||||
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
|
||||
if (!this.func_180431_b(p_70665_1_)) {
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
|
||||
+ if (p_70665_2_ <= 0) return;
|
||||
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
|
||||
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
|
||||
float f = p_70665_2_;
|
||||
p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
|
||||
this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_));
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_);
|
||||
if (p_70665_2_ != 0.0F) {
|
||||
this.func_71020_j(p_70665_1_.func_76345_d());
|
||||
float f1 = this.func_110143_aJ();
|
||||
@@ -929,6 +983,8 @@
|
||||
|
||||
return EnumActionResult.PASS;
|
||||
} else {
|
||||
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_190775_1_, p_190775_2_);
|
||||
+ if (cancelResult != null) return cancelResult;
|
||||
ItemStack itemstack = this.func_184586_b(p_190775_2_);
|
||||
ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l();
|
||||
if (p_190775_1_.func_184230_a(this, p_190775_2_)) {
|
||||
@@ -936,6 +992,10 @@
|
||||
itemstack.func_190920_e(itemstack1.func_190916_E());
|
||||
}
|
||||
|
||||
+ if (!this.field_71075_bZ.field_75098_d && itemstack.func_190926_b()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_);
|
||||
+ }
|
||||
+
|
||||
return EnumActionResult.SUCCESS;
|
||||
} else {
|
||||
if (!itemstack.func_190926_b() && p_190775_1_ instanceof EntityLivingBase) {
|
||||
@@ -945,6 +1005,7 @@
|
||||
|
||||
if (itemstack.func_111282_a(this, (EntityLivingBase)p_190775_1_, p_190775_2_)) {
|
||||
if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_);
|
||||
this.func_184611_a(p_190775_2_, ItemStack.field_190927_a);
|
||||
}
|
||||
|
||||
@@ -967,6 +1028,7 @@
|
||||
}
|
||||
|
||||
public void func_71059_n(Entity p_71059_1_) {
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return;
|
||||
if (p_71059_1_.func_70075_an()) {
|
||||
if (!p_71059_1_.func_85031_j(this)) {
|
||||
float f = (float)this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111126_e();
|
||||
@@ -994,8 +1056,11 @@
|
||||
|
||||
boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(MobEffects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof EntityLivingBase;
|
||||
flag2 = flag2 && !this.func_70051_ag();
|
||||
+
|
||||
+ net.minecraftforge.event.entity.player.CriticalHitEvent hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, p_71059_1_, flag2, flag2 ? 1.5F : 1.0F);
|
||||
+ flag2 = hitResult != null;
|
||||
if (flag2) {
|
||||
- f *= 1.5F;
|
||||
+ f *= hitResult.getDamageModifier();
|
||||
}
|
||||
|
||||
f = f + f1;
|
||||
@@ -1091,8 +1156,10 @@
|
||||
}
|
||||
|
||||
if (!itemstack1.func_190926_b() && entity instanceof EntityLivingBase) {
|
||||
+ ItemStack copy = itemstack1.func_77946_l();
|
||||
itemstack1.func_77961_a((EntityLivingBase)entity, this);
|
||||
if (itemstack1.func_190926_b()) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copy, EnumHand.MAIN_HAND);
|
||||
this.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a);
|
||||
}
|
||||
}
|
||||
@@ -1134,7 +1201,7 @@
|
||||
}
|
||||
|
||||
if (this.field_70146_Z.nextFloat() < f) {
|
||||
- this.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100);
|
||||
+ this.func_184811_cZ().func_185145_a(this.func_184607_cu().func_77973_b(), 100);
|
||||
this.func_184602_cy();
|
||||
this.field_70170_p.func_72960_a(this, (byte)30);
|
||||
}
|
||||
@@ -1182,7 +1249,12 @@
|
||||
}
|
||||
|
||||
public EntityPlayer.SleepResult func_180469_a(BlockPos p_180469_1_) {
|
||||
- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockHorizontal.field_185512_D);
|
||||
+ EntityPlayer.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, p_180469_1_);
|
||||
+ if (ret != null) return ret;
|
||||
+ final IBlockState state = this.field_70170_p.func_175667_e(p_180469_1_) ? this.field_70170_p.func_180495_p(p_180469_1_) : null;
|
||||
+ final boolean isBed = state != null && state.isBed(this.field_70170_p, p_180469_1_, this);
|
||||
+ final EnumFacing enumfacing = isBed && state.func_177230_c() instanceof BlockHorizontal ? (EnumFacing)state.func_177229_b(BlockHorizontal.field_185512_D) : null;
|
||||
+
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
if (this.func_70608_bn() || !this.func_70089_S()) {
|
||||
return EntityPlayer.SleepResult.OTHER_PROBLEM;
|
||||
@@ -1192,7 +1264,7 @@
|
||||
return EntityPlayer.SleepResult.NOT_POSSIBLE_HERE;
|
||||
}
|
||||
|
||||
- if (this.field_70170_p.func_72935_r()) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, this.field_71081_bT)) {
|
||||
return EntityPlayer.SleepResult.NOT_POSSIBLE_NOW;
|
||||
}
|
||||
|
||||
@@ -1217,7 +1289,7 @@
|
||||
this.func_192030_dh();
|
||||
this.func_175145_a(StatList.field_199092_j.func_199076_b(StatList.field_203284_n));
|
||||
this.func_70105_a(0.2F, 0.2F);
|
||||
- if (this.field_70170_p.func_175667_e(p_180469_1_)) {
|
||||
+ if (enumfacing != null) {
|
||||
float f1 = 0.5F + (float)enumfacing.func_82601_c() * 0.4F;
|
||||
float f = 0.5F + (float)enumfacing.func_82599_e() * 0.4F;
|
||||
this.func_175139_a(enumfacing);
|
||||
@@ -1242,6 +1314,8 @@
|
||||
private boolean func_190774_a(BlockPos p_190774_1_, EnumFacing p_190774_2_) {
|
||||
if (Math.abs(this.field_70165_t - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)p_190774_1_.func_177952_p()) <= 3.0D) {
|
||||
return true;
|
||||
+ } else if (p_190774_2_ == null) {
|
||||
+ return false;
|
||||
} else {
|
||||
BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d());
|
||||
return Math.abs(this.field_70165_t - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)blockpos.func_177952_p()) <= 3.0D;
|
||||
@@ -1254,16 +1328,19 @@
|
||||
}
|
||||
|
||||
public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_);
|
||||
this.func_70105_a(0.6F, 1.8F);
|
||||
- IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT);
|
||||
- if (this.field_71081_bT != null && iblockstate.func_177230_c() instanceof BlockBed) {
|
||||
- this.field_70170_p.func_180501_a(this.field_71081_bT, (IBlockState)iblockstate.func_206870_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4);
|
||||
- BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0);
|
||||
+ IBlockState iblockstate = field_71081_bT == null ? null : this.field_70170_p.func_180495_p(this.field_71081_bT);
|
||||
+ if (this.field_71081_bT != null && iblockstate.isBed(field_70170_p, field_71081_bT, this)) {
|
||||
+ iblockstate.setBedOccupied(field_70170_p, field_71081_bT, this, false);
|
||||
+ BlockPos blockpos = iblockstate.getBedSpawnPosition(field_70170_p, field_71081_bT, this);
|
||||
if (blockpos == null) {
|
||||
blockpos = this.field_71081_bT.func_177984_a();
|
||||
}
|
||||
|
||||
this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F));
|
||||
+ } else {
|
||||
+ p_70999_3_ = false;
|
||||
}
|
||||
|
||||
this.field_71083_bS = false;
|
||||
@@ -1279,29 +1356,30 @@
|
||||
}
|
||||
|
||||
private boolean func_175143_p() {
|
||||
- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() instanceof BlockBed;
|
||||
+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, this.field_71081_bT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BlockPos func_180467_a(IBlockReader p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_) {
|
||||
- Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c();
|
||||
- if (!(block instanceof BlockBed)) {
|
||||
+ IBlockState state = p_180467_0_.func_180495_p(p_180467_1_);
|
||||
+ if (!state.isBed(p_180467_0_, p_180467_1_, null)) {
|
||||
if (!p_180467_2_) {
|
||||
return null;
|
||||
} else {
|
||||
- boolean flag = block.func_181623_g();
|
||||
+ boolean flag = state.func_177230_c().func_181623_g();
|
||||
boolean flag1 = p_180467_0_.func_180495_p(p_180467_1_.func_177984_a()).func_177230_c().func_181623_g();
|
||||
return flag && flag1 ? p_180467_1_ : null;
|
||||
}
|
||||
} else {
|
||||
- return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0);
|
||||
+ return state.getBedSpawnPosition(p_180467_0_, p_180467_1_, null);
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public float func_71051_bG() {
|
||||
if (this.field_71081_bT != null) {
|
||||
- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockHorizontal.field_185512_D);
|
||||
+ IBlockState state = this.field_70170_p.func_180495_p(this.field_71081_bT);
|
||||
+ EnumFacing enumfacing = !state.isBed(field_70170_p, field_71081_bT, this) ? EnumFacing.UP : state.getBedDirection(field_70170_p, field_71081_bT);
|
||||
switch(enumfacing) {
|
||||
case SOUTH:
|
||||
return 90.0F;
|
||||
@@ -1333,23 +1411,67 @@
|
||||
public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) {
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Use Dimension sensitive version
|
||||
public BlockPos func_180470_cg() {
|
||||
- return this.field_71077_c;
|
||||
+ return getBedLocation(this.field_71093_bK);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * A dimension aware version of getBedLocation.
|
||||
+ * @param dimension The dimension to get the bed spawn for
|
||||
+ * @return The player specific spawn location for the dimension. May be null.
|
||||
+ */
|
||||
+ public BlockPos getBedLocation(int dim) {
|
||||
+ return dim == 0 ? field_71081_bT : spawnPosMap.get(dim);
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated //Forge: Use Dimension sensitive version
|
||||
public boolean func_82245_bX() {
|
||||
- return this.field_82248_d;
|
||||
+ return isSpawnForced(this.field_71093_bK);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * A dimension aware version of isSpawnForced.
|
||||
+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not.
|
||||
+ * This just extends that to be dimension aware.
|
||||
+ * @param dimension The dimension to get whether to check for a bed before spawning for
|
||||
+ * @return The player specific spawn location for the dimension. May be null.
|
||||
+ */
|
||||
+ public boolean isSpawnForced(int dim) {
|
||||
+ return dim == 0 ? field_82248_d : spawnForcedMap.getOrDefault(dim, false);
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated //Forge: Use Dimension sensitive version
|
||||
public void func_180473_a(BlockPos p_180473_1_, boolean p_180473_2_) {
|
||||
- if (p_180473_1_ != null) {
|
||||
- this.field_71077_c = p_180473_1_;
|
||||
- this.field_82248_d = p_180473_2_;
|
||||
- } else {
|
||||
- this.field_71077_c = null;
|
||||
- this.field_82248_d = false;
|
||||
- }
|
||||
+ setSpawnPoint(p_180473_1_, p_180473_2_, this.field_71093_bK);
|
||||
+ }
|
||||
|
||||
+ /**
|
||||
+ * A dimension aware version of setSpawnChunk.
|
||||
+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension.
|
||||
+ * @param pos The spawn point to set as the player-specific spawn point for the dimension
|
||||
+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed)
|
||||
+ * @param dimension Which dimension to apply the player-specific respawn point to
|
||||
+ */
|
||||
+ public void setSpawnPoint(BlockPos pos, boolean forced, int dim) {
|
||||
+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return;
|
||||
+ if (dim != 0) {
|
||||
+ if (pos == null) {
|
||||
+ spawnPosMap.remove(dim);
|
||||
+ spawnForcedMap.remove(dim);
|
||||
+ } else {
|
||||
+ spawnPosMap.put(dim, pos);
|
||||
+ spawnForcedMap.put(dim, forced);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ if (pos != null) {
|
||||
+ this.field_71077_c = pos;
|
||||
+ this.field_82248_d = forced;
|
||||
+ } else {
|
||||
+ this.field_71077_c = null;
|
||||
+ this.field_82248_d = false;
|
||||
+ }
|
||||
}
|
||||
|
||||
public void func_195066_a(ResourceLocation p_195066_1_) {
|
||||
@@ -1519,6 +1641,8 @@
|
||||
}
|
||||
|
||||
super.func_180430_e(p_180430_1_, p_180430_2_);
|
||||
+ } else {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_180430_1_, p_180430_2_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1780,7 +1904,10 @@
|
||||
}
|
||||
|
||||
public ITextComponent func_145748_c_() {
|
||||
- ITextComponent itextcomponent = ScorePlayerTeam.func_200541_a(this.func_96124_cp(), this.func_200200_C_());
|
||||
+ ITextComponent itextcomponent = new TextComponentString("");
|
||||
+ prefixes.forEach(e -> itextcomponent.func_150257_a(e));
|
||||
+ itextcomponent.func_150257_a(ScorePlayerTeam.func_200541_a(this.func_96124_cp(), this.func_200200_C_()));
|
||||
+ suffixes.forEach(e -> itextcomponent.func_150257_a(e));
|
||||
return this.func_208016_c(itextcomponent);
|
||||
}
|
||||
|
||||
@@ -1800,7 +1927,7 @@
|
||||
}
|
||||
|
||||
public float func_70047_e() {
|
||||
- float f = 1.62F;
|
||||
+ float f = eyeHeight;
|
||||
if (this.func_70608_bn()) {
|
||||
f = 0.2F;
|
||||
} else if (!this.func_203007_ba() && !this.func_184613_cA() && this.field_70131_O != 0.6F) {
|
||||
@@ -1967,6 +2094,30 @@
|
||||
return this.field_71075_bZ.field_75098_d && this.func_184840_I() >= 2;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns the default eye height of the player
|
||||
+ * @return player default eye height
|
||||
+ */
|
||||
+ public float getDefaultEyeHeight() {
|
||||
+ return 1.62F;
|
||||
+ }
|
||||
+
|
||||
+ public int getSpawnDimension() {
|
||||
+ return this.spawnDimension;
|
||||
+ }
|
||||
+
|
||||
+ public void setSpawnDimenion(int dim) {
|
||||
+ this.spawnDimension = dim;
|
||||
+ }
|
||||
+
|
||||
+ public Collection<ITextComponent> getPrefixes() {
|
||||
+ return this.prefixes;
|
||||
+ }
|
||||
+
|
||||
+ public Collection<ITextComponent> getSuffixes() {
|
||||
+ return this.suffixes;
|
||||
+ }
|
||||
+
|
||||
public static enum EnumChatVisibility {
|
||||
FULL(0, "options.chat.visibility.full"),
|
||||
SYSTEM(1, "options.chat.visibility.system"),
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
--- a/net/minecraft/entity/player/InventoryPlayer.java
|
||||
+++ b/net/minecraft/entity/player/InventoryPlayer.java
|
||||
@@ -216,7 +216,8 @@
|
||||
int i = p_191973_2_.func_190916_E();
|
||||
ItemStack itemstack = this.func_70301_a(p_191973_1_);
|
||||
if (itemstack.func_190926_b()) {
|
||||
- itemstack = new ItemStack(item, 0);
|
||||
+ itemstack = p_191973_2_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up.
|
||||
+ itemstack.func_190920_e(0);
|
||||
if (p_191973_2_.func_77942_o()) {
|
||||
itemstack.func_77982_d(p_191973_2_.func_77978_p().func_74737_b());
|
||||
}
|
||||
@@ -267,7 +268,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+ field_70460_b.forEach(e -> e.onArmorTick(field_70458_d.field_70170_p, field_70458_d));
|
||||
}
|
||||
|
||||
public boolean func_70441_a(ItemStack p_70441_1_) {
|
||||
@@ -320,6 +321,8 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.func_85055_a(throwable, "Adding item to inventory");
|
||||
CrashReportCategory crashreportcategory = crashreport.func_85058_a("Item being added");
|
||||
+ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_191971_2_.func_77973_b().getRegistryName()));
|
||||
+ crashreportcategory.func_189529_a("Item Class", () -> p_191971_2_.func_77973_b().getClass().getName());
|
||||
crashreportcategory.func_71507_a("Item ID", Item.func_150891_b(p_191971_2_.func_77973_b()));
|
||||
crashreportcategory.func_71507_a("Item data", p_191971_2_.func_77952_i());
|
||||
crashreportcategory.func_189529_a("Item name", () -> {
|
|
@ -0,0 +1,29 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityArrow.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityArrow.java
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
BlockPos blockpos = new BlockPos(this.field_145791_d, this.field_145792_e, this.field_145789_f);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
- if (!iblockstate.func_196958_f() && !flag) {
|
||||
+ if (!iblockstate.isAir(this.field_70170_p, blockpos) && !flag) {
|
||||
VoxelShape voxelshape = iblockstate.func_196952_d(this.field_70170_p, blockpos);
|
||||
if (!voxelshape.func_197766_b()) {
|
||||
for(AxisAlignedBB axisalignedbb : voxelshape.func_197756_d()) {
|
||||
@@ -222,7 +222,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (raytraceresult != null && !flag) {
|
||||
+ if (raytraceresult != null && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
|
||||
this.func_184549_a(raytraceresult);
|
||||
this.field_70160_al = true;
|
||||
}
|
||||
@@ -313,7 +313,7 @@
|
||||
this.field_70254_i = true;
|
||||
this.field_70249_b = 7;
|
||||
this.func_70243_d(false);
|
||||
- if (!iblockstate.func_196958_f()) {
|
||||
+ if (!iblockstate.isAir(field_70170_p, blockpos)) {
|
||||
this.field_195056_av.func_196950_a(this.field_70170_p, blockpos, this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityFireball.java
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
++this.field_70234_an;
|
||||
RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, this.field_70234_an >= 25, this.field_70235_a);
|
||||
- if (raytraceresult != null) {
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
|
||||
this.func_70227_a(raytraceresult);
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityFishHook.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityFishHook.java
|
||||
@@ -235,8 +235,8 @@
|
||||
private boolean func_190625_o() {
|
||||
ItemStack itemstack = this.field_146042_b.func_184614_ca();
|
||||
ItemStack itemstack1 = this.field_146042_b.func_184592_cb();
|
||||
- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM;
|
||||
- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM;
|
||||
+ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod;
|
||||
+ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.ItemFishingRod;
|
||||
if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && !(this.func_70068_e(this.field_146042_b) > 1024.0D)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -346,8 +346,7 @@
|
||||
double d0 = this.field_70165_t + (double)(f1 * (float)this.field_146038_az * 0.1F);
|
||||
double d1 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F);
|
||||
double d2 = this.field_70161_v + (double)(f2 * (float)this.field_146038_az * 0.1F);
|
||||
- Block block = worldserver.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c();
|
||||
- if (block == Blocks.field_150355_j) {
|
||||
+ if (worldserver.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) {
|
||||
if (this.field_70146_Z.nextFloat() < 0.15F) {
|
||||
worldserver.func_195598_a(Particles.field_197612_e, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D);
|
||||
}
|
||||
@@ -382,8 +381,7 @@
|
||||
double d4 = this.field_70165_t + (double)(MathHelper.func_76126_a(f6) * f7 * 0.1F);
|
||||
double d5 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F);
|
||||
double d6 = this.field_70161_v + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F);
|
||||
- Block block1 = worldserver.func_180495_p(new BlockPos((int)d4, (int)d5 - 1, (int)d6)).func_177230_c();
|
||||
- if (block1 == Blocks.field_150355_j) {
|
||||
+ if (worldserver.func_180495_p(new BlockPos((int)d4, (int)d5 - 1, (int)d6)).func_185904_a() == net.minecraft.block.material.Material.field_151586_h) {
|
||||
worldserver.func_195598_a(Particles.field_197606_Q, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D);
|
||||
}
|
||||
}
|
||||
@@ -412,6 +410,7 @@
|
||||
public int func_146034_e(ItemStack p_146034_1_) {
|
||||
if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) {
|
||||
int i = 0;
|
||||
+ net.minecraftforge.event.entity.player.ItemFishedEvent event = null;
|
||||
if (this.field_146043_c != null) {
|
||||
this.func_184527_k();
|
||||
CriteriaTriggers.field_204811_D.func_204820_a((EntityPlayerMP)this.field_146042_b, p_146034_1_, this, Collections.emptyList());
|
||||
@@ -420,7 +419,14 @@
|
||||
} else if (this.field_146045_ax > 0) {
|
||||
LootContext.Builder lootcontext$builder = (new LootContext.Builder((WorldServer)this.field_70170_p)).func_204313_a(new BlockPos(this));
|
||||
lootcontext$builder.func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da());
|
||||
+ lootcontext$builder.func_186470_a(this.field_146042_b).func_186472_a(this);
|
||||
List<ItemStack> list = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTableList.field_186387_al).func_186462_a(this.field_70146_Z, lootcontext$builder.func_186471_a());
|
||||
+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_146051_au ? 2 : 1, this);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
|
||||
+ if (event.isCanceled()) {
|
||||
+ this.func_70106_y();
|
||||
+ return event.getRodDamage();
|
||||
+ }
|
||||
CriteriaTriggers.field_204811_D.func_204820_a((EntityPlayerMP)this.field_146042_b, p_146034_1_, this, list);
|
||||
|
||||
for(ItemStack itemstack : list) {
|
||||
@@ -448,7 +454,7 @@
|
||||
}
|
||||
|
||||
this.func_70106_y();
|
||||
- return i;
|
||||
+ return event == null ? i : event.getRodDamage();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityLargeFireball.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityLargeFireball.java
|
||||
@@ -33,7 +33,7 @@
|
||||
this.func_174815_a(this.field_70235_a, p_70227_1_.field_72308_g);
|
||||
}
|
||||
|
||||
- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing");
|
||||
+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a);
|
||||
this.field_70170_p.func_72885_a((Entity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_92057_e, flag, flag);
|
||||
this.func_70106_y();
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityLlamaSpit.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityLlamaSpit.java
|
||||
@@ -69,7 +69,7 @@
|
||||
raytraceresult = new RayTraceResult(entity);
|
||||
}
|
||||
|
||||
- if (raytraceresult != null) {
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
|
||||
this.func_190536_a(raytraceresult);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityShulkerBullet.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityShulkerBullet.java
|
||||
@@ -250,7 +250,7 @@
|
||||
}
|
||||
|
||||
RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, false, this.field_184570_a);
|
||||
- if (raytraceresult != null) {
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
|
||||
this.func_184567_a(raytraceresult);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/projectile/EntitySmallFireball.java
|
||||
+++ b/net/minecraft/entity/projectile/EntitySmallFireball.java
|
||||
@@ -35,7 +35,7 @@
|
||||
} else {
|
||||
boolean flag1 = true;
|
||||
if (this.field_70235_a != null && this.field_70235_a instanceof EntityLiving) {
|
||||
- flag1 = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing");
|
||||
+ flag1 = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a);
|
||||
}
|
||||
|
||||
if (flag1) {
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityThrowable.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityThrowable.java
|
||||
@@ -181,7 +181,7 @@
|
||||
if (raytraceresult != null) {
|
||||
if (raytraceresult.field_72313_a == RayTraceResult.Type.BLOCK && this.field_70170_p.func_180495_p(raytraceresult.func_178782_a()).func_177230_c() == Blocks.field_150427_aO) {
|
||||
this.func_181015_d(raytraceresult.func_178782_a());
|
||||
- } else {
|
||||
+ } else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){
|
||||
this.func_70184_a(raytraceresult);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
+++ b/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
public float func_180428_a(Explosion p_180428_1_, IBlockReader p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_, IFluidState p_180428_5_, float p_180428_6_) {
|
||||
- return this.func_82342_d() && EntityWither.func_181033_a(p_180428_4_.func_177230_c()) ? Math.min(0.8F, p_180428_6_) : p_180428_6_;
|
||||
+ return this.func_82342_d() && p_180428_4_.canEntityDestroy(p_180428_2_, p_180428_3_, this) ? Math.min(0.8F, p_180428_6_) : p_180428_6_;
|
||||
}
|
||||
|
||||
protected void func_70227_a(RayTraceResult p_70227_1_) {
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"));
|
||||
+ this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a));
|
||||
this.func_70106_y();
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
|
||||
public void func_72966_v() {
|
||||
@@ -2397,4 +2400,31 @@
|
||||
@@ -2397,4 +2400,35 @@
|
||||
public abstract RecipeManager func_199532_z();
|
||||
|
||||
public abstract NetworkTagManager func_205772_D();
|
||||
|
@ -53,26 +53,30 @@
|
|||
+
|
||||
+ private net.minecraftforge.common.util.WorldCapabilityData capabilityData;
|
||||
+
|
||||
+ protected void initCapabilities()
|
||||
+ {
|
||||
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities();
|
||||
+ this.gatherCapabilities(parent);
|
||||
+ net.minecraftforge.common.util.WorldCapabilityData data = (net.minecraftforge.common.util.WorldCapabilityData)perWorldStorage.func_201067_a(net.minecraftforge.common.util.WorldCapabilityData::new, net.minecraftforge.common.util.WorldCapabilityData.ID);
|
||||
+ if (data == null)
|
||||
+ {
|
||||
+ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities());
|
||||
+ perWorldStorage.func_75745_a(capabilityData.func_195925_e(), capabilityData);
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ capabilityData = data;
|
||||
+ capabilityData.setCapabilities(field_73011_w, getCapabilities());
|
||||
+ }
|
||||
+ protected void initCapabilities() {
|
||||
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities();
|
||||
+ this.gatherCapabilities(parent);
|
||||
+ net.minecraftforge.common.util.WorldCapabilityData data = (net.minecraftforge.common.util.WorldCapabilityData)perWorldStorage.func_201067_a(net.minecraftforge.common.util.WorldCapabilityData::new, net.minecraftforge.common.util.WorldCapabilityData.ID);
|
||||
+ if (data == null) {
|
||||
+ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities());
|
||||
+ perWorldStorage.func_75745_a(capabilityData.func_195925_e(), capabilityData);
|
||||
+ } else {
|
||||
+ capabilityData = data;
|
||||
+ capabilityData.setCapabilities(field_73011_w, getCapabilities());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected WorldSavedDataStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses.
|
||||
+ public WorldSavedDataStorage getPerWorldStorage()
|
||||
+ {
|
||||
+ return perWorldStorage;
|
||||
+ public WorldSavedDataStorage getPerWorldStorage() {
|
||||
+ return perWorldStorage;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) {
|
||||
+ int ret = 0;
|
||||
+ for(Entity entity : this.field_72996_f) {
|
||||
+ if (entity.isCreatureType(type, forSpawnCount))
|
||||
+ ret++;
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
--- a/net/minecraft/world/WorldEntitySpawner.java
|
||||
+++ b/net/minecraft/world/WorldEntitySpawner.java
|
||||
@@ -71,13 +71,15 @@
|
||||
|
||||
for(EnumCreatureType enumcreaturetype : EnumCreatureType.values()) {
|
||||
if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) {
|
||||
- int l4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a());
|
||||
+ int l4 = p_77192_1_.countEntities(enumcreaturetype, true);
|
||||
int i5 = enumcreaturetype.func_75601_b() * i / field_180268_a;
|
||||
if (l4 <= i5) {
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
|
||||
+ java.util.ArrayList<ChunkPos> shuffled = new java.util.ArrayList<>(this.field_77193_b);
|
||||
+ java.util.Collections.shuffle(shuffled);
|
||||
label142:
|
||||
- for(ChunkPos chunkpos1 : this.field_77193_b) {
|
||||
+ for(ChunkPos chunkpos1 : shuffled) {
|
||||
BlockPos blockpos = func_180621_a(p_77192_1_, chunkpos1.field_77276_a, chunkpos1.field_77275_b);
|
||||
int k1 = blockpos.func_177958_n();
|
||||
int l1 = blockpos.func_177956_o();
|
||||
@@ -125,7 +127,9 @@
|
||||
}
|
||||
|
||||
entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
|
||||
- if (entityliving.func_70601_bi() && entityliving.func_205019_a(p_77192_1_)) {
|
||||
+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(entityliving, p_77192_1_, f, i3, f1, null);
|
||||
+ if (canSpawn == 1 || (canSpawn == 0 && entityliving.func_70601_bi() && entityliving.func_205019_a(p_77192_1_))) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f, i3, f1, null))
|
||||
ientitylivingdata = entityliving.func_204210_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata, (NBTTagCompound)null);
|
||||
if (entityliving.func_205019_a(p_77192_1_)) {
|
||||
++j2;
|
||||
@@ -135,7 +139,7 @@
|
||||
entityliving.func_70106_y();
|
||||
}
|
||||
|
||||
- if (j2 >= entityliving.func_70641_bl()) {
|
||||
+ if (j2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) {
|
||||
continue label142;
|
||||
}
|
||||
|
||||
@@ -183,18 +187,25 @@
|
||||
|
||||
public static boolean func_209382_a(EntitySpawnPlacementRegistry.SpawnPlacementType p_209382_0_, IWorldReaderBase p_209382_1_, BlockPos p_209382_2_, @Nullable EntityType<? extends EntityLiving> p_209382_3_) {
|
||||
if (p_209382_3_ != null && p_209382_1_.func_175723_af().func_177746_a(p_209382_2_)) {
|
||||
- IBlockState iblockstate = p_209382_1_.func_180495_p(p_209382_2_);
|
||||
- IFluidState ifluidstate = p_209382_1_.func_204610_c(p_209382_2_);
|
||||
- switch(p_209382_0_) {
|
||||
+ return p_209382_0_.canSpawnAt(p_209382_1_, p_209382_2_, p_209382_3_);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean canSpawnAtBody(EntitySpawnPlacementRegistry.SpawnPlacementType placeType, IWorldReaderBase worldIn, BlockPos pos, @Nullable EntityType<? extends EntityLiving> entityTypeIn) {
|
||||
+ if (true) {
|
||||
+ IBlockState iblockstate = worldIn.func_180495_p(pos);
|
||||
+ IFluidState ifluidstate = worldIn.func_204610_c(pos);
|
||||
+ switch(placeType) {
|
||||
case IN_WATER:
|
||||
- return ifluidstate.func_206884_a(FluidTags.field_206959_a) && p_209382_1_.func_204610_c(p_209382_2_.func_177977_b()).func_206884_a(FluidTags.field_206959_a) && !p_209382_1_.func_180495_p(p_209382_2_.func_177984_a()).func_185915_l();
|
||||
+ return ifluidstate.func_206884_a(FluidTags.field_206959_a) && worldIn.func_204610_c(pos.func_177977_b()).func_206884_a(FluidTags.field_206959_a) && !worldIn.func_180495_p(pos.func_177984_a()).func_185915_l();
|
||||
case ON_GROUND:
|
||||
default:
|
||||
- IBlockState iblockstate1 = p_209382_1_.func_180495_p(p_209382_2_.func_177977_b());
|
||||
- if (iblockstate1.func_185896_q() || p_209382_3_ != null && EntitySpawnPlacementRegistry.func_209345_a(p_209382_3_, iblockstate1)) {
|
||||
+ IBlockState iblockstate1 = worldIn.func_180495_p(pos.func_177977_b());
|
||||
+ if (iblockstate.canCreatureSpawn(worldIn, pos, placeType, entityTypeIn)) {
|
||||
Block block = iblockstate1.func_177230_c();
|
||||
boolean flag = block != Blocks.field_150357_h && block != Blocks.field_180401_cv;
|
||||
- return flag && func_206851_a(iblockstate, ifluidstate) && func_206851_a(p_209382_1_.func_180495_p(p_209382_2_.func_177984_a()), p_209382_1_.func_204610_c(p_209382_2_.func_177984_a()));
|
||||
+ return flag && func_206851_a(iblockstate, ifluidstate) && func_206851_a(worldIn.func_180495_p(pos.func_177984_a()), worldIn.func_204610_c(pos.func_177984_a()));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -235,6 +246,7 @@
|
||||
|
||||
float f = MathHelper.func_76131_a((float)l, (float)i + entityliving.field_70130_N, (float)(i + 16) - entityliving.field_70130_N);
|
||||
float f1 = MathHelper.func_76131_a((float)i1, (float)j + entityliving.field_70130_N, (float)(j + 16) - entityliving.field_70130_N);
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(entityliving, p_77191_0_, f, blockpos.func_177956_o(), f1, null) == -1) continue;
|
||||
entityliving.func_70012_b((double)f, (double)blockpos.func_177956_o(), (double)f1, p_77191_4_.nextFloat() * 360.0F, 0.0F);
|
||||
if (entityliving.func_205020_a(p_77191_0_) && entityliving.func_205019_a(p_77191_0_)) {
|
||||
ientitylivingdata = entityliving.func_204210_a(p_77191_0_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata, (NBTTagCompound)null);
|
|
@ -9,7 +9,7 @@
|
|||
public static final float[] field_111203_a = new float[]{1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F};
|
||||
protected World field_76579_a;
|
||||
protected boolean field_76575_d;
|
||||
@@ -141,4 +141,107 @@
|
||||
@@ -141,4 +141,97 @@
|
||||
public abstract boolean func_76568_b(int p_76568_1_, int p_76568_2_);
|
||||
|
||||
public abstract DimensionType func_186058_p();
|
||||
|
@ -21,65 +21,56 @@
|
|||
+ private int dimensionId;
|
||||
+
|
||||
+ @Override
|
||||
+ public void setId(int id)
|
||||
+ {
|
||||
+ public void setId(int id) {
|
||||
+ this.dimensionId = id;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getId()
|
||||
+ {
|
||||
+ public int getId() {
|
||||
+ return this.dimensionId;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @OnlyIn(Dist.CLIENT)
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.IRenderHandler getSkyRenderer()
|
||||
+ {
|
||||
+ public net.minecraftforge.client.IRenderHandler getSkyRenderer() {
|
||||
+ return this.skyRenderer;
|
||||
+ }
|
||||
+
|
||||
+ @OnlyIn(Dist.CLIENT)
|
||||
+ @Override
|
||||
+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer)
|
||||
+ {
|
||||
+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) {
|
||||
+ this.skyRenderer = skyRenderer;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @OnlyIn(Dist.CLIENT)
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.IRenderHandler getCloudRenderer()
|
||||
+ {
|
||||
+ public net.minecraftforge.client.IRenderHandler getCloudRenderer() {
|
||||
+ return cloudRenderer;
|
||||
+ }
|
||||
+
|
||||
+ @OnlyIn(Dist.CLIENT)
|
||||
+ @Override
|
||||
+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer)
|
||||
+ {
|
||||
+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) {
|
||||
+ cloudRenderer = renderer;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @OnlyIn(Dist.CLIENT)
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer()
|
||||
+ {
|
||||
+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() {
|
||||
+ return weatherRenderer;
|
||||
+ }
|
||||
+
|
||||
+ @OnlyIn(Dist.CLIENT)
|
||||
+ @Override
|
||||
+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer)
|
||||
+ {
|
||||
+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) {
|
||||
+ weatherRenderer = renderer;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void resetRainAndThunder()
|
||||
+ {
|
||||
+ public void resetRainAndThunder() {
|
||||
+ field_76579_a.func_72912_H().func_76080_g(0);
|
||||
+ field_76579_a.func_72912_H().func_76084_b(false);
|
||||
+ field_76579_a.func_72912_H().func_76090_f(0);
|
||||
|
@ -94,7 +85,7 @@
|
|||
+ * @return the result of a player trying to sleep at the given location
|
||||
+ */
|
||||
+ public SleepResult canSleepAt(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) {
|
||||
+ return (this.func_76567_e() && this.field_76579_a.func_180494_b(pos) != net.minecraft.init.Biomes.field_76778_j) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
|
||||
+ return (this.func_76567_e() && this.field_76579_a.func_180494_b(pos) != net.minecraft.init.Biomes.field_76778_j) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -108,9 +99,8 @@
|
|||
+ *
|
||||
+ * @return true if lighting checks should be performed
|
||||
+ */
|
||||
+ public boolean shouldClientCheckLighting()
|
||||
+ {
|
||||
+ return !(this instanceof OverworldDimension);
|
||||
+ public boolean shouldClientCheckLighting() {
|
||||
+ return !(this instanceof OverworldDimension);
|
||||
+ }
|
||||
+
|
||||
+ public enum SleepResult {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/command/CommandBase.java
|
||||
+++ ../src-work/minecraft/net/minecraft/command/CommandBase.java
|
||||
@@ -393,7 +393,7 @@
|
||||
itextcomponent.func_150258_a(" ");
|
||||
}
|
||||
|
||||
- ITextComponent itextcomponent1 = new TextComponentString(p_147176_1_[i]);
|
||||
+ ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_147176_1_[i]); // Forge: links for messages
|
||||
|
||||
if (p_147176_3_)
|
||||
{
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/command/CommandFill.java
|
||||
+++ ../src-work/minecraft/net/minecraft/command/CommandFill.java
|
||||
@@ -82,7 +82,7 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
boolean flag = false;
|
||||
|
||||
- if (p_184881_3_.length >= 10 && block.func_149716_u())
|
||||
+ if (p_184881_3_.length >= 10 && block.hasTileEntity(iblockstate))
|
||||
{
|
||||
String s = func_180529_a(p_184881_3_, 9);
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- else if ("replace".equals(p_184881_3_[8]) && !block.func_149716_u() && p_184881_3_.length > 9)
|
||||
+ else if ("replace".equals(p_184881_3_[8]) && !block.hasTileEntity(iblockstate) && p_184881_3_.length > 9)
|
||||
{
|
||||
Block block1 = CommandBase.func_147180_g(p_184881_2_, p_184881_3_[9]);
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java
|
||||
+++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java
|
||||
@@ -70,7 +70,7 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
boolean flag = false;
|
||||
|
||||
- if (p_184881_3_.length >= 7 && block.func_149716_u())
|
||||
+ if (p_184881_3_.length >= 7 && block.hasTileEntity(iblockstate))
|
||||
{
|
||||
String s = func_180529_a(p_184881_3_, 6);
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java
|
||||
@@ -1434,5 +1448,19 @@
|
||||
ON_GROUND,
|
||||
IN_AIR,
|
||||
IN_WATER;
|
||||
+
|
||||
+ private final java.util.function.BiPredicate<net.minecraft.world.IBlockAccess, BlockPos> spawnPredicate;
|
||||
+
|
||||
+ SpawnPlacementType() { this.spawnPredicate = null; }
|
||||
+
|
||||
+ SpawnPlacementType(java.util.function.BiPredicate<net.minecraft.world.IBlockAccess, BlockPos> spawnPredicate)
|
||||
+ {
|
||||
+ this.spawnPredicate = spawnPredicate;
|
||||
+ }
|
||||
+
|
||||
+ public boolean canSpawnAt(World world, BlockPos pos)
|
||||
+ {
|
||||
+ return this.spawnPredicate != null ? this.spawnPredicate.test(world, pos) : net.minecraft.world.WorldEntitySpawner.canCreatureTypeSpawnBody(this, world, pos);
|
||||
+ }
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java
|
||||
@@ -16,7 +16,7 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootTableList;
|
||||
|
||||
-public class EntityMooshroom extends EntityCow
|
||||
+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable
|
||||
{
|
||||
public EntityMooshroom(World p_i1687_1_)
|
||||
{
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
return true;
|
||||
}
|
||||
- else if (itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0)
|
||||
+ else if (false && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) //Forge Disable, Moved to onSheared
|
||||
{
|
||||
this.func_70106_y();
|
||||
this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D);
|
||||
@@ -90,6 +90,35 @@
|
||||
return new EntityMooshroom(this.field_70170_p);
|
||||
}
|
||||
|
||||
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return func_70874_b() >= 0; }
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune)
|
||||
+ {
|
||||
+ this.func_70106_y();
|
||||
+ ((net.minecraft.world.WorldServer)this.field_70170_p).func_180505_a(EnumParticleTypes.EXPLOSION_LARGE, false, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
+
|
||||
+ EntityCow entitycow = new EntityCow(this.field_70170_p);
|
||||
+ entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A);
|
||||
+ entitycow.func_70606_j(this.func_110143_aJ());
|
||||
+ entitycow.field_70761_aq = this.field_70761_aq;
|
||||
+
|
||||
+ if (this.func_145818_k_())
|
||||
+ {
|
||||
+ entitycow.func_96094_a(this.func_95999_t());
|
||||
+ }
|
||||
+
|
||||
+ this.field_70170_p.func_72838_d(entitycow);
|
||||
+
|
||||
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
||||
+ for (int i = 0; i < 5; ++i)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(Blocks.field_150337_Q));
|
||||
+ }
|
||||
+
|
||||
+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
@Nullable
|
||||
protected ResourceLocation func_184647_J()
|
||||
{
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java
|
||||
@@ -222,7 +222,7 @@
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
- if (this.field_70146_Z.nextInt(3) == 0)
|
||||
+ if (this.field_70146_Z.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_))
|
||||
{
|
||||
this.func_193101_c(p_184645_1_);
|
||||
this.func_70912_b(1 + this.field_70170_p.field_73012_v.nextInt(3));
|
||||
@@ -320,7 +320,7 @@
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos.func_177977_b());
|
||||
Block block = iblockstate.func_177230_c();
|
||||
|
||||
- if (block == Blocks.field_150349_c || iblockstate.func_185904_a() == Material.field_151584_j)
|
||||
+ if (block == Blocks.field_150349_c || block.isLeaves(iblockstate, this.field_70170_p, blockpos.func_177977_b()))
|
||||
{
|
||||
return true;
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityParrot.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityParrot.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.entity.passive;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
+import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@@ -89,12 +90,12 @@
|
||||
{
|
||||
public boolean apply(@Nullable EntityLiving p_apply_1_)
|
||||
{
|
||||
- return p_apply_1_ != null && EntityParrot.field_192017_bK.containsKey(EntityList.field_191308_b.func_148757_b(p_apply_1_.getClass()));
|
||||
+ return p_apply_1_ != null && EntityParrot.MIMIC_SOUNDS.containsKey(p_apply_1_.getClass());
|
||||
}
|
||||
};
|
||||
private static final Item field_192015_bI = Items.field_151106_aX;
|
||||
private static final Set<Item> field_192016_bJ = Sets.newHashSet(Items.field_151014_N, Items.field_151081_bc, Items.field_151080_bb, Items.field_185163_cU);
|
||||
- private static final Int2ObjectMap<SoundEvent> field_192017_bK = new Int2ObjectOpenHashMap<SoundEvent>(32);
|
||||
+ private static final java.util.Map<Class<? extends Entity>, SoundEvent> MIMIC_SOUNDS = Maps.newHashMapWithExpectedSize(32);
|
||||
public float field_192008_bB;
|
||||
public float field_192009_bC;
|
||||
public float field_192010_bD;
|
||||
@@ -214,7 +215,7 @@
|
||||
|
||||
if (!entityliving.func_174814_R())
|
||||
{
|
||||
- SoundEvent soundevent = func_191999_g(EntityList.field_191308_b.func_148757_b(entityliving.getClass()));
|
||||
+ SoundEvent soundevent = MIMIC_SOUNDS.get(entityliving.getClass());
|
||||
p_192006_0_.func_184148_a((EntityPlayer)null, p_192006_1_.field_70165_t, p_192006_1_.field_70163_u, p_192006_1_.field_70161_v, soundevent, p_192006_1_.func_184176_by(), 0.7F, func_192000_b(p_192006_0_.field_73012_v));
|
||||
return true;
|
||||
}
|
||||
@@ -246,7 +247,7 @@
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
- if (this.field_70146_Z.nextInt(10) == 0)
|
||||
+ if (this.field_70146_Z.nextInt(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_184645_1_))
|
||||
{
|
||||
this.func_193101_c(p_184645_1_);
|
||||
this.func_70908_e(true);
|
||||
@@ -345,8 +346,9 @@
|
||||
{
|
||||
if (p_192003_0_.nextInt(1000) == 0)
|
||||
{
|
||||
- List<Integer> list = new ArrayList<Integer>(field_192017_bK.keySet());
|
||||
- return func_191999_g(((Integer)list.get(p_192003_0_.nextInt(list.size()))).intValue());
|
||||
+ List<SoundEvent> list = new ArrayList<SoundEvent>(MIMIC_SOUNDS.values());
|
||||
+ SoundEvent ret = list.get(p_192003_0_.nextInt(list.size()));
|
||||
+ return ret == null ? SoundEvents.field_192792_ep : ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -354,11 +356,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public static SoundEvent func_191999_g(int p_191999_0_)
|
||||
- {
|
||||
- return field_192017_bK.containsKey(p_191999_0_) ? (SoundEvent)field_192017_bK.get(p_191999_0_) : SoundEvents.field_192792_ep;
|
||||
- }
|
||||
-
|
||||
protected SoundEvent func_184601_bQ(DamageSource p_184601_1_)
|
||||
{
|
||||
return SoundEvents.field_192794_er;
|
||||
@@ -471,33 +468,38 @@
|
||||
|
||||
static
|
||||
{
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityBlaze.class), SoundEvents.field_193791_eM);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityCaveSpider.class), SoundEvents.field_193813_fc);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityCreeper.class), SoundEvents.field_193792_eN);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityElderGuardian.class), SoundEvents.field_193793_eO);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityDragon.class), SoundEvents.field_193794_eP);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityEnderman.class), SoundEvents.field_193795_eQ);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityEndermite.class), SoundEvents.field_193796_eR);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityEvoker.class), SoundEvents.field_193797_eS);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityGhast.class), SoundEvents.field_193798_eT);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityHusk.class), SoundEvents.field_193799_eU);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityIllusionIllager.class), SoundEvents.field_193800_eV);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityMagmaCube.class), SoundEvents.field_193801_eW);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityPigZombie.class), SoundEvents.field_193822_fl);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityPolarBear.class), SoundEvents.field_193802_eX);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityShulker.class), SoundEvents.field_193803_eY);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntitySilverfish.class), SoundEvents.field_193804_eZ);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntitySkeleton.class), SoundEvents.field_193811_fa);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntitySlime.class), SoundEvents.field_193812_fb);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntitySpider.class), SoundEvents.field_193813_fc);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityStray.class), SoundEvents.field_193814_fd);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityVex.class), SoundEvents.field_193815_fe);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityVindicator.class), SoundEvents.field_193816_ff);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityWitch.class), SoundEvents.field_193817_fg);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityWither.class), SoundEvents.field_193818_fh);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityWitherSkeleton.class), SoundEvents.field_193819_fi);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityWolf.class), SoundEvents.field_193820_fj);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityZombie.class), SoundEvents.field_193821_fk);
|
||||
- field_192017_bK.put(EntityList.field_191308_b.func_148757_b(EntityZombieVillager.class), SoundEvents.field_193823_fm);
|
||||
+ registerMimicSound(EntityBlaze.class, SoundEvents.field_193791_eM);
|
||||
+ registerMimicSound(EntityCaveSpider.class, SoundEvents.field_193813_fc);
|
||||
+ registerMimicSound(EntityCreeper.class, SoundEvents.field_193792_eN);
|
||||
+ registerMimicSound(EntityElderGuardian.class, SoundEvents.field_193793_eO);
|
||||
+ registerMimicSound(EntityDragon.class, SoundEvents.field_193794_eP);
|
||||
+ registerMimicSound(EntityEnderman.class, SoundEvents.field_193795_eQ);
|
||||
+ registerMimicSound(EntityEndermite.class, SoundEvents.field_193796_eR);
|
||||
+ registerMimicSound(EntityEvoker.class, SoundEvents.field_193797_eS);
|
||||
+ registerMimicSound(EntityGhast.class, SoundEvents.field_193798_eT);
|
||||
+ registerMimicSound(EntityHusk.class, SoundEvents.field_193799_eU);
|
||||
+ registerMimicSound(EntityIllusionIllager.class, SoundEvents.field_193800_eV);
|
||||
+ registerMimicSound(EntityMagmaCube.class, SoundEvents.field_193801_eW);
|
||||
+ registerMimicSound(EntityPigZombie.class, SoundEvents.field_193822_fl);
|
||||
+ registerMimicSound(EntityPolarBear.class, SoundEvents.field_193802_eX);
|
||||
+ registerMimicSound(EntityShulker.class, SoundEvents.field_193803_eY);
|
||||
+ registerMimicSound(EntitySilverfish.class, SoundEvents.field_193804_eZ);
|
||||
+ registerMimicSound(EntitySkeleton.class, SoundEvents.field_193811_fa);
|
||||
+ registerMimicSound(EntitySlime.class, SoundEvents.field_193812_fb);
|
||||
+ registerMimicSound(EntitySpider.class, SoundEvents.field_193813_fc);
|
||||
+ registerMimicSound(EntityStray.class, SoundEvents.field_193814_fd);
|
||||
+ registerMimicSound(EntityVex.class, SoundEvents.field_193815_fe);
|
||||
+ registerMimicSound(EntityVindicator.class, SoundEvents.field_193816_ff);
|
||||
+ registerMimicSound(EntityWitch.class, SoundEvents.field_193817_fg);
|
||||
+ registerMimicSound(EntityWither.class, SoundEvents.field_193818_fh);
|
||||
+ registerMimicSound(EntityWitherSkeleton.class, SoundEvents.field_193819_fi);
|
||||
+ registerMimicSound(EntityWolf.class, SoundEvents.field_193820_fj);
|
||||
+ registerMimicSound(EntityZombie.class, SoundEvents.field_193821_fk);
|
||||
+ registerMimicSound(EntityZombieVillager.class, SoundEvents.field_193823_fm);
|
||||
}
|
||||
+
|
||||
+ public static void registerMimicSound(Class<? extends Entity> cls, SoundEvent sound)
|
||||
+ {
|
||||
+ MIMIC_SOUNDS.put(cls, sound);
|
||||
+ }
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java
|
||||
@@ -46,7 +46,7 @@
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
-public class EntitySheep extends EntityAnimal
|
||||
+public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable
|
||||
{
|
||||
private static final DataParameter<Byte> field_184774_bv = EntityDataManager.<Byte>func_187226_a(EntitySheep.class, DataSerializers.field_187191_a);
|
||||
private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container()
|
||||
@@ -189,7 +189,7 @@
|
||||
{
|
||||
ItemStack itemstack = p_184645_1_.func_184586_b(p_184645_2_);
|
||||
|
||||
- if (itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_())
|
||||
+ if (false && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) //Forge: Moved to onSheared
|
||||
{
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
@@ -364,6 +364,21 @@
|
||||
return p_180482_2_;
|
||||
}
|
||||
|
||||
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.func_70892_o() && !this.func_70631_g_(); }
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
|
||||
+ {
|
||||
+ this.func_70893_e(true);
|
||||
+ int i = 1 + this.field_70146_Z.nextInt(3);
|
||||
+
|
||||
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
||||
+ for (int j = 0; j < i; ++j)
|
||||
+ ret.add(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, this.func_175509_cj().func_176765_a()));
|
||||
+
|
||||
+ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
private EnumDyeColor func_175511_a(EntityAnimal p_175511_1_, EntityAnimal p_175511_2_)
|
||||
{
|
||||
int i = ((EntitySheep)p_175511_1_).func_175509_cj().func_176767_b();
|
|
@ -1,204 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java
|
||||
@@ -109,7 +109,7 @@
|
||||
private boolean field_70959_by;
|
||||
private boolean field_175565_bs;
|
||||
private int field_70956_bz;
|
||||
- private String field_82189_bL;
|
||||
+ private java.util.UUID field_82189_bL;
|
||||
private int field_175563_bv;
|
||||
private int field_175562_bw;
|
||||
private boolean field_82190_bM;
|
||||
@@ -234,7 +234,7 @@
|
||||
if (this.field_70954_d != null && this.field_82189_bL != null)
|
||||
{
|
||||
this.field_70170_p.func_72960_a(this, (byte)14);
|
||||
- this.field_70954_d.func_82688_a(this.field_82189_bL, 1);
|
||||
+ this.field_70954_d.modifyPlayerReputation(this.field_82189_bL, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
itemstack.func_111282_a(p_184645_1_, this, p_184645_2_);
|
||||
return true;
|
||||
}
|
||||
- else if (!this.func_190669_a(itemstack, this.getClass()) && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_())
|
||||
+ else if (!this.func_190669_a(itemstack, this.getClass()) && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_184645_1_.func_70093_af())
|
||||
{
|
||||
if (this.field_70963_i == null)
|
||||
{
|
||||
@@ -327,6 +327,7 @@
|
||||
{
|
||||
super.func_70014_b(p_70014_1_);
|
||||
p_70014_1_.func_74768_a("Profession", this.func_70946_n());
|
||||
+ p_70014_1_.func_74778_a("ProfessionName", this.getProfessionForge().getRegistryName().toString());
|
||||
p_70014_1_.func_74768_a("Riches", this.field_70956_bz);
|
||||
p_70014_1_.func_74768_a("Career", this.field_175563_bv);
|
||||
p_70014_1_.func_74768_a("CareerLevel", this.field_175562_bw);
|
||||
@@ -356,6 +357,14 @@
|
||||
{
|
||||
super.func_70037_a(p_70037_1_);
|
||||
this.func_70938_b(p_70037_1_.func_74762_e("Profession"));
|
||||
+ if (p_70037_1_.func_74764_b("ProfessionName"))
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
|
||||
+ net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName")));
|
||||
+ if (p == null)
|
||||
+ p = net.minecraftforge.fml.common.registry.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer"));
|
||||
+ this.setProfession(p);
|
||||
+ }
|
||||
this.field_70956_bz = p_70037_1_.func_74762_e("Riches");
|
||||
this.field_175563_bv = p_70037_1_.func_74762_e("Career");
|
||||
this.field_175562_bw = p_70037_1_.func_74762_e("CareerLevel");
|
||||
@@ -412,13 +421,43 @@
|
||||
public void func_70938_b(int p_70938_1_)
|
||||
{
|
||||
this.field_70180_af.func_187227_b(field_184752_bw, Integer.valueOf(p_70938_1_));
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_70938_1_);
|
||||
}
|
||||
|
||||
+ @Deprecated //Use Forge Variant below
|
||||
public int func_70946_n()
|
||||
{
|
||||
- return Math.max(((Integer)this.field_70180_af.func_187225_a(field_184752_bw)).intValue() % 6, 0);
|
||||
+ return Math.max(((Integer)this.field_70180_af.func_187225_a(field_184752_bw)).intValue(), 0);
|
||||
}
|
||||
|
||||
+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof;
|
||||
+ public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
|
||||
+ {
|
||||
+ this.prof = prof;
|
||||
+ this.func_70938_b(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge()
|
||||
+ {
|
||||
+ if (this.prof == null)
|
||||
+ {
|
||||
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_70946_n());
|
||||
+ if (this.prof == null)
|
||||
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getById(0); //Farmer
|
||||
+ }
|
||||
+ return this.prof;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void func_184206_a(DataParameter<?> key)
|
||||
+ {
|
||||
+ super.func_184206_a(key);
|
||||
+ if (key.equals(field_184752_bw))
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_184752_bw));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public boolean func_70941_o()
|
||||
{
|
||||
return this.field_70952_f;
|
||||
@@ -456,7 +495,7 @@
|
||||
i = -3;
|
||||
}
|
||||
|
||||
- this.field_70954_d.func_82688_a(p_70604_1_.func_70005_c_(), i);
|
||||
+ this.field_70954_d.modifyPlayerReputation(p_70604_1_.func_110124_au(), i);
|
||||
|
||||
if (this.func_70089_S())
|
||||
{
|
||||
@@ -476,7 +515,7 @@
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
- this.field_70954_d.func_82688_a(entity.func_70005_c_(), -2);
|
||||
+ this.field_70954_d.modifyPlayerReputation(entity.func_110124_au(), -2);
|
||||
}
|
||||
else if (entity instanceof IMob)
|
||||
{
|
||||
@@ -569,7 +608,7 @@
|
||||
|
||||
if (this.field_70962_h != null)
|
||||
{
|
||||
- this.field_82189_bL = this.field_70962_h.func_70005_c_();
|
||||
+ this.field_82189_bL = this.field_70962_h.func_110124_au();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -617,15 +656,13 @@
|
||||
|
||||
private void func_175554_cu()
|
||||
{
|
||||
- EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()];
|
||||
-
|
||||
if (this.field_175563_bv != 0 && this.field_175562_bw != 0)
|
||||
{
|
||||
++this.field_175562_bw;
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.field_175563_bv = this.field_70146_Z.nextInt(aentityvillager$itradelist.length) + 1;
|
||||
+ this.field_175563_bv = this.getProfessionForge().getRandomCareer(this.field_70146_Z) + 1;
|
||||
this.field_175562_bw = 1;
|
||||
}
|
||||
|
||||
@@ -636,19 +673,13 @@
|
||||
|
||||
int i = this.field_175563_bv - 1;
|
||||
int j = this.field_175562_bw - 1;
|
||||
+ java.util.List<EntityVillager.ITradeList> trades = this.getProfessionForge().getCareer(i).getTrades(j);
|
||||
|
||||
- if (i >= 0 && i < aentityvillager$itradelist.length)
|
||||
+ if (trades != null)
|
||||
{
|
||||
- EntityVillager.ITradeList[][] aentityvillager$itradelist1 = aentityvillager$itradelist[i];
|
||||
-
|
||||
- if (j >= 0 && j < aentityvillager$itradelist1.length)
|
||||
+ for (EntityVillager.ITradeList entityvillager$itradelist : trades)
|
||||
{
|
||||
- EntityVillager.ITradeList[] aentityvillager$itradelist2 = aentityvillager$itradelist1[j];
|
||||
-
|
||||
- for (EntityVillager.ITradeList entityvillager$itradelist : aentityvillager$itradelist2)
|
||||
- {
|
||||
- entityvillager$itradelist.func_190888_a(this, this.field_70963_i, this.field_70146_Z);
|
||||
- }
|
||||
+ entityvillager$itradelist.func_190888_a(this, this.field_70963_i, this.field_70146_Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -758,7 +789,7 @@
|
||||
s1 = "nitwit";
|
||||
}
|
||||
|
||||
- if (s1 != null)
|
||||
+ s1 = this.getProfessionForge().getCareer(this.field_175563_bv-1).getName();
|
||||
{
|
||||
ITextComponent itextcomponent = new TextComponentTranslation("entity.Villager." + s1, new Object[0]);
|
||||
itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP());
|
||||
@@ -771,10 +802,6 @@
|
||||
|
||||
return itextcomponent;
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- return super.func_145748_c_();
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,7 +855,7 @@
|
||||
|
||||
if (p_190672_3_)
|
||||
{
|
||||
- this.func_70938_b(this.field_70170_p.field_73012_v.nextInt(6));
|
||||
+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v);
|
||||
}
|
||||
|
||||
this.func_175552_ct();
|
||||
@@ -1089,6 +1116,9 @@
|
||||
p_190888_2_.add(new MerchantRecipe(itemstack, itemstack1));
|
||||
}
|
||||
}
|
||||
+ //MODDERS DO NOT USE OR EDIT THIS IN ANY WAY IT WILL HAVE NO EFFECT, THIS IS JUST IN HERE TO ALLOW FORGE TO ACCESS IT
|
||||
+ @Deprecated
|
||||
+ public static ITradeList[][][][] GET_TRADES_DONT_USE(){ return field_175561_bA; }
|
||||
|
||||
public static class ListItemForEmeralds implements EntityVillager.ITradeList
|
||||
{
|
|
@ -1,26 +1,5 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java
|
||||
@@ -96,6 +96,12 @@
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public abstract class EntityPlayer extends EntityLivingBase
|
||||
{
|
||||
+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted";
|
||||
+ protected java.util.HashMap<Integer, BlockPos> spawnChunkMap = new java.util.HashMap<Integer, BlockPos>();
|
||||
+ protected java.util.HashMap<Integer, Boolean> spawnForcedMap = new java.util.HashMap<Integer, Boolean>();
|
||||
+ public float eyeHeight = this.getDefaultEyeHeight();
|
||||
+ public static final net.minecraft.entity.ai.attributes.IAttribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "generic.reachDistance", 5.0D, 0.0D, 1024.0D).func_111112_a(true);
|
||||
+
|
||||
private static final DataParameter<Float> field_184829_a = EntityDataManager.<Float>func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c);
|
||||
private static final DataParameter<Integer> field_184830_b = EntityDataManager.<Integer>func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b);
|
||||
protected static final DataParameter<Byte> field_184827_bp = EntityDataManager.<Byte>func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a);
|
||||
@@ -165,6 +171,7 @@
|
||||
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.10000000149011612D);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188790_f);
|
||||
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188792_h);
|
||||
+ this.func_110140_aT().func_111150_b(REACH_DISTANCE);
|
||||
}
|
||||
|
||||
protected void func_70088_a()
|
||||
@@ -180,6 +187,7 @@
|
||||
|
||||
public void func_70071_h_()
|
||||
|
@ -29,15 +8,6 @@
|
|||
this.field_70145_X = this.func_175149_v();
|
||||
|
||||
if (this.func_175149_v())
|
||||
@@ -207,7 +215,7 @@
|
||||
{
|
||||
this.func_70999_a(true, true, false);
|
||||
}
|
||||
- else if (this.field_70170_p.func_72935_r())
|
||||
+ else if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, this.field_71081_bT))
|
||||
{
|
||||
this.func_70999_a(false, true, true);
|
||||
}
|
||||
@@ -367,6 +375,7 @@
|
||||
this.func_70105_a(f, f1);
|
||||
}
|
||||
|
@ -46,131 +16,6 @@
|
|||
}
|
||||
|
||||
public int func_82145_z()
|
||||
@@ -454,11 +463,11 @@
|
||||
this.field_71109_bG = 0.0F;
|
||||
this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2);
|
||||
|
||||
- if (this.func_184187_bx() instanceof EntityPig)
|
||||
+ if (this.func_184187_bx() instanceof EntityLivingBase && ((EntityLivingBase)this.func_184187_bx()).shouldRiderFaceForward(this))
|
||||
{
|
||||
this.field_70125_A = f1;
|
||||
this.field_70177_z = f;
|
||||
- this.field_70761_aq = ((EntityPig)this.func_184187_bx()).field_70761_aq;
|
||||
+ this.field_70761_aq = ((EntityLivingBase)this.func_184187_bx()).field_70761_aq;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -609,11 +618,15 @@
|
||||
|
||||
public void func_70645_a(DamageSource p_70645_1_)
|
||||
{
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
|
||||
super.func_70645_a(p_70645_1_);
|
||||
this.func_70105_a(0.2F, 0.2F);
|
||||
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
||||
this.field_70181_x = 0.10000000149011612D;
|
||||
|
||||
+ captureDrops = true;
|
||||
+ capturedDrops.clear();
|
||||
+
|
||||
if ("Notch".equals(this.func_70005_c_()))
|
||||
{
|
||||
this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false);
|
||||
@@ -625,6 +638,9 @@
|
||||
this.field_71071_by.func_70436_m();
|
||||
}
|
||||
|
||||
+ captureDrops = false;
|
||||
+ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, capturedDrops, field_70718_bc > 0);
|
||||
+
|
||||
if (p_70645_1_ != null)
|
||||
{
|
||||
this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * 0.017453292F) * 0.1F);
|
||||
@@ -675,13 +691,24 @@
|
||||
@Nullable
|
||||
public EntityItem func_71040_bB(boolean p_71040_1_)
|
||||
{
|
||||
- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && !this.field_71071_by.func_70448_g().func_190926_b() ? this.field_71071_by.func_70448_g().func_190916_E() : 1), false, true);
|
||||
+ ItemStack stack = field_71071_by.func_70448_g();
|
||||
+
|
||||
+ if (stack.func_190926_b())
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
+ if (stack.func_77973_b().onDroppedByPlayer(stack, this))
|
||||
+ {
|
||||
+ int count = p_71040_1_ ? this.field_71071_by.func_70448_g().func_190916_E() : 1;
|
||||
+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, field_71071_by.func_70298_a(field_71071_by.field_70461_c, count), true);
|
||||
+ }
|
||||
+ return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public EntityItem func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_)
|
||||
{
|
||||
- return this.func_146097_a(p_71019_1_, false, p_71019_2_);
|
||||
+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -741,14 +768,22 @@
|
||||
|
||||
public ItemStack func_184816_a(EntityItem p_184816_1_)
|
||||
{
|
||||
+ if (captureDrops) capturedDrops.add(p_184816_1_);
|
||||
+ else // Forge: Don't indent to keep patch smaller.
|
||||
this.field_70170_p.func_72838_d(p_184816_1_);
|
||||
return p_184816_1_.func_92059_d();
|
||||
}
|
||||
|
||||
+ @Deprecated //Use location sensitive version below
|
||||
public float func_184813_a(IBlockState p_184813_1_)
|
||||
{
|
||||
- float f = this.field_71071_by.func_184438_a(p_184813_1_);
|
||||
+ return getDigSpeed(p_184813_1_, null);
|
||||
+ }
|
||||
|
||||
+ public float getDigSpeed(IBlockState state, BlockPos pos)
|
||||
+ {
|
||||
+ float f = this.field_71071_by.func_184438_a(state);
|
||||
+
|
||||
if (f > 1.0F)
|
||||
{
|
||||
int i = EnchantmentHelper.func_185293_e(this);
|
||||
@@ -798,12 +833,13 @@
|
||||
f /= 5.0F;
|
||||
}
|
||||
|
||||
- return f;
|
||||
+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos);
|
||||
+ return (f < 0 ? 0 : f);
|
||||
}
|
||||
|
||||
public boolean func_184823_b(IBlockState p_184823_1_)
|
||||
{
|
||||
- return this.field_71071_by.func_184432_b(p_184823_1_);
|
||||
+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_184823_1_, this.field_71071_by.func_184432_b(p_184823_1_));
|
||||
}
|
||||
|
||||
public static void func_189806_a(DataFixer p_189806_0_)
|
||||
@@ -863,6 +899,17 @@
|
||||
this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced");
|
||||
}
|
||||
|
||||
+ NBTTagList spawnlist = null;
|
||||
+ spawnlist = p_70037_1_.func_150295_c("Spawns", 10);
|
||||
+ for (int i = 0; i < spawnlist.func_74745_c(); i++)
|
||||
+ {
|
||||
+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.func_150305_b(i);
|
||||
+ int spawndim = spawndata.func_74762_e("Dim");
|
||||
+ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.func_74762_e("SpawnX"), spawndata.func_74762_e("SpawnY"), spawndata.func_74762_e("SpawnZ")));
|
||||
+ this.spawnForcedMap.put(spawndim, spawndata.func_74767_n("SpawnForced"));
|
||||
+ }
|
||||
+ this.spawnDimension = p_70037_1_.func_74767_n("HasSpawnDimensionSet") ? p_70037_1_.func_74762_e("SpawnDimension") : null;
|
||||
+
|
||||
this.field_71100_bB.func_75112_a(p_70037_1_);
|
||||
this.field_71075_bZ.func_75095_b(p_70037_1_);
|
||||
|
||||
@@ -896,6 +943,7 @@
|
||||
p_70014_1_.func_74768_a("XpTotal", this.field_71067_cb);
|
||||
p_70014_1_.func_74768_a("XpSeed", this.field_175152_f);
|
||||
|
@ -179,328 +24,6 @@
|
|||
|
||||
if (this.field_71077_c != null)
|
||||
{
|
||||
@@ -905,6 +953,27 @@
|
||||
p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d);
|
||||
}
|
||||
|
||||
+ NBTTagList spawnlist = new NBTTagList();
|
||||
+ for (java.util.Map.Entry<Integer, BlockPos> entry : this.spawnChunkMap.entrySet())
|
||||
+ {
|
||||
+ BlockPos spawn = entry.getValue();
|
||||
+ if (spawn == null) continue;
|
||||
+ Boolean forced = spawnForcedMap.get(entry.getKey());
|
||||
+ if (forced == null) forced = false;
|
||||
+ NBTTagCompound spawndata = new NBTTagCompound();
|
||||
+ spawndata.func_74768_a("Dim", entry.getKey());
|
||||
+ spawndata.func_74768_a("SpawnX", spawn.func_177958_n());
|
||||
+ spawndata.func_74768_a("SpawnY", spawn.func_177956_o());
|
||||
+ spawndata.func_74768_a("SpawnZ", spawn.func_177952_p());
|
||||
+ spawndata.func_74757_a("SpawnForced", forced);
|
||||
+ spawnlist.func_74742_a(spawndata);
|
||||
+ }
|
||||
+ p_70014_1_.func_74782_a("Spawns", spawnlist);
|
||||
+
|
||||
+ p_70014_1_.func_74757_a("HasSpawnDimensionSet", this.hasSpawnDimension());
|
||||
+ if (this.hasSpawnDimension())
|
||||
+ p_70014_1_.func_74768_a("SpawnDimension", this.getSpawnDimension());
|
||||
+
|
||||
this.field_71100_bB.func_75117_b(p_70014_1_);
|
||||
this.field_71075_bZ.func_75091_a(p_70014_1_);
|
||||
p_70014_1_.func_74782_a("EnderItems", this.field_71078_a.func_70487_g());
|
||||
@@ -922,6 +991,7 @@
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_)
|
||||
{
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_)) return false;
|
||||
if (this.func_180431_b(p_70097_1_))
|
||||
{
|
||||
return false;
|
||||
@@ -974,7 +1044,7 @@
|
||||
{
|
||||
super.func_190629_c(p_190629_1_);
|
||||
|
||||
- if (p_190629_1_.func_184614_ca().func_77973_b() instanceof ItemAxe)
|
||||
+ if (p_190629_1_.func_184614_ca().func_77973_b().canDisableShield(p_190629_1_.func_184614_ca(), this.func_184607_cu(), this, p_190629_1_))
|
||||
{
|
||||
this.func_190777_m(true);
|
||||
}
|
||||
@@ -1002,14 +1072,16 @@
|
||||
|
||||
protected void func_184590_k(float p_184590_1_)
|
||||
{
|
||||
- if (p_184590_1_ >= 3.0F && this.field_184627_bm.func_77973_b() == Items.field_185159_cQ)
|
||||
+ if (p_184590_1_ >= 3.0F && this.field_184627_bm.func_77973_b().isShield(this.field_184627_bm, this))
|
||||
{
|
||||
+ ItemStack copyBeforeUse = this.field_184627_bm.func_77946_l();
|
||||
int i = 1 + MathHelper.func_76141_d(p_184590_1_);
|
||||
this.field_184627_bm.func_77972_a(i, this);
|
||||
|
||||
if (this.field_184627_bm.func_190926_b())
|
||||
{
|
||||
EnumHand enumhand = this.func_184600_cs();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, copyBeforeUse, enumhand);
|
||||
|
||||
if (enumhand == EnumHand.MAIN_HAND)
|
||||
{
|
||||
@@ -1045,11 +1117,15 @@
|
||||
{
|
||||
if (!this.func_180431_b(p_70665_1_))
|
||||
{
|
||||
- p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
|
||||
+ if (p_70665_2_ <= 0) return;
|
||||
+ p_70665_2_ = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_);
|
||||
+ if (p_70665_2_ <= 0) return;
|
||||
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
|
||||
float f = p_70665_2_;
|
||||
p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
|
||||
this.func_110149_m(this.func_110139_bj() - (f - p_70665_2_));
|
||||
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_70665_1_, p_70665_2_);
|
||||
|
||||
if (p_70665_2_ != 0.0F)
|
||||
{
|
||||
@@ -1115,6 +1191,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_190775_1_, p_190775_2_);
|
||||
+ if (cancelResult != null) return cancelResult;
|
||||
ItemStack itemstack = this.func_184586_b(p_190775_2_);
|
||||
ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l();
|
||||
|
||||
@@ -1124,7 +1202,10 @@
|
||||
{
|
||||
itemstack.func_190920_e(itemstack1.func_190916_E());
|
||||
}
|
||||
-
|
||||
+ if (!this.field_71075_bZ.field_75098_d && itemstack.func_190926_b())
|
||||
+ {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_);
|
||||
+ }
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
else
|
||||
@@ -1140,6 +1221,7 @@
|
||||
{
|
||||
if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d)
|
||||
{
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_190775_2_);
|
||||
this.func_184611_a(p_190775_2_, ItemStack.field_190927_a);
|
||||
}
|
||||
|
||||
@@ -1165,6 +1247,7 @@
|
||||
|
||||
public void func_71059_n(Entity p_71059_1_)
|
||||
{
|
||||
+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return;
|
||||
if (p_71059_1_.func_70075_an())
|
||||
{
|
||||
if (!p_71059_1_.func_85031_j(this))
|
||||
@@ -1203,9 +1286,11 @@
|
||||
boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(MobEffects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof EntityLivingBase;
|
||||
flag2 = flag2 && !this.func_70051_ag();
|
||||
|
||||
+ net.minecraftforge.event.entity.player.CriticalHitEvent hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, p_71059_1_, flag2, flag2 ? 1.5F : 1.0F);
|
||||
+ flag2 = hitResult != null;
|
||||
if (flag2)
|
||||
{
|
||||
- f *= 1.5F;
|
||||
+ f *= hitResult.getDamageModifier();
|
||||
}
|
||||
|
||||
f = f + f1;
|
||||
@@ -1332,10 +1417,12 @@
|
||||
|
||||
if (!itemstack1.func_190926_b() && entity instanceof EntityLivingBase)
|
||||
{
|
||||
+ ItemStack beforeHitCopy = itemstack1.func_77946_l();
|
||||
itemstack1.func_77961_a((EntityLivingBase)entity, this);
|
||||
|
||||
if (itemstack1.func_190926_b())
|
||||
{
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, beforeHitCopy, EnumHand.MAIN_HAND);
|
||||
this.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a);
|
||||
}
|
||||
}
|
||||
@@ -1384,7 +1471,7 @@
|
||||
|
||||
if (this.field_70146_Z.nextFloat() < f)
|
||||
{
|
||||
- this.func_184811_cZ().func_185145_a(Items.field_185159_cQ, 100);
|
||||
+ this.func_184811_cZ().func_185145_a(this.func_184607_cu().func_77973_b(), 100);
|
||||
this.func_184602_cy();
|
||||
this.field_70170_p.func_72960_a(this, (byte)30);
|
||||
}
|
||||
@@ -1442,7 +1529,11 @@
|
||||
|
||||
public EntityPlayer.SleepResult func_180469_a(BlockPos p_180469_1_)
|
||||
{
|
||||
- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockHorizontal.field_185512_D);
|
||||
+ EntityPlayer.SleepResult ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, p_180469_1_);
|
||||
+ if (ret != null) return ret;
|
||||
+ final IBlockState state = this.field_70170_p.func_175667_e(p_180469_1_) ? this.field_70170_p.func_180495_p(p_180469_1_) : null;
|
||||
+ final boolean isBed = state != null && state.func_177230_c().isBed(state, this.field_70170_p, p_180469_1_, this);
|
||||
+ final EnumFacing enumfacing = isBed && state.func_177230_c() instanceof BlockHorizontal ? (EnumFacing)state.func_177229_b(BlockHorizontal.field_185512_D) : null;
|
||||
|
||||
if (!this.field_70170_p.field_72995_K)
|
||||
{
|
||||
@@ -1456,7 +1547,7 @@
|
||||
return EntityPlayer.SleepResult.NOT_POSSIBLE_HERE;
|
||||
}
|
||||
|
||||
- if (this.field_70170_p.func_72935_r())
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, this.field_71081_bT))
|
||||
{
|
||||
return EntityPlayer.SleepResult.NOT_POSSIBLE_NOW;
|
||||
}
|
||||
@@ -1484,8 +1575,7 @@
|
||||
this.func_192030_dh();
|
||||
this.func_70105_a(0.2F, 0.2F);
|
||||
|
||||
- if (this.field_70170_p.func_175667_e(p_180469_1_))
|
||||
- {
|
||||
+ if (enumfacing != null) {
|
||||
float f1 = 0.5F + (float)enumfacing.func_82601_c() * 0.4F;
|
||||
float f = 0.5F + (float)enumfacing.func_82599_e() * 0.4F;
|
||||
this.func_175139_a(enumfacing);
|
||||
@@ -1517,6 +1607,7 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
+ else if (p_190774_2_ == null) return false;
|
||||
else
|
||||
{
|
||||
BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d());
|
||||
@@ -1532,13 +1623,14 @@
|
||||
|
||||
public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_)
|
||||
{
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_);
|
||||
this.func_70105_a(0.6F, 1.8F);
|
||||
- IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT);
|
||||
+ IBlockState iblockstate = this.field_71081_bT == null ? null : this.field_70170_p.func_180495_p(this.field_71081_bT);
|
||||
|
||||
- if (this.field_71081_bT != null && iblockstate.func_177230_c() == Blocks.field_150324_C)
|
||||
+ if (this.field_71081_bT != null && iblockstate.func_177230_c().isBed(iblockstate, field_70170_p, field_71081_bT, this))
|
||||
{
|
||||
- this.field_70170_p.func_180501_a(this.field_71081_bT, iblockstate.func_177226_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4);
|
||||
- BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0);
|
||||
+ iblockstate.func_177230_c().setBedOccupied(field_70170_p, field_71081_bT, this, false);
|
||||
+ BlockPos blockpos = iblockstate.func_177230_c().getBedSpawnPosition(iblockstate, field_70170_p, field_71081_bT, this);
|
||||
|
||||
if (blockpos == null)
|
||||
{
|
||||
@@ -1547,6 +1639,10 @@
|
||||
|
||||
this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F));
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ p_70999_3_ = false;
|
||||
+ }
|
||||
|
||||
this.field_71083_bS = false;
|
||||
|
||||
@@ -1565,15 +1661,16 @@
|
||||
|
||||
private boolean func_175143_p()
|
||||
{
|
||||
- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() == Blocks.field_150324_C;
|
||||
+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, this.field_71081_bT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BlockPos func_180467_a(World p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_)
|
||||
{
|
||||
- Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c();
|
||||
+ IBlockState state = p_180467_0_.func_180495_p(p_180467_1_);
|
||||
+ Block block = state.func_177230_c();
|
||||
|
||||
- if (block != Blocks.field_150324_C)
|
||||
+ if (!block.isBed(state, p_180467_0_, p_180467_1_, null))
|
||||
{
|
||||
if (!p_180467_2_)
|
||||
{
|
||||
@@ -1588,16 +1685,17 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0);
|
||||
+ return block.getBedSpawnPosition(state, p_180467_0_, p_180467_1_, null);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float func_71051_bG()
|
||||
{
|
||||
- if (this.field_71081_bT != null)
|
||||
+ IBlockState state = this.field_71081_bT == null ? null : this.field_70170_p.func_180495_p(field_71081_bT);
|
||||
+ if (state != null && state.func_177230_c().isBed(state, field_70170_p, field_71081_bT, this))
|
||||
{
|
||||
- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockHorizontal.field_185512_D);
|
||||
+ EnumFacing enumfacing = state.func_177230_c().getBedDirection(state, field_70170_p, field_71081_bT);
|
||||
|
||||
switch (enumfacing)
|
||||
{
|
||||
@@ -1637,16 +1735,24 @@
|
||||
|
||||
public BlockPos func_180470_cg()
|
||||
{
|
||||
- return this.field_71077_c;
|
||||
+ return getBedLocation(this.field_71093_bK);
|
||||
}
|
||||
|
||||
+ @Deprecated // Use dimension-sensitive version.
|
||||
public boolean func_82245_bX()
|
||||
{
|
||||
- return this.field_82248_d;
|
||||
+ return isSpawnForced(this.field_71093_bK);
|
||||
}
|
||||
|
||||
public void func_180473_a(BlockPos p_180473_1_, boolean p_180473_2_)
|
||||
{
|
||||
+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_180473_1_, p_180473_2_)) return;
|
||||
+ if (this.field_71093_bK != 0)
|
||||
+ {
|
||||
+ setSpawnChunk(p_180473_1_, p_180473_2_, this.field_71093_bK);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (p_180473_1_ != null)
|
||||
{
|
||||
this.field_71077_c = p_180473_1_;
|
||||
@@ -1839,6 +1945,10 @@
|
||||
|
||||
super.func_180430_e(p_180430_1_, p_180430_2_);
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_180430_1_, p_180430_2_);
|
||||
+ }
|
||||
}
|
||||
|
||||
protected void func_71061_d_()
|
||||
@@ -2176,7 +2286,10 @@
|
||||
|
||||
public ITextComponent func_145748_c_()
|
||||
{
|
||||
- ITextComponent itextcomponent = new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_()));
|
||||
+ ITextComponent itextcomponent = new TextComponentString("");
|
||||
+ if (!prefixes.isEmpty()) for (ITextComponent prefix : prefixes) itextcomponent.func_150257_a(prefix);
|
||||
+ itextcomponent.func_150257_a(new TextComponentString(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayNameString())));
|
||||
+ if (!suffixes.isEmpty()) for (ITextComponent suffix : suffixes) itextcomponent.func_150257_a(suffix);
|
||||
itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " "));
|
||||
itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP());
|
||||
itextcomponent.func_150256_b().func_179989_a(this.func_70005_c_());
|
||||
@@ -2185,7 +2298,7 @@
|
||||
|
||||
public float func_70047_e()
|
||||
{
|
||||
- float f = 1.62F;
|
||||
+ float f = eyeHeight;
|
||||
|
||||
if (this.func_70608_bn())
|
||||
{
|
||||
@@ -2421,6 +2534,168 @@
|
||||
return this.field_71075_bZ.field_75098_d && this.func_70003_b(2, "");
|
||||
}
|
||||
|
@ -520,81 +43,9 @@
|
|||
+ {
|
||||
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+ /**
|
||||
+ * A dimension aware version of getBedLocation.
|
||||
+ * @param dimension The dimension to get the bed spawn for
|
||||
+ * @return The player specific spawn location for the dimension. May be null.
|
||||
+ */
|
||||
+ public BlockPos getBedLocation(int dimension)
|
||||
+ {
|
||||
+ return dimension == 0 ? field_71077_c : spawnChunkMap.get(dimension);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A dimension aware version of isSpawnForced.
|
||||
+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not.
|
||||
+ * This just extends that to be dimension aware.
|
||||
+ * @param dimension The dimension to get whether to check for a bed before spawning for
|
||||
+ * @return The player specific spawn location for the dimension. May be null.
|
||||
+ */
|
||||
+ public boolean isSpawnForced(int dimension)
|
||||
+ {
|
||||
+ if (dimension == 0) return this.field_82248_d;
|
||||
+ Boolean forced = this.spawnForcedMap.get(dimension);
|
||||
+ return forced == null ? false : forced;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A dimension aware version of setSpawnChunk.
|
||||
+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension.
|
||||
+ * @param pos The spawn point to set as the player-specific spawn point for the dimension
|
||||
+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed)
|
||||
+ * @param dimension Which dimension to apply the player-specific respawn point to
|
||||
+ */
|
||||
+ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension)
|
||||
+ {
|
||||
+ if (dimension == 0)
|
||||
+ {
|
||||
+ if (pos != null)
|
||||
+ {
|
||||
+ field_71077_c = pos;
|
||||
+ field_82248_d = forced;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ field_71077_c = null;
|
||||
+ field_82248_d = false;
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (pos != null)
|
||||
+ {
|
||||
+ spawnChunkMap.put(dimension, pos);
|
||||
+ spawnForcedMap.put(dimension, forced);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ spawnChunkMap.remove(dimension);
|
||||
+ spawnForcedMap.remove(dimension);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private String displayname;
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the default eye height of the player
|
||||
+ * @return player default eye height
|
||||
+ */
|
||||
+ public float getDefaultEyeHeight()
|
||||
+ {
|
||||
+ return 1.62F;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the currently computed display name, cached for efficiency.
|
||||
+ * @return the current display name
|
||||
+ */
|
||||
|
@ -615,24 +66,6 @@
|
|||
+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_());
|
||||
+ }
|
||||
+
|
||||
+ private final java.util.Collection<ITextComponent> prefixes = new java.util.LinkedList<ITextComponent>();
|
||||
+ private final java.util.Collection<ITextComponent> suffixes = new java.util.LinkedList<ITextComponent>();
|
||||
+
|
||||
+ /**
|
||||
+ * Add a prefix to the player's username in chat
|
||||
+ * @param prefix The prefix
|
||||
+ */
|
||||
+ public void addPrefix(ITextComponent prefix) { prefixes.add(prefix); }
|
||||
+
|
||||
+ /**
|
||||
+ * Add a suffix to the player's username in chat
|
||||
+ * @param suffix The suffix
|
||||
+ */
|
||||
+ public void addSuffix(ITextComponent suffix) { suffixes.add(suffix); }
|
||||
+
|
||||
+ public java.util.Collection<ITextComponent> getPrefixes() { return this.prefixes; }
|
||||
+ public java.util.Collection<ITextComponent> getSuffixes() { return this.suffixes; }
|
||||
+
|
||||
+ private final net.minecraftforge.items.IItemHandler playerMainHandler = new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by);
|
||||
+ private final net.minecraftforge.items.IItemHandler playerEquipmentHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(
|
||||
+ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by),
|
||||
|
@ -659,12 +92,6 @@
|
|||
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ private Integer spawnDimension;
|
||||
+ public boolean hasSpawnDimension() { return spawnDimension != null; }
|
||||
+ public int getSpawnDimension() { return spawnDimension != null ? spawnDimension : 0; }
|
||||
+ public void setSpawnDimension(@Nullable Integer dimension) { this.spawnDimension = dimension; }
|
||||
+
|
||||
+ /* ======================================== FORGE END =====================================*/
|
||||
+
|
||||
public static enum EnumChatVisibility
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java
|
||||
@@ -292,7 +292,8 @@
|
||||
|
||||
if (itemstack.func_190926_b())
|
||||
{
|
||||
- itemstack = new ItemStack(item, 0, p_191973_2_.func_77960_j());
|
||||
+ itemstack = p_191973_2_.func_77946_l(); // Forge: Replace Item clone above to preserve item capabilities when picking the item up.
|
||||
+ itemstack.func_190920_e(0);
|
||||
|
||||
if (p_191973_2_.func_77942_o())
|
||||
{
|
||||
@@ -363,6 +364,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+ for (ItemStack is : field_70460_b) // FORGE: Tick armor on animation ticks
|
||||
+ {
|
||||
+ if (!is.func_190926_b())
|
||||
+ {
|
||||
+ is.func_77973_b().onArmorTick(field_70458_d.field_70170_p, field_70458_d, is);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
public boolean func_70441_a(ItemStack p_70441_1_)
|
||||
@@ -444,6 +452,8 @@
|
||||
CrashReportCategory crashreportcategory = crashreport.func_85058_a("Item being added");
|
||||
crashreportcategory.func_71507_a("Item ID", Integer.valueOf(Item.func_150891_b(p_191971_2_.func_77973_b())));
|
||||
crashreportcategory.func_71507_a("Item data", Integer.valueOf(p_191971_2_.func_77960_j()));
|
||||
+ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_191971_2_.func_77973_b().getRegistryName()));
|
||||
+ crashreportcategory.func_189529_a("Item Class", () -> p_191971_2_.func_77973_b().getClass().getName());
|
||||
crashreportcategory.func_189529_a("Item name", new ICrashReportDetail<String>()
|
||||
{
|
||||
public String call() throws Exception
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityArrow.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityArrow.java
|
||||
@@ -262,7 +262,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (raytraceresult != null)
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult))
|
||||
{
|
||||
this.func_184549_a(raytraceresult);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFireball.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFireball.java
|
||||
@@ -93,7 +93,7 @@
|
||||
++this.field_70234_an;
|
||||
RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, this.field_70234_an >= 25, this.field_70235_a);
|
||||
|
||||
- if (raytraceresult != null)
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult))
|
||||
{
|
||||
this.func_70227_a(raytraceresult);
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java
|
||||
@@ -269,8 +269,8 @@
|
||||
{
|
||||
ItemStack itemstack = this.field_146042_b.func_184614_ca();
|
||||
ItemStack itemstack1 = this.field_146042_b.func_184592_cb();
|
||||
- boolean flag = itemstack.func_77973_b() == Items.field_151112_aM;
|
||||
- boolean flag1 = itemstack1.func_77973_b() == Items.field_151112_aM;
|
||||
+ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod;
|
||||
+ boolean flag1 = itemstack1.func_77973_b() instanceof net.minecraft.item.ItemFishingRod;
|
||||
|
||||
if (!this.field_146042_b.field_70128_L && this.field_146042_b.func_70089_S() && (flag || flag1) && this.func_70068_e(this.field_146042_b) <= 1024.0D)
|
||||
{
|
||||
@@ -416,9 +416,9 @@
|
||||
double d0 = this.field_70165_t + (double)(f1 * (float)this.field_146038_az * 0.1F);
|
||||
double d1 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F);
|
||||
double d2 = this.field_70161_v + (double)(f2 * (float)this.field_146038_az * 0.1F);
|
||||
- Block block = worldserver.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2)).func_177230_c();
|
||||
+ IBlockState state = worldserver.func_180495_p(new BlockPos(d0, d1 - 1.0D, d2));
|
||||
|
||||
- if (block == Blocks.field_150355_j || block == Blocks.field_150358_i)
|
||||
+ if (state.func_185904_a() == Material.field_151586_h)
|
||||
{
|
||||
if (this.field_70146_Z.nextFloat() < 0.15F)
|
||||
{
|
||||
@@ -466,9 +466,9 @@
|
||||
double d4 = this.field_70165_t + (double)(MathHelper.func_76126_a(f6) * f7 * 0.1F);
|
||||
double d5 = (double)((float)MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) + 1.0F);
|
||||
double d6 = this.field_70161_v + (double)(MathHelper.func_76134_b(f6) * f7 * 0.1F);
|
||||
- Block block1 = worldserver.func_180495_p(new BlockPos((int)d4, (int)d5 - 1, (int)d6)).func_177230_c();
|
||||
+ IBlockState state = worldserver.func_180495_p(new BlockPos((int) d4, (int) d5 - 1, (int) d6));
|
||||
|
||||
- if (block1 == Blocks.field_150355_j || block1 == Blocks.field_150358_i)
|
||||
+ if (state.func_185904_a() == Material.field_151586_h)
|
||||
{
|
||||
worldserver.func_175739_a(EnumParticleTypes.WATER_SPLASH, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D);
|
||||
}
|
||||
@@ -506,6 +506,7 @@
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
+ net.minecraftforge.event.entity.player.ItemFishedEvent event = null;
|
||||
if (this.field_146043_c != null)
|
||||
{
|
||||
this.func_184527_k();
|
||||
@@ -515,9 +516,17 @@
|
||||
else if (this.field_146045_ax > 0)
|
||||
{
|
||||
LootContext.Builder lootcontext$builder = new LootContext.Builder((WorldServer)this.field_70170_p);
|
||||
- lootcontext$builder.func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da());
|
||||
+ lootcontext$builder.func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da()).func_186470_a(this.field_146042_b).func_186472_a(this); // Forge: add player & looted entity to LootContext
|
||||
+ List<ItemStack> result = this.field_70170_p.func_184146_ak().func_186521_a(LootTableList.field_186387_al).func_186462_a(this.field_70146_Z, lootcontext$builder.func_186471_a());
|
||||
+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(result, this.field_146051_au ? 2 : 1, this);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
|
||||
+ if (event.isCanceled())
|
||||
+ {
|
||||
+ this.func_70106_y();
|
||||
+ return event.getRodDamage();
|
||||
+ }
|
||||
|
||||
- for (ItemStack itemstack : this.field_70170_p.func_184146_ak().func_186521_a(LootTableList.field_186387_al).func_186462_a(this.field_70146_Z, lootcontext$builder.func_186471_a()))
|
||||
+ for (ItemStack itemstack : result)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u, this.field_70161_v, itemstack);
|
||||
double d0 = this.field_146042_b.field_70165_t - this.field_70165_t;
|
||||
@@ -547,7 +556,7 @@
|
||||
}
|
||||
|
||||
this.func_70106_y();
|
||||
- return i;
|
||||
+ return event == null ? i : event.getRodDamage();
|
||||
}
|
||||
else
|
||||
{
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java
|
||||
@@ -40,7 +40,7 @@
|
||||
this.func_174815_a(this.field_70235_a, p_70227_1_.field_72308_g);
|
||||
}
|
||||
|
||||
- boolean flag = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing");
|
||||
+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a);
|
||||
this.field_70170_p.func_72885_a((Entity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, (float)this.field_92057_e, flag, flag);
|
||||
this.func_70106_y();
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityLlamaSpit.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityLlamaSpit.java
|
||||
@@ -80,7 +80,7 @@
|
||||
raytraceresult = new RayTraceResult(entity);
|
||||
}
|
||||
|
||||
- if (raytraceresult != null)
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult))
|
||||
{
|
||||
this.func_190536_a(raytraceresult);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityShulkerBullet.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityShulkerBullet.java
|
||||
@@ -310,7 +310,7 @@
|
||||
|
||||
RayTraceResult raytraceresult = ProjectileHelper.func_188802_a(this, true, false, this.field_184570_a);
|
||||
|
||||
- if (raytraceresult != null)
|
||||
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult))
|
||||
{
|
||||
this.func_184567_a(raytraceresult);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
if (this.field_70235_a != null && this.field_70235_a instanceof EntityLiving)
|
||||
{
|
||||
- flag1 = this.field_70170_p.func_82736_K().func_82766_b("mobGriefing");
|
||||
+ flag1 = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a);
|
||||
}
|
||||
|
||||
if (flag1)
|
|
@ -1,11 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityThrowable.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityThrowable.java
|
||||
@@ -244,7 +244,7 @@
|
||||
{
|
||||
this.func_181015_d(raytraceresult.func_178782_a());
|
||||
}
|
||||
- else
|
||||
+ else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult))
|
||||
{
|
||||
this.func_70184_a(raytraceresult);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java
|
||||
@@ -62,7 +62,7 @@
|
||||
float f = super.func_180428_a(p_180428_1_, p_180428_2_, p_180428_3_, p_180428_4_);
|
||||
Block block = p_180428_4_.func_177230_c();
|
||||
|
||||
- if (this.func_82342_d() && EntityWither.func_181033_a(block))
|
||||
+ if (this.func_82342_d() && block.canEntityDestroy(p_180428_4_, p_180428_2_, p_180428_3_, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this.field_70235_a, p_180428_3_, p_180428_4_))
|
||||
{
|
||||
f = Math.min(0.8F, f);
|
||||
}
|
||||
@@ -115,7 +115,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"));
|
||||
+ this.field_70170_p.func_72885_a(this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0F, false, net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this.field_70235_a));
|
||||
this.func_70106_y();
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
--- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java
|
||||
@@ -79,15 +79,17 @@
|
||||
{
|
||||
if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_))
|
||||
{
|
||||
- int k4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a());
|
||||
+ int k4 = p_77192_1_.countEntities(enumcreaturetype, true);
|
||||
int l4 = enumcreaturetype.func_75601_b() * i / field_180268_a;
|
||||
|
||||
if (k4 <= l4)
|
||||
{
|
||||
+ java.util.ArrayList<ChunkPos> shuffled = com.google.common.collect.Lists.newArrayList(this.field_77193_b);
|
||||
+ java.util.Collections.shuffle(shuffled);
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||
label134:
|
||||
|
||||
- for (ChunkPos chunkpos1 : this.field_77193_b)
|
||||
+ for (ChunkPos chunkpos1 : shuffled)
|
||||
{
|
||||
BlockPos blockpos = func_180621_a(p_77192_1_, chunkpos1.field_77276_a, chunkpos1.field_77275_b);
|
||||
int k1 = blockpos.func_177958_n();
|
||||
@@ -136,7 +138,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
- entityliving = biome$spawnlistentry.field_76300_b.getConstructor(World.class).newInstance(p_77192_1_);
|
||||
+ entityliving = biome$spawnlistentry.newInstance(p_77192_1_);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -146,8 +148,10 @@
|
||||
|
||||
entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
|
||||
|
||||
- if (entityliving.func_70601_bi() && entityliving.func_70058_J())
|
||||
+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, i3, f1, false);
|
||||
+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.func_70601_bi() && entityliving.func_70058_J())))
|
||||
{
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f, i3, f1))
|
||||
ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata);
|
||||
|
||||
if (entityliving.func_70058_J())
|
||||
@@ -160,7 +164,7 @@
|
||||
entityliving.func_70106_y();
|
||||
}
|
||||
|
||||
- if (j2 >= entityliving.func_70641_bl())
|
||||
+ if (j2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving))
|
||||
{
|
||||
continue label134;
|
||||
}
|
||||
@@ -219,6 +223,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ return p_180267_0_.canSpawnAt(p_180267_1_, p_180267_2_);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean canCreatureTypeSpawnBody(EntityLiving.SpawnPlacementType p_180267_0_, World p_180267_1_, BlockPos p_180267_2_)
|
||||
+ {
|
||||
+ {
|
||||
IBlockState iblockstate = p_180267_1_.func_180495_p(p_180267_2_);
|
||||
|
||||
if (p_180267_0_ == EntityLiving.SpawnPlacementType.IN_WATER)
|
||||
@@ -228,8 +239,9 @@
|
||||
else
|
||||
{
|
||||
BlockPos blockpos = p_180267_2_.func_177977_b();
|
||||
+ IBlockState state = p_180267_1_.func_180495_p(blockpos);
|
||||
|
||||
- if (!p_180267_1_.func_180495_p(blockpos).func_185896_q())
|
||||
+ if (!state.func_177230_c().canCreatureSpawn(state, p_180267_1_, blockpos, p_180267_0_))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -273,7 +285,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
- entityliving = biome$spawnlistentry.field_76300_b.getConstructor(World.class).newInstance(p_77191_0_);
|
||||
+ entityliving = biome$spawnlistentry.newInstance(p_77191_0_);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@@ -281,6 +293,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77191_0_, j + 0.5f, (float) blockpos.func_177956_o(), k +0.5f, false) == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) continue;
|
||||
entityliving.func_70012_b((double)((float)j + 0.5F), (double)blockpos.func_177956_o(), (double)((float)k + 0.5F), p_77191_6_.nextFloat() * 360.0F, 0.0F);
|
||||
p_77191_0_.func_72838_d(entityliving);
|
||||
ientitylivingdata = entityliving.func_180482_a(p_77191_0_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata);
|
|
@ -186,25 +186,6 @@
|
|||
+ * @see net.minecraft.client.renderer.EntityRenderer#updateLightmap(float)
|
||||
+ */
|
||||
+ public void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors) {}
|
||||
+
|
||||
+ public BlockPos getRandomizedSpawnPoint()
|
||||
+ {
|
||||
+ BlockPos ret = this.field_76579_a.func_175694_M();
|
||||
+
|
||||
+ boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == GameType.ADVENTURE;
|
||||
+ int spawnFuzz = this.field_76579_a instanceof WorldServer ? field_76577_b.getSpawnFuzz((WorldServer)this.field_76579_a, this.field_76579_a.func_73046_m()) : 1;
|
||||
+ int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p()));
|
||||
+ if (border < spawnFuzz) spawnFuzz = border;
|
||||
+
|
||||
+ if (!func_177495_o() && !isAdventure && spawnFuzz != 0)
|
||||
+ {
|
||||
+ if (spawnFuzz < 2) spawnFuzz = 2;
|
||||
+ int spawnFuzzHalf = spawnFuzz / 2;
|
||||
+ ret = field_76579_a.func_175672_r(ret.func_177982_a(spawnFuzzHalf - field_76579_a.field_73012_v.nextInt(spawnFuzz), 0, spawnFuzzHalf - field_76579_a.field_73012_v.nextInt(spawnFuzz)));
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.
|
||||
+ *
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.awt.Color;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
|
@ -54,11 +53,9 @@ import net.minecraft.util.StringUtils;
|
|||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -299,7 +296,7 @@ public class GuiIngameForge extends GuiIngame
|
|||
int left = width / 2 - 91;
|
||||
int top = height - left_height;
|
||||
|
||||
int level = ForgeHooks.getTotalArmorValue(mc.player);
|
||||
int level = mc.player.getTotalArmorValue();
|
||||
for (int i = 1; level > 0 && i < 20; i += 2)
|
||||
{
|
||||
if (i < level)
|
||||
|
|
|
@ -61,6 +61,7 @@ import net.minecraft.client.gui.GuiScreen;
|
|||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityMinecartContainer;
|
||||
|
@ -101,6 +102,7 @@ import net.minecraft.resources.IResourceManager;
|
|||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tileentity.MobSpawnerBaseLogic;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
|
@ -124,6 +126,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.storage.loot.LootEntry;
|
||||
import net.minecraft.world.storage.loot.LootTable;
|
||||
import net.minecraft.world.storage.loot.LootTableManager;
|
||||
|
@ -155,6 +158,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||
import net.minecraftforge.event.entity.player.AdvancementEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.NoteBlockEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
@ -281,20 +285,6 @@ public class ForgeHooks
|
|||
blockToolSetter.accept(block, ToolType.PICKAXE, 1);
|
||||
}
|
||||
|
||||
public static int getTotalArmorValue(EntityPlayer player)
|
||||
{
|
||||
int ret = player.getTotalArmorValue();
|
||||
for (int x = 0; x < player.inventory.armorInventory.size(); x++)
|
||||
{
|
||||
ItemStack stack = player.inventory.armorInventory.get(x);
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
ret += ((ISpecialArmor)stack.getItem()).getArmorDisplay(player, stack, x);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player uses 'pick block', calls new Entity and Block hooks.
|
||||
*/
|
||||
|
@ -1162,4 +1152,9 @@ public class ForgeHooks
|
|||
return -1;
|
||||
return event.getVanillaNoteId();
|
||||
}
|
||||
|
||||
public static int canEntitySpawn(EntityLiving entity, IWorld world, float x, float y, float z, MobSpawnerBaseLogic spawner) {
|
||||
Result res = ForgeEventFactory.canEntitySpawn(entity, world, x, y, z, null);
|
||||
return res == Result.DEFAULT ? 0 : res == Result.DENY ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,396 +0,0 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.util.CombatRules;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* This interface is to be implemented by ItemArmor classes. It will allow to
|
||||
* modify computation of damage and health loss. Computation will be called
|
||||
* before the actual armor computation, which can then be cancelled.
|
||||
*
|
||||
* @see ItemArmor
|
||||
*/
|
||||
public interface ISpecialArmor
|
||||
{
|
||||
//TODO: Change 'int slot' to EnumArmorType
|
||||
/**
|
||||
* Retrieves the modifiers to be used when calculating armor damage.
|
||||
*
|
||||
* Armor will higher priority will have damage applied to them before
|
||||
* lower priority ones. If there are multiple pieces of armor with the
|
||||
* same priority, damage will be distributed between them based on there
|
||||
* absorption ratio.
|
||||
*
|
||||
* @param player The entity wearing the armor.
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param source The source of the damage, which can be used to alter armor
|
||||
* properties based on the type or source of damage.
|
||||
* @param damage The total damage being applied to the entity
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return A ArmorProperties instance holding information about how the armor effects damage.
|
||||
*/
|
||||
ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot);
|
||||
|
||||
/**
|
||||
* Get the displayed effective armor.
|
||||
*
|
||||
* @param player The player wearing the armor.
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return The number of armor points for display, 2 per shield.
|
||||
*/
|
||||
int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot);
|
||||
|
||||
/**
|
||||
* Applies damage to the ItemStack. The mod is responsible for reducing the
|
||||
* item durability and stack size. If the stack is depleted it will be cleaned
|
||||
* up automatically.
|
||||
*
|
||||
* @param entity The entity wearing the armor
|
||||
* @param stack The ItemStack of the armor item itself.
|
||||
* @param source The source of the damage, which can be used to alter armor
|
||||
* properties based on the type or source of damage.
|
||||
* @param damage The amount of damage being applied to the armor
|
||||
* @param slot The armor slot the item is in.
|
||||
*/
|
||||
void damageArmor(EntityLivingBase entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot);
|
||||
|
||||
/**
|
||||
* Simple check to see if the armor should interact with "Unblockable" damage
|
||||
* sources. A fair number of vanilla damage sources have this tag, such as
|
||||
* Anvils, Falling, Fire, and Magic.
|
||||
*
|
||||
* Returning true here means that the armor is able to meaningfully respond
|
||||
* to this damage source. Otherwise, no interaction is allowed.
|
||||
*/
|
||||
default boolean handleUnblockableDamage(EntityLivingBase entity, @Nonnull ItemStack armor, DamageSource source, double damage, int slot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class ArmorProperties implements Comparable<ArmorProperties>
|
||||
{
|
||||
public int Priority = 0;
|
||||
public int AbsorbMax = Integer.MAX_VALUE;
|
||||
public double AbsorbRatio = 0;
|
||||
public double Armor = 0; //Additional armor, separate from the armor added by vanilla attributes.
|
||||
public double Toughness = 0; //Additional toughness, separate from the armor added by vanilla attributes.
|
||||
public int Slot = 0;
|
||||
private static final boolean DEBUG = false; //Only enable this if you wish to be spammed with debugging information.
|
||||
//Left it in because I figured it'd be useful for modders developing custom armor.
|
||||
|
||||
|
||||
public ArmorProperties(int priority, double ratio, int max)
|
||||
{
|
||||
Priority = priority;
|
||||
AbsorbRatio = ratio;
|
||||
Armor = 0;
|
||||
Toughness = 0;
|
||||
AbsorbMax = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gathers and applies armor reduction to damage being dealt to a entity.
|
||||
*
|
||||
* @param entity The Entity being damage
|
||||
* @param inventory An array of armor items
|
||||
* @param source The damage source type
|
||||
* @param damage The total damage being done
|
||||
* @return The left over damage that has not been absorbed by the armor
|
||||
*/
|
||||
public static float applyArmor(EntityLivingBase entity, NonNullList<ItemStack> inventory, DamageSource source, double damage)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Start: " + damage);
|
||||
}
|
||||
|
||||
double totalArmor = entity.getTotalArmorValue();
|
||||
double totalToughness = entity.getAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getValue();
|
||||
|
||||
if (source.isUnblockable())
|
||||
{
|
||||
totalArmor = 0;
|
||||
totalToughness = 0;
|
||||
}
|
||||
|
||||
ArrayList<ArmorProperties> dmgVals = new ArrayList<ArmorProperties>();
|
||||
for (int slot = 0; slot < inventory.size(); slot++)
|
||||
{
|
||||
ItemStack stack = inventory.get(slot);
|
||||
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ArmorProperties prop = null;
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
if (!source.isUnblockable() || ((ISpecialArmor) stack.getItem()).handleUnblockableDamage(entity, stack, source, damage, slot)) {
|
||||
ISpecialArmor armor = (ISpecialArmor)stack.getItem();
|
||||
prop = armor.getProperties(entity, stack, source, damage, slot).copy();
|
||||
totalArmor += prop.Armor;
|
||||
totalToughness += prop.Toughness;
|
||||
}
|
||||
}
|
||||
else if (stack.getItem() instanceof ItemArmor && !source.isUnblockable())
|
||||
{
|
||||
ItemArmor armor = (ItemArmor)stack.getItem();
|
||||
prop = new ArmorProperties(0, 0, Integer.MAX_VALUE);
|
||||
prop.Armor = armor.getDamageReduceAmount();
|
||||
prop.Toughness = armor.getToughness();
|
||||
}
|
||||
if (prop != null)
|
||||
{
|
||||
prop.Slot = slot;
|
||||
dmgVals.add(prop);
|
||||
}
|
||||
}
|
||||
if (dmgVals.size() > 0)
|
||||
{
|
||||
ArmorProperties[] props = dmgVals.toArray(new ArmorProperties[dmgVals.size()]);
|
||||
StandardizeList(props, damage);
|
||||
int level = props[0].Priority;
|
||||
double ratio = 0;
|
||||
for (ArmorProperties prop : props)
|
||||
{
|
||||
if (level != prop.Priority)
|
||||
{
|
||||
damage -= (damage * ratio);
|
||||
ratio = 0;
|
||||
level = prop.Priority;
|
||||
}
|
||||
ratio += prop.AbsorbRatio;
|
||||
|
||||
double absorb = damage * prop.AbsorbRatio;
|
||||
if (absorb > 0)
|
||||
{
|
||||
ItemStack stack = inventory.get(prop.Slot);
|
||||
int itemDamage = (int)Math.max(1, absorb);
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
((ISpecialArmor)stack.getItem()).damageArmor(entity, stack, source, itemDamage, prop.Slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Item: " + stack.toString() + " Absorbed: " + absorb + " Damaged: " + itemDamage);
|
||||
}
|
||||
stack.damageItem(itemDamage, entity);
|
||||
}
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
/*if (entity instanceof EntityPlayer)
|
||||
{
|
||||
stack.onItemDestroyedByUse((EntityPlayer)entity);
|
||||
}*/
|
||||
inventory.set(prop.Slot, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
damage -= (damage * ratio);
|
||||
}
|
||||
if (damage > 0 && (totalArmor > 0 || totalToughness > 0))
|
||||
{
|
||||
double armorDamage = Math.max(1.0F, damage / 4.0F);
|
||||
|
||||
for (int i = 0; i < inventory.size(); i++)
|
||||
{
|
||||
if (inventory.get(i).getItem() instanceof ItemArmor)
|
||||
{
|
||||
inventory.get(i).damageItem((int)armorDamage, entity);
|
||||
|
||||
if (inventory.get(i).getCount() == 0)
|
||||
{
|
||||
inventory.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
damage = CombatRules.getDamageAfterAbsorb((float)damage, (float)totalArmor, (float)totalToughness);
|
||||
}
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Return: " + (int)(damage) + " " + damage);
|
||||
}
|
||||
return (float)(damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts and standardizes the distribution of damage over armor.
|
||||
*
|
||||
* @param armor The armor information
|
||||
* @param damage The total damage being received
|
||||
*/
|
||||
private static void StandardizeList(ArmorProperties[] armor, double damage)
|
||||
{
|
||||
Arrays.sort(armor);
|
||||
|
||||
int start = 0;
|
||||
double total = 0;
|
||||
int priority = armor[0].Priority;
|
||||
int pStart = 0;
|
||||
boolean pChange = false;
|
||||
boolean pFinished = false;
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
for (ArmorProperties prop : armor)
|
||||
{
|
||||
System.out.println(prop);
|
||||
}
|
||||
System.out.println("========================");
|
||||
}
|
||||
|
||||
for (int x = 0; x < armor.length; x++)
|
||||
{
|
||||
total += armor[x].AbsorbRatio;
|
||||
if (x == armor.length - 1 || armor[x].Priority != priority)
|
||||
{
|
||||
if (armor[x].Priority != priority)
|
||||
{
|
||||
total -= armor[x].AbsorbRatio;
|
||||
x--;
|
||||
pChange = true;
|
||||
}
|
||||
if (total > 1)
|
||||
{
|
||||
for (int y = start; y <= x; y++)
|
||||
{
|
||||
double newRatio = armor[y].AbsorbRatio / total;
|
||||
if (newRatio * damage > armor[y].AbsorbMax)
|
||||
{
|
||||
armor[y].AbsorbRatio = (double)armor[y].AbsorbMax / damage;
|
||||
total = 0;
|
||||
for (int z = pStart; z <= y; z++)
|
||||
{
|
||||
total += armor[z].AbsorbRatio;
|
||||
}
|
||||
start = y + 1;
|
||||
x = y;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
armor[y].AbsorbRatio = newRatio;
|
||||
pFinished = true;
|
||||
}
|
||||
}
|
||||
if (pChange && pFinished)
|
||||
{
|
||||
damage -= (damage * total);
|
||||
total = 0;
|
||||
start = x + 1;
|
||||
priority = armor[start].Priority;
|
||||
pStart = start;
|
||||
pChange = false;
|
||||
pFinished = false;
|
||||
if (damage <= 0)
|
||||
{
|
||||
for (int y = x + 1; y < armor.length; y++)
|
||||
{
|
||||
armor[y].AbsorbRatio = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = start; y <= x; y++)
|
||||
{
|
||||
total -= armor[y].AbsorbRatio;
|
||||
if (damage * armor[y].AbsorbRatio > armor[y].AbsorbMax)
|
||||
{
|
||||
armor[y].AbsorbRatio = (double)armor[y].AbsorbMax / damage;
|
||||
}
|
||||
total += armor[y].AbsorbRatio;
|
||||
}
|
||||
damage -= (damage * total);
|
||||
total = 0;
|
||||
if (x != armor.length - 1)
|
||||
{
|
||||
start = x + 1;
|
||||
priority = armor[start].Priority;
|
||||
pStart = start;
|
||||
pChange = false;
|
||||
if (damage <= 0)
|
||||
{
|
||||
for (int y = x + 1; y < armor.length; y++)
|
||||
{
|
||||
armor[y].AbsorbRatio = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DEBUG)
|
||||
{
|
||||
for (ArmorProperties prop : armor)
|
||||
{
|
||||
System.out.println(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ArmorProperties o)
|
||||
{
|
||||
if (o.Priority != Priority)
|
||||
{
|
||||
return o.Priority - Priority;
|
||||
}
|
||||
double left = ( AbsorbRatio == 0 ? 0 : AbsorbMax * 100.0D / AbsorbRatio);
|
||||
double right = (o.AbsorbRatio == 0 ? 0 : o.AbsorbMax * 100.0D / o.AbsorbRatio);
|
||||
return (int)(left - right);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%d, %d, %f, %d", Priority, AbsorbMax, AbsorbRatio, (AbsorbRatio == 0 ? 0 : (int)(AbsorbMax * 100.0D / AbsorbRatio)));
|
||||
}
|
||||
|
||||
public ArmorProperties copy()
|
||||
{
|
||||
ArmorProperties copy = new ArmorProperties(Priority, AbsorbRatio, AbsorbMax);
|
||||
copy.Armor = Armor;
|
||||
copy.Toughness = Toughness;
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,8 +31,10 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntitySpawnPlacementRegistry;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -258,9 +260,9 @@ public interface IForgeBlock
|
|||
* @param player The player or camera entity, null in some cases.
|
||||
* @return True to treat this as a bed
|
||||
*/
|
||||
default boolean isBed(IBlockState state, IWorldReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
default boolean isBed(IBlockState state, IBlockReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
{
|
||||
return this.getBlock() instanceof BlockBed;
|
||||
return this.getBlock() instanceof BlockBed; //TODO: Forge: Keep isBed function?
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -273,9 +275,9 @@ public interface IForgeBlock
|
|||
* @param type The Mob Category Type
|
||||
* @return True to allow a mob of the specified category to spawn, false to prevent it.
|
||||
*/
|
||||
default boolean canCreatureSpawn(IBlockState state, IWorldReader world, BlockPos pos, EntitySpawnPlacementRegistry.SpawnPlacementType type)
|
||||
default boolean canCreatureSpawn(IBlockState state, IWorldReaderBase world, BlockPos pos, EntitySpawnPlacementRegistry.SpawnPlacementType type, @Nullable EntityType<? extends EntityLiving> entityType)
|
||||
{
|
||||
return state.isTopSolid();
|
||||
return state.isTopSolid() || entityType != null && EntitySpawnPlacementRegistry.func_209345_a(entityType, state);
|
||||
}
|
||||
/**
|
||||
* Returns the position that the player is moved to upon
|
||||
|
@ -288,7 +290,7 @@ public interface IForgeBlock
|
|||
* @return The spawn position
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPos getBedSpawnPosition(IBlockState state, IWorldReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
default BlockPos getBedSpawnPosition(IBlockState state, IBlockReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
{
|
||||
if (world instanceof World)
|
||||
{
|
||||
|
|
|
@ -27,16 +27,16 @@ import net.minecraft.block.*;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntitySpawnPlacementRegistry.SpawnPlacementType;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.pathfinding.PathNodeType;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -219,7 +219,7 @@ public interface IForgeBlockState
|
|||
* @param player The player or camera entity, null in some cases.
|
||||
* @return True to treat this as a bed
|
||||
*/
|
||||
default boolean isBed(IWorldReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
default boolean isBed(IBlockReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
{
|
||||
return getBlockState().getBlock().isBed(getBlockState(), world, pos, player);
|
||||
}
|
||||
|
@ -233,9 +233,9 @@ public interface IForgeBlockState
|
|||
* @param type The Mob Category Type
|
||||
* @return True to allow a mob of the specified category to spawn, false to prevent it.
|
||||
*/
|
||||
default boolean canCreatureSpawn(IWorldReader world, BlockPos pos, SpawnPlacementType type)
|
||||
default boolean canCreatureSpawn(IWorldReaderBase world, BlockPos pos, SpawnPlacementType type, EntityType<? extends EntityLiving> entityType)
|
||||
{
|
||||
return getBlockState().getBlock().canCreatureSpawn(getBlockState(), world, pos, type);
|
||||
return getBlockState().getBlock().canCreatureSpawn(getBlockState(), world, pos, type, entityType);
|
||||
}
|
||||
/**
|
||||
* Returns the position that the player is moved to upon
|
||||
|
@ -247,7 +247,7 @@ public interface IForgeBlockState
|
|||
* @return The spawn position
|
||||
*/
|
||||
@Nullable
|
||||
default BlockPos getBedSpawnPosition(IWorldReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
default BlockPos getBedSpawnPosition(IBlockReader world, BlockPos pos, @Nullable EntityPlayer player)
|
||||
{
|
||||
return getBlockState().getBlock().getBedSpawnPosition(getBlockState(), world, pos, player);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,9 @@ import javax.annotation.Nullable;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLeashKnot;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.entity.item.EntityBoat;
|
||||
import net.minecraft.entity.item.EntityEnderCrystal;
|
||||
|
@ -167,4 +169,16 @@ public interface IForgeEntity extends ICapabilitySerializable<NBTTagCompound>
|
|||
* @return {@code true} if this entity can trample, {@code false} otherwise
|
||||
*/
|
||||
boolean canTrample(IBlockState state, BlockPos pos, float fallDistance);
|
||||
|
||||
/**
|
||||
* Returns true if the entity is of the @link{EnumCreatureType} provided
|
||||
* @param type The EnumCreatureType type this entity is evaluating
|
||||
* @param forSpawnCount If this is being invoked to check spawn count caps.
|
||||
* @return If the creature is of the type provided
|
||||
*/
|
||||
default boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount)
|
||||
{
|
||||
if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false;
|
||||
return type.getBaseClass().isAssignableFrom(this.getClass());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ public interface IForgeItem
|
|||
/**
|
||||
* Called to tick armor in the armor slot. Override to do something
|
||||
*/
|
||||
default void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
default void onArmorTick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -287,6 +287,13 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
|
|||
return getStack().getItem().getHorseArmorType(getStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to tick armor in the armor slot. Override to do something
|
||||
*/
|
||||
default void onArmorTick(World world, EntityPlayer player)
|
||||
{
|
||||
getStack().getItem().onArmorTick(getStack(), world, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called every tick from {@link EntityHorse#onUpdate()} on the item in the
|
||||
|
@ -334,4 +341,18 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
|
|||
{
|
||||
return getStack().getItem().isBookEnchantable(getStack(), book);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a player drops the item into the world, returning false from this
|
||||
* will prevent the item from being removed from the players inventory and
|
||||
* spawning in the world
|
||||
*
|
||||
* @param player The player that dropped the item
|
||||
* @param item The item stack, before the item is removed.
|
||||
*/
|
||||
default boolean onDroppedByPlayer(EntityPlayer player)
|
||||
{
|
||||
return getStack().getItem().onDroppedByPlayer(getStack(), player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A predicate that takes three arguments and returns a boolean.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface TriPredicate<T, U, V>
|
||||
{
|
||||
boolean test(T t, U u, V v);
|
||||
|
||||
default TriPredicate<T, U, V> and(TriPredicate<? super T, ? super U, ? super V> other) {
|
||||
Objects.requireNonNull(other);
|
||||
return (T t, U u, V v) -> test(t, u, v) && other.test(t, u, v);
|
||||
}
|
||||
|
||||
default TriPredicate<T, U, V> negate() {
|
||||
return (T t, U u, V v) -> !test(t, u, v);
|
||||
}
|
||||
|
||||
default TriPredicate<T, U, V> or(TriPredicate<? super T, ? super U, ? super V> other) {
|
||||
Objects.requireNonNull(other);
|
||||
return (T t, U u, V v) -> test(t, u, v) || other.test(t, u, v);
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@
|
|||
package net.minecraftforge.event;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
@ -180,7 +181,7 @@ public class ForgeEventFactory
|
|||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
|
||||
}
|
||||
|
||||
public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z, MobSpawnerBaseLogic spawner)
|
||||
public static Result canEntitySpawn(EntityLiving entity, IWorld world, float x, float y, float z, MobSpawnerBaseLogic spawner)
|
||||
{
|
||||
if (entity == null)
|
||||
return Result.DEFAULT;
|
||||
|
@ -426,15 +427,11 @@ public class ForgeEventFactory
|
|||
return event.getResult() == Result.ALLOW ? 1 : 0;
|
||||
}
|
||||
|
||||
public static void onPlayerDrops(EntityPlayer player, DamageSource cause, List<EntityItem> capturedDrops, boolean recentlyHit)
|
||||
public static void onPlayerDrops(EntityPlayer player, DamageSource cause, Collection<EntityItem> drops, boolean recentlyHit)
|
||||
{
|
||||
PlayerDropsEvent event = new PlayerDropsEvent(player, cause, capturedDrops, recentlyHit);
|
||||
if (!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
for (EntityItem item : capturedDrops)
|
||||
{
|
||||
player.dropItemAndGetStack(item);
|
||||
}
|
||||
PlayerDropsEvent event = new PlayerDropsEvent(player, cause, drops, recentlyHit);
|
||||
if (!MinecraftForge.EVENT_BUS.post(event)) {
|
||||
drops.forEach(e -> player.dropItemAndGetStack(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
|
@ -43,12 +44,12 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
|
|||
**/
|
||||
public class LivingSpawnEvent extends LivingEvent
|
||||
{
|
||||
private final World world;
|
||||
private final IWorld world;
|
||||
private final float x;
|
||||
private final float y;
|
||||
private final float z;
|
||||
|
||||
public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z)
|
||||
public LivingSpawnEvent(EntityLiving entity, IWorld world, float x, float y, float z)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
|
@ -57,7 +58,7 @@ public class LivingSpawnEvent extends LivingEvent
|
|||
this.z = z;
|
||||
}
|
||||
|
||||
public World getWorld() { return world; }
|
||||
public IWorld getWorld() { return world; }
|
||||
public float getX() { return x; }
|
||||
public float getY() { return y; }
|
||||
public float getZ() { return z; }
|
||||
|
@ -76,7 +77,6 @@ public class LivingSpawnEvent extends LivingEvent
|
|||
@Nullable
|
||||
private final MobSpawnerBaseLogic spawner;
|
||||
|
||||
|
||||
/**
|
||||
* CheckSpawn is fired when an Entity is about to be spawned.
|
||||
* @param entity the spawning entity
|
||||
|
@ -87,7 +87,7 @@ public class LivingSpawnEvent extends LivingEvent
|
|||
* @param spawner position of the MobSpawner
|
||||
* null if it this spawn is coming from a WorldSpawner
|
||||
*/
|
||||
public CheckSpawn(EntityLiving entity, World world, float x, float y, float z, @Nullable MobSpawnerBaseLogic spawner)
|
||||
public CheckSpawn(EntityLiving entity, IWorld world, float x, float y, float z, @Nullable MobSpawnerBaseLogic spawner)
|
||||
{
|
||||
super(entity, world, x, y, z);
|
||||
this.spawner = spawner;
|
||||
|
@ -95,7 +95,7 @@ public class LivingSpawnEvent extends LivingEvent
|
|||
|
||||
public boolean isSpawner()
|
||||
{
|
||||
return spawner != null; // TODO: replace with spawner null check in 1.13
|
||||
return spawner != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
@ -34,7 +34,7 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|||
* player dies. Canceling the event will prevent ALL drops from entering the
|
||||
* world.
|
||||
*/
|
||||
@net.minecraftforge.eventbus.api.Cancelable
|
||||
@Cancelable
|
||||
public class PlayerDropsEvent extends LivingDropsEvent
|
||||
{
|
||||
private final EntityPlayer entityPlayer;
|
||||
|
@ -46,7 +46,7 @@ public class PlayerDropsEvent extends LivingDropsEvent
|
|||
* @param source The source of the damage which is killing the player.
|
||||
* @param drops List of all drops entering the world.
|
||||
*/
|
||||
public PlayerDropsEvent(EntityPlayer entity, DamageSource source, List<EntityItem> drops, boolean recentlyHit)
|
||||
public PlayerDropsEvent(EntityPlayer entity, DamageSource source, Collection<EntityItem> drops, boolean recentlyHit)
|
||||
{
|
||||
super(entity, source, drops, ForgeHooks.getLootingLevel(entity, source.getTrueSource(), source), recentlyHit);
|
||||
|
||||
|
|
Loading…
Reference in a new issue