Fix typo causing potential error in vine growth. Closes #7406

Sort missing registry dumps by name, making it easier to read.
This commit is contained in:
LexManos 2020-10-09 12:56:17 -07:00
parent 59b4affbe7
commit 37f226eda5
6 changed files with 53 additions and 20 deletions

View File

@ -65,10 +65,14 @@
}
return this.field_220085_g;
@@ -346,6 +349,10 @@
@@ -346,6 +349,14 @@
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
}
+ protected boolean isAir(BlockState state) {
+ return ((AbstractBlockState)state).field_235702_f_;
+ }
+
+ /* ======================================== FORGE START ===================================== */
+ private final java.util.function.Supplier<ResourceLocation> lootTableSupplier;
+ /* ========================================= FORGE END ====================================== */
@ -76,16 +80,18 @@
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
private final int field_215708_d;
private final boolean field_215709_e;
@@ -428,6 +435,8 @@
@@ -428,14 +439,18 @@
return this.field_215708_d;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
public boolean func_196958_f() {
return this.field_235702_f_;
- return this.field_235702_f_;
+ return this.func_177230_c().isAir((BlockState)this);
}
@@ -436,6 +445,8 @@
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
return this.field_235704_h_;
}
@ -94,7 +100,7 @@
public BlockState func_185907_a(Rotation p_185907_1_) {
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
}
@@ -802,6 +813,9 @@
@@ -802,6 +817,9 @@
private ResourceLocation field_222381_j;
private boolean field_226895_m_ = true;
private boolean field_235813_o_;
@ -104,7 +110,7 @@
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14;
};
@@ -863,6 +877,8 @@
@@ -863,6 +881,8 @@
abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_;
abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_;
abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_;
@ -113,7 +119,7 @@
return abstractblock$properties;
}
@@ -877,6 +893,24 @@
@@ -877,6 +897,24 @@
return this;
}
@ -138,7 +144,7 @@
public AbstractBlock.Properties func_200941_a(float p_200941_1_) {
this.field_200961_i = p_200941_1_;
return this;
@@ -933,7 +967,7 @@
@@ -933,7 +971,7 @@
}
public AbstractBlock.Properties func_222379_b(Block p_222379_1_) {

View File

@ -26,16 +26,19 @@
Direction direction3 = direction.func_176746_e();
Direction direction4 = direction.func_176735_f();
boolean flag = p_225542_1_.func_177229_b(func_176267_a(direction3));
@@ -216,7 +216,7 @@
@@ -216,8 +216,9 @@
if (p_225542_3_.func_177956_o() > 0) {
BlockPos blockpos1 = p_225542_3_.func_177977_b();
BlockState blockstate = p_225542_2_.func_180495_p(blockpos1);
- if (blockstate.func_196958_f() || blockstate.func_203425_a(this)) {
+ if (blockstate.isAir(p_225542_2_, blockpos) || blockstate.func_203425_a(this)) {
BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate;
- BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate;
+ boolean isAir = blockstate.isAir(p_225542_2_, blockpos1);
+ if (isAir || blockstate.func_203425_a(this)) {
+ BlockState blockstate1 = isAir ? this.func_176223_P() : blockstate;
BlockState blockstate2 = this.func_196544_a(p_225542_1_, blockstate1, p_225542_4_);
if (blockstate1 != blockstate2 && this.func_196540_x(blockstate2)) {
@@ -322,4 +322,7 @@
p_225542_2_.func_180501_a(blockpos1, blockstate2, 2);
@@ -322,4 +323,7 @@
public static BooleanProperty func_176267_a(Direction p_176267_0_) {
return field_196546_A.get(p_176267_0_);
}

View File

@ -0,0 +1,15 @@
--- a/net/minecraft/util/ResourceLocation.java
+++ b/net/minecraft/util/ResourceLocation.java
@@ -112,6 +112,12 @@
return i;
}
+ // Normal compare sorts by path first, this compares namespace first.
+ public int compareNamespaced(ResourceLocation o) {
+ int ret = this.field_110626_a.compareTo(o.field_110626_a);
+ return ret != 0 ? ret : this.field_110625_b.compareTo(o.field_110625_b);
+ }
+
public static ResourceLocation func_195826_a(StringReader p_195826_0_) throws CommandSyntaxException {
int i = p_195826_0_.getCursor();

View File

@ -20,8 +20,6 @@
package net.minecraftforge.common.extensions;
import java.util.Optional;
import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.block.*;
@ -33,8 +31,6 @@ import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathNodeType;
import net.minecraft.tileentity.TileEntity;
@ -239,7 +235,12 @@ public interface IForgeBlockState
* @param world The current world
* @param pos Block position in world
* @return True if the block considered air
* @deprecated TODO: Remove in 1.17, in favor of state only version. This is a old hook from before
* block states were unlimited and people used TileEntities. If you still use the location
* information in your TileEntity please explain why and how you can't use BlockState only version
* here: https://github.com/MinecraftForge/MinecraftForge/issues/7409
*/
@Deprecated
default boolean isAir(IBlockReader world, BlockPos pos)
{
return getBlockState().getBlock().isAir(getBlockState(), world, pos);

View File

@ -164,7 +164,7 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
REMAP
}
public static class Mapping<T extends IForgeRegistryEntry<T>>
public static class Mapping<T extends IForgeRegistryEntry<T>> implements Comparable<Mapping<T>>
{
public final IForgeRegistry<T> registry;
private final IForgeRegistry<T> pool;
@ -231,6 +231,14 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
{
return target;
}
@Override
public int compareTo(Mapping<T> o)
{
int ret = this.registry.getRegistryName().compareNamespaced(o.registry.getRegistryName());
if (ret ==0) ret = this.key.compareNamespaced(o.key);
return ret;
}
}
}
}

View File

@ -355,7 +355,7 @@ public class GameData
fr.unfreeze();
}, executor).thenApply(v->Collections.emptyList());
}
public static CompletableFuture<List<Throwable>> postRegistryEventDispatch(final Executor executor, final ModLoadingStage.EventGenerator<? extends RegistryEvent.Register<?>> eventGenerator) {
return CompletableFuture.runAsync(()-> {
final RegistryEvent.Register<?> event = eventGenerator.apply(null);
@ -727,7 +727,7 @@ public class GameData
{
LOGGER.error(REGISTRIES,()->new AdvancedLogMessageAdapter(sb->{
sb.append("Unidentified mapping from registry ").append(name).append('\n');
lst.forEach(map->sb.append('\t').append(map.key).append(": ").append(map.id).append('\n'));
lst.stream().sorted().forEach(map->sb.append('\t').append(map.key).append(": ").append(map.id).append('\n'));
}));
}
event.getAllMappings().stream().filter(e -> e.getAction() == MissingMappings.Action.FAIL).forEach(fail -> failed.put(name, fail.key));
@ -750,7 +750,7 @@ public class GameData
defaulted.asMap().forEach((name, entries) ->
{
buf.append("Missing ").append(name).append(":\n");
entries.forEach(rl -> buf.append(" ").append(rl).append("\n"));
entries.stream().sorted((o1, o2) -> o1.compareNamespaced(o2)).forEach(rl -> buf.append(" ").append(rl).append("\n"));
buf.append("\n");
});
}