Fixed some more stuff

This commit is contained in:
grimmauld 2020-09-24 16:17:16 +02:00
parent 88d52814c5
commit 92a6e32b19
9 changed files with 84 additions and 30 deletions

View file

@ -97,4 +97,6 @@ public class TreeFertilizerItem extends Item {
}
}

View file

@ -128,7 +128,7 @@ public class SymmetryHandler {
Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers()
.draw(Atlases.getEntityTranslucent());
.draw(Atlases.getEntityTranslucentCull()); // FIXME new equivalent of getEntityTranslucent() ?
ms.pop();
}

View file

@ -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<BlockPos, BlockState> blocks;
private Map<BlockPos, TileEntity> tileEntities;
@ -180,7 +177,7 @@ public class SchematicWorld extends WrappedServerWorld {
}
@Override
public ServerTickList<Fluid> getPendingFluidTicks() {
public ITickList<Fluid> getPendingFluidTicks() {
return EmptyTickList.get();
}

View file

@ -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<T> implements ITag.INamedTag<T> {
private final ResourceLocation id;
private final ITag<T> tag;
public NamedTag(@Nullable ITag<T> 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<T> values() {
if (tag == null)
return Collections.emptyList();
return tag.values();
}
}

View file

@ -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<FluidStack> {
@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<FluidStack> {
@Override
protected void readInternal(JsonObject json) {
ResourceLocation id = new ResourceLocation(JSONUtils.getString(json, "fluidTag"));
tag = FluidTags.func_226157_a_()
ITag<Fluid> 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

View file

@ -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);

View file

@ -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());

View file

@ -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<Block> getPendingBlockTicks() {
return world.getPendingBlockTicks();
public ServerTickList<Block> getPendingBlockTicks() {
ITickList<Block> tl = world.getPendingBlockTicks();
if (tl instanceof ServerTickList)
return (ServerTickList<Block>) tl;
return super.getPendingBlockTicks();
}
@Override
public ITickList<Fluid> getPendingFluidTicks() {
return world.getPendingFluidTicks();
public ServerTickList<Fluid> getPendingFluidTicks() {
ITickList<Fluid> tl = world.getPendingFluidTicks();
if (tl instanceof ServerTickList)
return (ServerTickList<Fluid>) 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");
}
}

View file

@ -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
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