Compiles again.

This commit is contained in:
Sebastian Hartte
2020-06-04 19:58:58 +02:00
parent 237463dd94
commit c402390282
89 changed files with 1353 additions and 1772 deletions
@@ -27,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import appeng.api.util.AEColor;
import net.minecraft.world.ILightReader;
/**
@@ -43,7 +44,7 @@ public class StaticBlockColor implements IBlockColor
}
@Override
public int colorMultiplier( BlockState state, @Nullable IBlockReader worldIn, @Nullable BlockPos pos, int tintIndex )
public int getColor( BlockState state, @Nullable ILightReader worldIn, @Nullable BlockPos pos, int tintIndex )
{
return this.color.getVariantByTintIndex( tintIndex );
}
@@ -0,0 +1,51 @@
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.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
// Derived from Vanilla's BreakingParticle, but allows
// a texture to be specified directly rather than via an itemstack
@OnlyIn(Dist.CLIENT)
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, double speedZ, TextureAtlasSprite sprite) {
super(world, x, y, z, speedX, speedY, speedZ);
this.setSprite(sprite);
this.particleGravity = 1.0F;
this.particleScale /= 2.0F;
this.field_217571_C = this.rand.nextFloat() * 3.0F;
this.field_217572_F = this.rand.nextFloat() * 3.0F;
}
public CableBusBreakingParticle(World world, double x, double y, double z, TextureAtlasSprite sprite) {
this(world, x, y, z, 0, 0, 0, sprite);
}
public IParticleRenderType getRenderType() {
return IParticleRenderType.TERRAIN_SHEET;
}
protected float getMinU() {
return this.sprite.getInterpolatedU((this.field_217571_C + 1.0F) / 4.0F * 16.0F);
}
protected float getMaxU() {
return this.sprite.getInterpolatedU(this.field_217571_C / 4.0F * 16.0F);
}
protected float getMinV() {
return this.sprite.getInterpolatedV(this.field_217572_F / 4.0F * 16.0F);
}
protected float getMaxV() {
return this.sprite.getInterpolatedV((this.field_217572_F + 1.0F) / 4.0F * 16.0F);
}
}
@@ -22,14 +22,13 @@ package appeng.client.render.renderable;
import java.nio.FloatBuffer;
import java.util.function.Function;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.BufferUtils;
import org.lwjgl.util.vector.Matrix4f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -45,28 +44,22 @@ public class ItemRenderable<T extends TileEntity> implements Renderable<T>
}
@Override
public void renderTileEntityAt( T te, double x, double y, double z, float partialTicks, int destroyStage )
public void renderTileEntityAt(T te, float partialTicks, com.mojang.blaze3d.matrix.MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay)
{
Pair<ItemStack, Matrix4f> pair = this.f.apply( te );
if( pair != null && pair.getLeft() != null )
{
GlStateManager.pushMatrix();
matrixStack.push();
if( pair.getRight() != null )
{
FloatBuffer matrix = BufferUtils.createFloatBuffer( 16 );
pair.getRight().store( matrix );
matrix.flip();
GlStateManager.multMatrix( matrix );
// FIXME pair.getRight().store( matrix );
// FIXME matrix.flip();
// FIXME matrixStack.( matrix );
}
Minecraft.getInstance().getRenderItem().renderItem( pair.getLeft(), TransformType.GROUND );
GlStateManager.popMatrix();
Minecraft.getInstance().getItemRenderer().renderItem( pair.getLeft(), ItemCameraTransforms.TransformType.GROUND, combinedLight, combinedOverlay, matrixStack, buffers );
matrixStack.pop();
}
}
@Override
public void renderTileEntityFast( T te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer )
{
}
}
@@ -19,15 +19,14 @@
package appeng.client.render.renderable;
import net.minecraft.client.renderer.BufferBuilder;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.tileentity.TileEntity;
public interface Renderable<T extends TileEntity>
{
public void renderTileEntityAt( T te, double x, double y, double z, float partialTicks, int destroyStage );
public void renderTileEntityFast( T te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer );
void renderTileEntityAt(T te, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay);
}
@@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -45,13 +45,14 @@ public class SpatialPylonRendering extends BlockRenderingCustomizer
@OnlyIn( Dist.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.builtInModel( MODEL_ID.getResourcePath(), new SpatialPylonModel() );
rendering.stateMapper( this::mapState );
rendering.renderType(RenderType.getCutout());
// FIXME rendering.builtInModel( MODEL_ID.getResourcePath(), new SpatialPylonModel() );
// FIXME rendering.stateMapper( this::mapState );
}
private Map<BlockState, ModelResourceLocation> mapState( Block block )
{
return ImmutableMap.of( block.getDefaultState(), new ModelResourceLocation( MODEL_ID, "normal" ) );
}
// FIXME private Map<BlockState, ModelResourceLocation> mapState( Block block )
// FIXME {
// FIXME return ImmutableMap.of( block.getDefaultState(), new ModelResourceLocation( MODEL_ID, "normal" ) );
// FIXME }
}
@@ -1,56 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 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, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 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 Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.spatial;
import net.minecraftforge.common.property.IUnlistedProperty;
/**
* Models the rendering state of the spatial pylon, which is largely determined by the state of neighboring tiles.
*/
public class SpatialPylonStateProperty implements IUnlistedProperty<Integer>
{
@Override
public String getName()
{
return "spatial_state";
}
@Override
public boolean isValid( Integer value )
{
int val = value;
// The lower 6 bits are used
return ( val & ~0x3F ) == 0;
}
@Override
public Class<Integer> getType()
{
return Integer.class;
}
@Override
public String valueToString( Integer value )
{
return value.toString();
}
}
@@ -19,8 +19,8 @@
package appeng.client.render.tesr;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
@@ -32,32 +32,34 @@ import appeng.client.render.FacingToRotation;
import appeng.client.render.renderable.Renderable;
import appeng.tile.AEBaseTile;
import java.util.List;
@OnlyIn( Dist.CLIENT )
public class ModularTESR<T extends AEBaseTile> extends TileEntityRenderer<T>
{
private final Renderable[] renderables;
private final List<Renderable<? super T>> renderables;
public ModularTESR( TileEntityRendererDispatcher rendererDispatcherIn, Renderable... renderables )
@SafeVarargs
public ModularTESR( TileEntityRendererDispatcher rendererDispatcherIn, Renderable<? super T>... renderables )
{
super( rendererDispatcherIn );
this.renderables = renderables;
this.renderables = ImmutableList.copyOf(renderables);
}
@Override
public void render( T te, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn )
public void render( T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay )
{
GlStateManager.pushMatrix();
GlStateManager.translate( x, y, z );
GlStateManager.translate( 0.5, 0.5, 0.5 );
FacingToRotation.get( te.getForward(), te.getUp() ).push(matrixStackIn);
GlStateManager.translate( -0.5, -0.5, -0.5 );
for( Renderable renderable : this.renderables )
ms.push();
ms.translate( 0.5, 0.5, 0.5 );
FacingToRotation.get( te.getForward(), te.getUp() ).push(ms);
ms.translate( -0.5, -0.5, -0.5 );
for( Renderable<? super T> renderable : this.renderables )
{
renderable.renderTileEntityAt( te, x, y, z, partialTicks, destroyStage );
renderable.renderTileEntityAt( te, partialTicks, ms, buffers, combinedLight, combinedOverlay);
}
GlStateManager.popMatrix();
ms.pop();
}
}