diff --git a/src/main/java/com/simibubi/create/content/curiosities/TreeFertilizerItem.java b/src/main/java/com/simibubi/create/content/curiosities/TreeFertilizerItem.java index 104095a74..2b9d25a5f 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/TreeFertilizerItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/TreeFertilizerItem.java @@ -97,4 +97,6 @@ public class TreeFertilizerItem extends Item { } + + } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java index 2c5e1f875..ea7002b13 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java @@ -128,7 +128,7 @@ public class SymmetryHandler { Minecraft.getInstance() .getBufferBuilders() .getEntityVertexConsumers() - .draw(Atlases.getEntityTranslucent()); + .draw(Atlases.getEntityTranslucentCull()); // FIXME new equivalent of getEntityTranslucent() ? ms.pop(); } diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index 0d82e4108..aae2396ad 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -10,8 +10,8 @@ import java.util.function.Predicate; import java.util.stream.Stream; import com.simibubi.create.foundation.utility.BlockHelper; -import com.simibubi.create.foundation.utility.worldWrappers.WrappedServerWorld; +import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -29,11 +29,8 @@ import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.*; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeRegistry; -import net.minecraft.world.biome.Biomes; -import net.minecraft.world.server.ServerTickList; -import net.minecraft.world.server.ServerWorld; -public class SchematicWorld extends WrappedServerWorld { +public class SchematicWorld extends WrappedWorld { private Map blocks; private Map tileEntities; @@ -180,7 +177,7 @@ public class SchematicWorld extends WrappedServerWorld { } @Override - public ServerTickList getPendingFluidTicks() { + public ITickList getPendingFluidTicks() { return EmptyTickList.get(); } diff --git a/src/main/java/com/simibubi/create/foundation/data/NamedTag.java b/src/main/java/com/simibubi/create/foundation/data/NamedTag.java new file mode 100644 index 000000000..6217b1160 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/data/NamedTag.java @@ -0,0 +1,41 @@ +package com.simibubi.create.foundation.data; + +import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.tags.ITag; +import net.minecraft.util.ResourceLocation; + +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.Collections; +import java.util.List; + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +public class NamedTag implements ITag.INamedTag { + private final ResourceLocation id; + private final ITag tag; + + public NamedTag(@Nullable ITag tag, ResourceLocation id) { + this.tag = tag; + this.id = id; + } + + @Override + public ResourceLocation getId() { + return id; + } + + @Override + public boolean contains(T p_230235_1_) { + if (tag == null) + return false; + return tag.contains(p_230235_1_); + } + + @Override + public List values() { + if (tag == null) + return Collections.emptyList(); + return tag.values(); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java index ecd5d45ab..00420513f 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java @@ -10,6 +10,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; +import com.simibubi.create.foundation.data.NamedTag; import net.minecraft.fluid.Fluid; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.PacketBuffer; @@ -170,8 +171,8 @@ public abstract class FluidIngredient implements Predicate { @Override protected void readInternal(PacketBuffer buffer) { ResourceLocation resourcelocation = buffer.readResourceLocation(); - tag = FluidTags.func_226157_a_() - .get(resourcelocation); + tag = new NamedTag<>(FluidTags.func_226157_a_() + .get(resourcelocation), resourcelocation); } @Override @@ -182,10 +183,11 @@ public abstract class FluidIngredient implements Predicate { @Override protected void readInternal(JsonObject json) { ResourceLocation id = new ResourceLocation(JSONUtils.getString(json, "fluidTag")); - tag = FluidTags.func_226157_a_() + ITag tmpTag = FluidTags.func_226157_a_() .get(id); - if (tag == null) + if (tmpTag == null) throw new JsonSyntaxException("Unknown fluid tag '" + id + "'"); + tag = new NamedTag<>(tmpTag, id); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java b/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java index 546dd82a3..b7bdb664f 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java +++ b/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java @@ -187,7 +187,7 @@ public class GuiGameElement { BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher(); IRenderTypeBuffer.Impl buffer = mc.getBufferBuilders() .getEntityVertexConsumers(); - RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucent() + RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucentCull() // FIXME .getEntityTranslucent() : RenderTypeLookup.getEntityBlockLayer(blockState, true); IVertexBuilder vb = buffer.getBuffer(renderType); diff --git a/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java b/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java index 6c2eb5e87..2377e721b 100644 --- a/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/renderState/SuperRenderTypeBuffer.java @@ -71,7 +71,7 @@ public class SuperRenderTypeBuffer implements IRenderTypeBuffer { assign(map, RenderTypes.getOutlineSolid()); map.put(Atlases.getEntityCutout(), blockBuilders.get(RenderType.getCutout())); map.put(Atlases.getBannerPatterns(), blockBuilders.get(RenderType.getCutoutMipped())); - map.put(Atlases.getEntityTranslucent(), blockBuilders.get(RenderType.getTranslucent())); + map.put(Atlases.getEntityTranslucentCull(), blockBuilders.get(RenderType.getTranslucent())); // FIXME new equivalent of getEntityTranslucent() ? assign(map, Atlases.getShieldPatterns()); assign(map, Atlases.getBeds()); assign(map, Atlases.getShulkerBoxes()); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java index 928b27308..cf885a6b0 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedServerWorld.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.utility.worldWrappers; import java.util.Collections; import java.util.List; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; @@ -10,32 +11,37 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.item.crafting.RecipeManager; -import net.minecraft.scoreboard.ServerScoreboard; +import net.minecraft.server.MinecraftServer; import net.minecraft.tags.ITagCollectionSupplier; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; +import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ITickList; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; +import net.minecraft.world.server.ServerChunkProvider; import net.minecraft.world.server.ServerTickList; import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.storage.IServerWorldInfo; import net.minecraft.world.storage.MapData; +import net.minecraft.world.storage.SaveFormat; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import javax.annotation.ParametersAreNonnullByDefault; + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault public class WrappedServerWorld extends ServerWorld { protected World world; public WrappedServerWorld(World world) { - super(world.getServer(), world.getServer().getBackgroundExecutor(), world.getSaveHandler(), world.getWorldInfo(), world.getDimension(), world.getProfiler(), null); + // Replace null with world.getChunkProvider().chunkManager.field_219266_t ? We had null in 1.15 + super(world.getServer(), Util.getServerExecutor(), getLevelSaveFromWorld(world), (IServerWorldInfo) world.getWorldInfo(), world.getRegistryKey(), world.getDimension(), null, ((ServerChunkProvider) world.getChunkProvider()).getChunkGenerator(), world.isDebugWorld(), world.getBiomeAccess().seed, Collections.EMPTY_LIST, false); //, world.field_25143); this.world = world; } - @Override - public ServerWorld getWorld() { - return world; - } - @Override public float getCelestialAngleRadians(float p_72826_1_) { return 0; @@ -52,13 +58,19 @@ public class WrappedServerWorld extends ServerWorld { } @Override - public ITickList getPendingBlockTicks() { - return world.getPendingBlockTicks(); + public ServerTickList getPendingBlockTicks() { + ITickList tl = world.getPendingBlockTicks(); + if (tl instanceof ServerTickList) + return (ServerTickList) tl; + return super.getPendingBlockTicks(); } @Override - public ITickList getPendingFluidTicks() { - return world.getPendingFluidTicks(); + public ServerTickList getPendingFluidTicks() { + ITickList tl = world.getPendingFluidTicks(); + if (tl instanceof ServerTickList) + return (ServerTickList) tl; + return super.getPendingFluidTicks(); } @Override @@ -109,11 +121,6 @@ public class WrappedServerWorld extends ServerWorld { public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) { } - @Override - public ServerScoreboard getScoreboard() { - return world.getScoreboard(); - } - @Override public RecipeManager getRecipeManager() { return world.getRecipeManager(); @@ -129,4 +136,7 @@ public class WrappedServerWorld extends ServerWorld { return world.getGeneratorStoredBiome(p_225604_1_, p_225604_2_, p_225604_3_); } + private static SaveFormat.LevelSave getLevelSaveFromWorld(World world) { + return ObfuscationReflectionHelper.getPrivateValue(MinecraftServer.class, world.getServer(), "field_71310_m"); + } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index d16903b7c..d43e0b627 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -16,4 +16,6 @@ public net.minecraft.world.chunk.ChunkStatus$IGenerationWorker public net.minecraft.world.chunk.ChunkStatus$ILoadingWorker public net.minecraft.client.gui.FontRenderer func_238419_a_(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/gui/fonts/Font; # getFontStorage -protected net.minecraft.entity.Entity func_226266_a_(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/Entity$IMoveCallback;)V # updatePassengerPosition \ No newline at end of file +protected net.minecraft.entity.Entity func_226266_a_(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/Entity$IMoveCallback;)V # updatePassengerPosition +public net.minecraft.world.server.ChunkManager field_219266_t # field_219266_t +public net.minecraft.world.biome.BiomeManager field_226833_b_ # seed