Change default BrewingRecipe to use an Ingredient for the input instead of ItemStack. Closes #5944

Add AT for GameRules.register Closes #5946
Fix Forge Blockstate loader model path is inconsistent with vanilla blockstates Closes #5892
Fix client crashing when opting not to load a world when there's missing blocks Closes #5886
This commit is contained in:
LexManos 2019-07-18 13:31:37 -07:00
parent e6f032db1b
commit cb21e95e0b
5 changed files with 27 additions and 22 deletions

View file

@ -50,7 +50,7 @@
this.field_211151_aa = Util.func_211177_b(); this.field_211151_aa = Util.func_211177_b();
this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C)); this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C));
this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion())); this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion()));
@@ -611,7 +615,10 @@ @@ -611,9 +615,15 @@
this.field_71304_b.func_219897_b(); this.field_71304_b.func_219897_b();
this.field_71296_Q = true; this.field_71296_Q = true;
} }
@ -60,8 +60,13 @@
+ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions + net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions
this.func_71228_a((CrashReport)null); this.func_71228_a((CrashReport)null);
} }
+ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) {
+ // ignore silently
+ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
@@ -630,6 +637,7 @@ field_147145_h.error("Encountered an unexpected exception", throwable1);
CrashReport crashreport;
@@ -630,6 +640,7 @@
field_147145_h.error("We were unable to save this crash report to disk."); field_147145_h.error("We were unable to save this crash report to disk.");
} }
@ -69,7 +74,7 @@
this.func_71228_a(crashreport); this.func_71228_a(crashreport);
} finally { } finally {
try { try {
@@ -638,6 +646,7 @@ @@ -638,6 +649,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
field_147145_h.error("Exception stopping the server", throwable); field_147145_h.error("Exception stopping the server", throwable);
} finally { } finally {
@ -77,7 +82,7 @@
this.func_71240_o(); this.func_71240_o();
} }
@@ -734,6 +743,7 @@ @@ -734,6 +746,7 @@
protected void func_71217_p(BooleanSupplier p_71217_1_) { protected void func_71217_p(BooleanSupplier p_71217_1_) {
long i = Util.func_211178_c(); long i = Util.func_211178_c();
@ -85,7 +90,7 @@
++this.field_71315_w; ++this.field_71315_w;
this.func_71190_q(p_71217_1_); this.func_71190_q(p_71217_1_);
if (i - this.field_147142_T >= 5000000000L) { if (i - this.field_147142_T >= 5000000000L) {
@@ -748,6 +758,7 @@ @@ -748,6 +761,7 @@
Collections.shuffle(Arrays.asList(agameprofile)); Collections.shuffle(Arrays.asList(agameprofile));
this.field_147147_p.func_151318_b().func_151330_a(agameprofile); this.field_147147_p.func_151318_b().func_151330_a(agameprofile);
@ -93,7 +98,7 @@
} }
if (this.field_71315_w % 6000 == 0) { if (this.field_71315_w % 6000 == 0) {
@@ -775,6 +786,7 @@ @@ -775,6 +789,7 @@
long i1 = Util.func_211178_c(); long i1 = Util.func_211178_c();
this.field_213215_ap.func_181747_a(i1 - i); this.field_213215_ap.func_181747_a(i1 - i);
this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b();
@ -101,7 +106,7 @@
} }
protected void func_71190_q(BooleanSupplier p_71190_1_) { protected void func_71190_q(BooleanSupplier p_71190_1_) {
@@ -782,7 +794,8 @@ @@ -782,7 +797,8 @@
this.func_193030_aL().func_73660_a(); this.func_193030_aL().func_73660_a();
this.field_71304_b.func_219895_b("levels"); this.field_71304_b.func_219895_b("levels");
@ -111,7 +116,7 @@
if (serverworld.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ || this.func_71255_r()) { if (serverworld.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ || this.func_71255_r()) {
this.field_71304_b.func_194340_a(() -> { this.field_71304_b.func_194340_a(() -> {
return serverworld.func_72912_H().func_76065_j() + " " + Registry.field_212622_k.func_177774_c(serverworld.field_73011_w.func_186058_p()); return serverworld.func_72912_H().func_76065_j() + " " + Registry.field_212622_k.func_177774_c(serverworld.field_73011_w.func_186058_p());
@@ -794,6 +807,7 @@ @@ -794,6 +810,7 @@
} }
this.field_71304_b.func_76320_a("tick"); this.field_71304_b.func_76320_a("tick");
@ -119,7 +124,7 @@
try { try {
serverworld.func_72835_b(p_71190_1_); serverworld.func_72835_b(p_71190_1_);
@@ -802,12 +816,16 @@ @@ -802,12 +819,16 @@
serverworld.func_72914_a(crashreport); serverworld.func_72914_a(crashreport);
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@ -136,7 +141,7 @@
this.field_71304_b.func_219895_b("connection"); this.field_71304_b.func_219895_b("connection");
this.func_147137_ag().func_151269_c(); this.func_147137_ag().func_151269_c();
this.field_71304_b.func_219895_b("players"); this.field_71304_b.func_219895_b("players");
@@ -844,6 +862,7 @@ @@ -844,6 +865,7 @@
OptionSpec<Integer> optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); OptionSpec<Integer> optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1);
OptionSpec<String> optionspec11 = optionparser.accepts("serverId").withRequiredArg(); OptionSpec<String> optionspec11 = optionparser.accepts("serverId").withRequiredArg();
OptionSpec<String> optionspec12 = optionparser.nonOptions(); OptionSpec<String> optionspec12 = optionparser.nonOptions();
@ -144,7 +149,7 @@
try { try {
OptionSet optionset = optionparser.parse(p_main_0_); OptionSet optionset = optionparser.parse(p_main_0_);
@@ -936,7 +955,7 @@ @@ -936,7 +958,7 @@
} }
public ServerWorld func_71218_a(DimensionType p_71218_1_) { public ServerWorld func_71218_a(DimensionType p_71218_1_) {
@ -153,7 +158,7 @@
} }
public Iterable<ServerWorld> func_212370_w() { public Iterable<ServerWorld> func_212370_w() {
@@ -975,7 +994,7 @@ @@ -975,7 +997,7 @@
} }
public String getServerModName() { public String getServerModName() {
@ -162,7 +167,7 @@
} }
public CrashReport func_71230_b(CrashReport p_71230_1_) { public CrashReport func_71230_b(CrashReport p_71230_1_) {
@@ -1517,4 +1536,29 @@ @@ -1517,4 +1539,29 @@
} }
public abstract boolean func_213199_b(GameProfile p_213199_1_); public abstract boolean func_213199_b(GameProfile p_213199_1_);

View file

@ -448,8 +448,7 @@ public class ForgeBlockStateV1 extends Marker
protected ResourceLocation getBlockLocation(String location) protected ResourceLocation getBlockLocation(String location)
{ {
ResourceLocation tmp = new ResourceLocation(location); return new ResourceLocation(location); //Vanilla 1.14 removed automatic block prefixes. See https://github.com/MinecraftForge/MinecraftForge/issues/5892
return new ResourceLocation(tmp.getNamespace(), "block/" + tmp.getPath());
} }
/** Throws an error if there are submodels in this submodel. */ /** Throws an error if there are submodels in this submodel. */

View file

@ -26,11 +26,11 @@ import javax.annotation.Nonnull;
public class BrewingRecipe implements IBrewingRecipe public class BrewingRecipe implements IBrewingRecipe
{ {
@Nonnull private final ItemStack input; @Nonnull private final Ingredient input;
@Nonnull private final Ingredient ingredient; @Nonnull private final Ingredient ingredient;
@Nonnull private final ItemStack output; @Nonnull private final ItemStack output;
public BrewingRecipe(ItemStack input, Ingredient ingredient, ItemStack output) public BrewingRecipe(Ingredient input, Ingredient ingredient, ItemStack output)
{ {
this.input = input; this.input = input;
this.ingredient = ingredient; this.ingredient = ingredient;
@ -40,7 +40,7 @@ public class BrewingRecipe implements IBrewingRecipe
@Override @Override
public boolean isInput(@Nonnull ItemStack stack) public boolean isInput(@Nonnull ItemStack stack)
{ {
return ingredient.test(stack); return this.input.test(stack);
} }
@Override @Override
@ -49,7 +49,7 @@ public class BrewingRecipe implements IBrewingRecipe
return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : ItemStack.EMPTY; return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : ItemStack.EMPTY;
} }
public ItemStack getInput() public Ingredient getInput()
{ {
return input; return input;
} }

View file

@ -40,16 +40,16 @@ public class BrewingRecipeRegistry {
* inputs that stack (a.k.a max stack size > 1) are not allowed. * inputs that stack (a.k.a max stack size > 1) are not allowed.
* *
* @param input * @param input
* The ItemStack that goes in same slots as the water bottles * The Ingredient that goes in same slots as the water bottles
* would. * would.
* @param ingredient * @param ingredient
* The ItemStack that goes in the same slot as nether wart would. * The Ingredient that goes in the same slot as nether wart would.
* @param output * @param output
* The ItemStack that will replace the input once the brewing is * The ItemStack that will replace the input once the brewing is
* done. * done.
* @return true if the recipe was added. * @return true if the recipe was added.
*/ */
public static boolean addRecipe(ItemStack input, Ingredient ingredient, ItemStack output) public static boolean addRecipe(Ingredient input, Ingredient ingredient, ItemStack output)
{ {
return addRecipe(new BrewingRecipe(input, ingredient, output)); return addRecipe(new BrewingRecipe(input, ingredient, output));
} }

View file

@ -106,6 +106,7 @@ public net.minecraft.util.WeightedRandom$Item field_76292_a #probability
public net.minecraft.util.concurrent.ThreadTaskExecutor func_213165_a(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # func_213165_a public net.minecraft.util.concurrent.ThreadTaskExecutor func_213165_a(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # func_213165_a
public net.minecraft.village.PointOfInterestType <init>(Ljava/lang/String;Ljava/util/Set;ILnet/minecraft/util/SoundEvent;)V public net.minecraft.village.PointOfInterestType <init>(Ljava/lang/String;Ljava/util/Set;ILnet/minecraft/util/SoundEvent;)V
public net.minecraft.village.PointOfInterestType <init>(Ljava/lang/String;Ljava/util/Set;ILnet/minecraft/util/SoundEvent;Ljava/util/function/Predicate;)V public net.minecraft.village.PointOfInterestType <init>(Ljava/lang/String;Ljava/util/Set;ILnet/minecraft/util/SoundEvent;Ljava/util/function/Predicate;)V
public net.minecraft.world.GameRules func_223595_a(Ljava/lang/String;Lnet/minecraft/world/GameRules$RuleType;)Lnet/minecraft/world/GameRules$RuleKey; # register
protected net.minecraft.world.Teleporter field_77187_a # random protected net.minecraft.world.Teleporter field_77187_a # random
protected net.minecraft.world.Teleporter field_85191_c # destinationCoordinateCache protected net.minecraft.world.Teleporter field_85191_c # destinationCoordinateCache
protected net.minecraft.world.Teleporter field_85192_a # world protected net.minecraft.world.Teleporter field_85192_a # world