1.16.3 Update

Also included a bunch of warning cleanups.
This commit is contained in:
LexManos committed 2020-09-10 12:01:45 -07:00
1 parent 2353cd982a
commit c75eb9e7cf
73 files changed
+73 -381

No files matched your search

@@ -57,8 +57,6 @@ import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
// TODO: Write a model loader and test/fix as needed
public final class FluidModel implements IModelGeometry<FluidModel>
@@ -158,6 +158,7 @@ public final class ModelLoader extends ModelBakery
public static final class White {
public static final ResourceLocation LOCATION = new ResourceLocation("white");
private static TextureAtlasSprite instance = null;
@SuppressWarnings("deprecation")
public static final TextureAtlasSprite instance()
{
if (instance == null)
@@ -175,11 +175,13 @@ public class ModelLoaderRegistry
return blockMaterial(tex);
}
@SuppressWarnings("deprecation")
public static RenderMaterial blockMaterial(String location)
{
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(location));
}
@SuppressWarnings("deprecation")
public static RenderMaterial blockMaterial(ResourceLocation location)
{
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, location);
@@ -61,6 +61,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
this.bakedTextureGetter = bakedTextureGetter;
}
@SuppressWarnings("resource")
@Override
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity)
{
@@ -1,141 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2020.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.model.animation;
import java.util.List;
import java.util.Random;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.entity.Entity;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.pipeline.VertexLighterFlat;
import net.minecraftforge.client.model.pipeline.VertexBufferConsumer;
import net.minecraftforge.common.animation.Event;
import net.minecraftforge.common.animation.IEventHandler;
import net.minecraftforge.common.model.animation.CapabilityAnimation;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
/**
* ModelBase that works with the Forge model system and animations.
* Some quirks are still left, deprecated for the moment.
*/
/*
@Deprecated
public class AnimationModelBase<T extends Entity> extends Model implements IEventHandler<T>
{
private final VertexLighterFlat lighter;
private final ResourceLocation modelLocation;
public AnimationModelBase(ResourceLocation modelLocation, VertexLighterFlat lighter)
{
this.modelLocation = modelLocation;
this.lighter = lighter;
}
@SuppressWarnings("unchecked")
//@Override
public void render(Entity entity, float limbSwing, float limbSwingSpeed, float timeAlive, float yawHead, float rotationPitch, float scale)
{
entity.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)
.map(cap -> cap.apply(timeAlive / 20))
.map(pair -> {
handleEvents((T) entity, timeAlive / 20, pair.getRight());
IUnbakedModel unbaked = ModelLoaderRegistry.getModelOrMissing(modelLocation);
// TODO where should uvlock data come from?
return unbaked.bake(ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter(), new BasicState(pair.getLeft(), false), DefaultVertexFormats.ITEM);
}).ifPresent(model -> drawModel(model, entity));
}
private void drawModel(IBakedModel bakedModel, Entity entity)
{
BlockPos pos = new BlockPos(entity.posX, entity.posY + entity.height, entity.posZ);
RenderHelper.disableStandardItemLighting();
GlStateManager.pushMatrix();
GlStateManager.rotatef(180, 0, 0, 1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder builder = tessellator.getBuffer();
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
builder.setTranslation(-0.5, -1.5, -0.5);
lighter.setParent(new VertexBufferConsumer(builder));
lighter.setWorld(entity.world);
lighter.setState(Blocks.AIR.getDefaultState());
lighter.setBlockPos(pos);
boolean empty = true;
Random random = new Random();
random.setSeed(42);
List<BakedQuad> quads = bakedModel.getQuads(null, null, random);
if(!quads.isEmpty())
{
lighter.updateBlockInfo();
empty = false;
for(BakedQuad quad : quads)
{
quad.pipe(lighter);
}
}
for(Direction side : Direction.values())
{
random.setSeed(42);
quads = bakedModel.getQuads(null, side, random);
if(!quads.isEmpty())
{
if(empty) lighter.updateBlockInfo();
empty = false;
for(BakedQuad quad : quads)
{
quad.pipe(lighter);
}
}
}
// debug quad
//VertexBuffer.pos(0, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 0).lightmap(240, 0).endVertex();
//VertexBuffer.pos(0, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 1).lightmap(240, 0).endVertex();
//VertexBuffer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex();
//VertexBuffer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();
builder.setTranslation(0, 0, 0);
tessellator.draw();
GlStateManager.popMatrix();
RenderHelper.enableStandardItemLighting();
}
@Override
public void handleEvents(T instance, float time, Iterable<Event> pastEvents) {}
}
*/
@@ -50,7 +50,6 @@ import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.I
import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Type;
import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Variable;
import net.minecraftforge.common.animation.Event;
import net.minecraftforge.common.model.TransformationHelper;
import net.minecraftforge.common.model.animation.IClip;
import net.minecraftforge.common.model.animation.IJoint;
import net.minecraftforge.common.model.animation.IJointClip;
@@ -55,7 +55,7 @@ public class TileEntityRendererAnimation<T extends TileEntity> extends TileEntit
}
protected static BlockRendererDispatcher blockRenderer;
@Override
public void render(T te, float partialTick, MatrixStack mat, IRenderTypeBuffer renderer, int light, int otherlight)
{
@@ -72,6 +72,7 @@ public class TileEntityRendererAnimation<T extends TileEntity> extends TileEntit
IModelData data = model.getModelData(world, pos, state, ModelDataManager.getModelData(te.getWorld(), pos));
if (data.hasProperty(Properties.AnimationProperty))
{
@SuppressWarnings("resource")
float time = Animation.getWorldTime(Minecraft.getInstance().world, partialTick);
cap
.map(asm -> asm.apply(time))
@@ -93,6 +93,7 @@ import net.minecraftforge.common.property.Properties;
* If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry.
*/
// TODO: Implement as a new model loader
@SuppressWarnings("unused")
public enum B3DLoader implements ISelectiveResourceReloadListener
{
INSTANCE;
@@ -111,7 +112,6 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
cache.clear();
}
@SuppressWarnings("unchecked")
public IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception
{
ResourceLocation file = new ResourceLocation(modelLocation.getNamespace(), modelLocation.getPath());
@@ -445,6 +445,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
return path;
}
@SuppressWarnings("deprecation")
@Override
public Collection<RenderMaterial> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
@@ -459,6 +460,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
return Collections.emptyList();
}
@SuppressWarnings("deprecation")
@Nullable
@Override
public IBakedModel bakeModel(ModelBakery bakery, Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
@@ -39,7 +39,6 @@ import net.minecraftforge.client.model.geometry.IModelGeometryPart;
import net.minecraftforge.client.model.geometry.IMultipartModelGeometry;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.common.model.TransformationHelper;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;