Fix invalid inventory being sent to ItemCraftedEvent Closes #5580

Fixed custom ingredient network serialization by removing unneeded mark. Closes #5577
Changed HorseArmorType constructor to not prefix vanilla paths to custom armors. Closes #5574
Fix removeBlock being called with invalid canHarvest value. Closes #5570
This commit is contained in:
LexManos 2019-03-11 15:43:10 -07:00
parent 00845d5252
commit 554952e02a
4 changed files with 11 additions and 12 deletions

View File

@ -17,12 +17,14 @@
private HorseArmorType(int p_i46799_3_) {
this.field_188588_g = p_i46799_3_;
@@ -29,6 +30,15 @@
@@ -29,6 +30,17 @@
this.field_188587_f = p_i46800_5_;
}
+ private HorseArmorType(int strength, String texture, String hash, Item item) {
+ this(strength, texture, hash);
+ this.field_188588_g = strength;
+ this.field_188586_e = texture;
+ this.field_188587_f = hash;
+ this.item = item;
+ }
+
@ -33,7 +35,7 @@
public int func_188579_a() {
return this.ordinal();
}
@@ -48,25 +58,38 @@
@@ -48,25 +60,38 @@
return this.field_188586_e;
}

View File

@ -4,7 +4,7 @@
protected void func_75208_c(ItemStack p_75208_1_) {
if (this.field_75237_g > 0) {
p_75208_1_.func_77980_a(this.field_75238_b.field_70170_p, this.field_75238_b, this.field_75237_g);
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.field_75238_b, p_75208_1_, this.field_75224_c);
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.field_75238_b, p_75208_1_, this.field_75239_a);
}
((IRecipeHolder)this.field_75224_c).func_201560_d(this.field_75238_b);

View File

@ -80,20 +80,17 @@
public static Ingredient func_193369_a(ItemStack... p_193369_0_) {
return func_209357_a(Arrays.stream(p_193369_0_).map((p_209356_0_) -> {
return new Ingredient.SingleItemList(p_209356_0_);
@@ -145,7 +173,12 @@
}
@@ -146,6 +174,9 @@
public static Ingredient func_199566_b(PacketBuffer p_199566_0_) {
+ p_199566_0_.markReaderIndex();
int i = p_199566_0_.func_150792_a();
+ if (i == -1) {
+ p_199566_0_.resetReaderIndex();
+ return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199566_0_.func_192575_l(), p_199566_0_);
+ }
return func_209357_a(Stream.generate(() -> {
return new Ingredient.SingleItemList(p_199566_0_.func_150791_c());
}).limit((long)i));
@@ -153,6 +186,8 @@
@@ -153,6 +184,8 @@
public static Ingredient func_199802_a(@Nullable JsonElement p_199802_0_) {
if (p_199802_0_ != null && !p_199802_0_.isJsonNull()) {
@ -102,7 +99,7 @@
if (p_199802_0_.isJsonObject()) {
return func_209357_a(Stream.of(func_199803_a(p_199802_0_.getAsJsonObject())));
} else if (p_199802_0_.isJsonArray()) {
@@ -173,6 +208,11 @@
@@ -173,6 +206,11 @@
}
public static Ingredient.IItemList func_199803_a(JsonObject p_199803_0_) {
@ -114,7 +111,7 @@
if (p_199803_0_.has("item") && p_199803_0_.has("tag")) {
throw new JsonParseException("An ingredient entry is either a tag or an item, not both");
} else if (p_199803_0_.has("item")) {
@@ -196,6 +236,12 @@
@@ -196,6 +234,12 @@
}
}

View File

@ -138,7 +138,7 @@
+ if (itemstack2.func_190926_b() && !copy.func_190926_b()) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, copy, EnumHand.MAIN_HAND);
+ }
+ flag1 = this.func_180235_c(p_180237_1_);
+ flag1 = this.removeBlock(p_180237_1_, flag);
if (flag1 && flag) {
ItemStack itemstack1 = itemstack2.func_190926_b() ? ItemStack.field_190927_a : itemstack2.func_77946_l();
iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity, itemstack1);