1.16 port

This commit is contained in:
yueh
2020-07-22 16:44:42 +02:00
parent 662dbca3e1
commit 56ecda5173
225 changed files with 1214 additions and 969 deletions
@@ -25,8 +25,9 @@ import java.util.EnumSet;
import java.util.List;
import java.util.function.Function;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
@@ -49,7 +50,7 @@ class CableBuilder {
private final SmartCableTextures smartCableTextures;
CableBuilder(Function<Material, TextureAtlasSprite> bakedTextureGetter) {
CableBuilder(Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter) {
this.coreTextures = new EnumMap<>(CableCoreType.class);
for (CableCoreType type : CableCoreType.values()) {
@@ -77,7 +78,7 @@ class CableBuilder {
this.smartCableTextures = new SmartCableTextures(bakedTextureGetter);
}
static Material getConnectionTexture(AECableType cableType, AEColor color) {
static RenderMaterial getConnectionTexture(AECableType cableType, AEColor color) {
String textureFolder;
switch (cableType) {
case GLASS:
@@ -99,7 +100,7 @@ class CableBuilder {
throw new IllegalStateException("Cable type " + cableType + " does not support connections.");
}
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, textureFolder + color.name().toLowerCase()));
}
@@ -701,8 +702,8 @@ class CableBuilder {
}
// Get all textures needed for building the actual cable quads
public static List<Material> getTextures() {
List<Material> locations = new ArrayList<>();
public static List<RenderMaterial> getTextures() {
List<RenderMaterial> locations = new ArrayList<>();
for (CableCoreType coreType : CableCoreType.values()) {
for (AEColor color : AEColor.values()) {
@@ -3,7 +3,7 @@ package appeng.client.render.cablebus;
import net.minecraft.client.particle.IParticleRenderType;
import net.minecraft.client.particle.SpriteTexturedParticle;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.world.World;
import net.minecraft.client.world.ClientWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -15,7 +15,7 @@ public class CableBusBreakingParticle extends SpriteTexturedParticle {
private final float field_217571_C;
private final float field_217572_F;
public CableBusBreakingParticle(World world, double x, double y, double z, double speedX, double speedY,
public CableBusBreakingParticle(ClientWorld world, double x, double y, double z, double speedX, double speedY,
double speedZ, TextureAtlasSprite sprite) {
super(world, x, y, z, speedX, speedY, speedZ);
this.setSprite(sprite);
@@ -25,7 +25,7 @@ public class CableBusBreakingParticle extends SpriteTexturedParticle {
this.field_217572_F = this.rand.nextFloat() * 3.0F;
}
public CableBusBreakingParticle(World world, double x, double y, double z, TextureAtlasSprite sprite) {
public CableBusBreakingParticle(ClientWorld world, double x, double y, double z, TextureAtlasSprite sprite) {
this(world, x, y, z, 0, 0, 0, sprite);
}
@@ -31,8 +31,8 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
@@ -55,7 +55,7 @@ public class CableBusModel implements IModelGeometry<CableBusModel> {
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
ItemOverrideList overrides, ResourceLocation modelLocation) {
Map<ResourceLocation, IBakedModel> partModels = this.loadPartModels(bakery, spriteGetter, modelTransform);
@@ -71,13 +71,13 @@ public class CableBusModel implements IModelGeometry<CableBusModel> {
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner,
public Collection<RenderMaterial> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return Collections.unmodifiableList(CableBuilder.getTextures());
}
private Map<ResourceLocation, IBakedModel> loadPartModels(ModelBakery bakery,
Function<Material, TextureAtlasSprite> spriteGetterIn, IModelTransform transformIn) {
Function<RenderMaterial, TextureAtlasSprite> spriteGetterIn, IModelTransform transformIn) {
ImmutableMap.Builder<ResourceLocation, IBakedModel> result = ImmutableMap.builder();
for (ResourceLocation location : this.partModels.getModels()) {
@@ -28,7 +28,7 @@ import java.util.Objects;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelProperty;
@@ -80,7 +80,7 @@ public class CableBusRenderState {
private EnumMap<Direction, FacadeRenderState> facades = new EnumMap<>(Direction.class);
// Used for Facades.
private WeakReference<ILightReader> world;
private WeakReference<IBlockDisplayReader> world;
private BlockPos pos;
// Contains the bounding boxes of all parts on the cable bus to allow facades to
@@ -152,11 +152,11 @@ public class CableBusRenderState {
return this.facades;
}
public ILightReader getWorld() {
public IBlockDisplayReader getWorld() {
return this.world.get();
}
public void setWorld(ILightReader world) {
public void setWorld(IBlockDisplayReader world) {
this.world = new WeakReference<>(world);
}
@@ -23,7 +23,7 @@ import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.util.ResourceLocation;
@@ -72,8 +72,8 @@ public enum CableCoreType {
return cableMapping.get(cableType);
}
public Material getTexture(AEColor color) {
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
public RenderMaterial getTexture(AEColor color) {
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, this.textureFolder + "/" + color.name().toLowerCase()));
}
@@ -25,12 +25,12 @@ import java.util.List;
import com.google.common.base.Preconditions;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
/**
@@ -21,11 +21,11 @@ package appeng.client.render.cablebus;
import javax.annotation.Nullable;
import net.minecraft.block.BlockState;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.level.ColorResolver;
import net.minecraft.world.lighting.WorldLightManager;
@@ -35,14 +35,14 @@ import net.minecraft.world.lighting.WorldLightManager;
*
* @author covers1624
*/
public class FacadeBlockAccess implements ILightReader {
public class FacadeBlockAccess implements IBlockDisplayReader {
private final ILightReader world;
private final IBlockDisplayReader world;
private final BlockPos pos;
private final Direction side;
private final BlockState state;
public FacadeBlockAccess(ILightReader world, BlockPos pos, Direction side, BlockState state) {
public FacadeBlockAccess(IBlockDisplayReader world, BlockPos pos, Direction side, BlockState state) {
this.world = world;
this.pos = pos;
this.side = side;
@@ -64,7 +64,7 @@ public class FacadeBlockAccess implements ILightReader {
}
@Override
public IFluidState getFluidState(BlockPos pos) {
public FluidState getFluidState(BlockPos pos) {
return world.getFluidState(pos);
}
@@ -44,7 +44,7 @@ import net.minecraft.util.Direction.Axis;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
@@ -112,7 +112,7 @@ public class FacadeBuilder {
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
List<AxisAlignedBB> partBoxes = renderState.getBoundingBoxes();
Set<Direction> sidesWithParts = renderState.getAttachments().keySet();
ILightReader parentWorld = renderState.getWorld();
IBlockDisplayReader parentWorld = renderState.getWorld();
BlockPos pos = renderState.getPos();
BlockColors blockColors = Minecraft.getInstance().getBlockColors();
boolean thinFacades = isUseThinFacades(partBoxes);
@@ -189,7 +189,7 @@ public class FacadeBuilder {
AEAxisAlignedBB cutOutBox = getCutOutBox(facadeBox, partBoxes);
List<AxisAlignedBB> holeStrips = getBoxes(facadeBox, cutOutBox, side.getAxis());
ILightReader facadeAccess = new FacadeBlockAccess(parentWorld, pos, side, blockState);
IBlockDisplayReader facadeAccess = new FacadeBlockAccess(parentWorld, pos, side, blockState);
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
IBakedModel model = dispatcher.getModelForState(blockState);
@@ -11,8 +11,8 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
@@ -22,12 +22,12 @@ import net.minecraftforge.client.model.geometry.IModelGeometry;
import appeng.core.AppEng;
public class P2PTunnelFrequencyModel implements IModelGeometry<P2PTunnelFrequencyModel> {
private static final Material TEXTURE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final RenderMaterial TEXTURE = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "part/p2p_tunnel_frequency"));
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
ItemOverrideList overrides, ResourceLocation modelLocation) {
try {
final TextureAtlasSprite texture = spriteGetter.apply(TEXTURE);
@@ -38,7 +38,7 @@ public class P2PTunnelFrequencyModel implements IModelGeometry<P2PTunnelFrequenc
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner,
public Collection<RenderMaterial> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return Collections.singleton(TEXTURE);
}
@@ -21,11 +21,11 @@ package appeng.client.render.cablebus;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3f;
import appeng.client.render.FacingToRotation;
import appeng.thirdparty.codechicken.lib.model.CachedFormat;
@@ -21,7 +21,7 @@ package appeng.client.render.cablebus;
import java.util.Arrays;
import java.util.function.Function;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
@@ -33,7 +33,7 @@ import appeng.core.AppEng;
*/
public class SmartCableTextures {
public static final Material[] SMART_CHANNELS_TEXTURES = Arrays
public static final RenderMaterial[] SMART_CHANNELS_TEXTURES = Arrays
.stream(new ResourceLocation[] { new ResourceLocation(AppEng.MOD_ID, "part/cable/smart/channels_00"), //
new ResourceLocation(AppEng.MOD_ID, "part/cable/smart/channels_01"), //
new ResourceLocation(AppEng.MOD_ID, "part/cable/smart/channels_02"), //
@@ -44,14 +44,14 @@ public class SmartCableTextures {
new ResourceLocation(AppEng.MOD_ID, "part/cable/smart/channels_12"), //
new ResourceLocation(AppEng.MOD_ID, "part/cable/smart/channels_13"), //
new ResourceLocation(AppEng.MOD_ID, "part/cable/smart/channels_14")//
}).map(e -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, e)).toArray(Material[]::new);
}).map(e -> new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, e)).toArray(RenderMaterial[]::new);
// Textures used to display channels on smart cables. There's two sets of 5
// textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] textures;
public SmartCableTextures(Function<Material, TextureAtlasSprite> bakedTextureGetter) {
public SmartCableTextures(Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter) {
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES)//
.map(bakedTextureGetter)//
.toArray(TextureAtlasSprite[]::new);