1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
@@ -26,10 +26,10 @@ import java.util.EnumSet;
import java.util.List;
import java.util.function.Function;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import appeng.api.util.AECableType;
@@ -159,7 +159,7 @@ class CableBuilder
}
}
public void addGlassConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
public void addGlassConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -201,7 +201,7 @@ class CableBuilder
}
}
public void addStraightGlassConnection( EnumFacing facing, AEColor cableColor, List<BakedQuad> quadsOut )
public void addStraightGlassConnection( Direction facing, AEColor cableColor, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -229,7 +229,7 @@ class CableBuilder
}
}
public void addConstrainedGlassConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
public void addConstrainedGlassConnection( Direction facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
{
// Glass connections reach only 6 voxels from the edge
@@ -266,7 +266,7 @@ class CableBuilder
}
}
public void addCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
public void addCoveredConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -286,7 +286,7 @@ class CableBuilder
addCoveredCableSizedCube( facing, cubeBuilder );
}
public void addStraightCoveredConnection( EnumFacing facing, AEColor cableColor, List<BakedQuad> quadsOut )
public void addStraightCoveredConnection( Direction facing, AEColor cableColor, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -299,35 +299,35 @@ class CableBuilder
}
private static void setStraightCableUVs( CubeBuilder cubeBuilder, EnumFacing facing, int x, int y )
private static void setStraightCableUVs( CubeBuilder cubeBuilder, Direction facing, int x, int y )
{
switch( facing )
{
case DOWN:
case UP:
cubeBuilder.setCustomUv( EnumFacing.NORTH, x, 0, y, x );
cubeBuilder.setCustomUv( EnumFacing.EAST, x, 0, y, x );
cubeBuilder.setCustomUv( EnumFacing.SOUTH, x, 0, y, x );
cubeBuilder.setCustomUv( EnumFacing.WEST, x, 0, y, x );
cubeBuilder.setCustomUv( Direction.NORTH, x, 0, y, x );
cubeBuilder.setCustomUv( Direction.EAST, x, 0, y, x );
cubeBuilder.setCustomUv( Direction.SOUTH, x, 0, y, x );
cubeBuilder.setCustomUv( Direction.WEST, x, 0, y, x );
break;
case EAST:
case WEST:
cubeBuilder.setCustomUv( EnumFacing.UP, 0, x, x, y );
cubeBuilder.setCustomUv( EnumFacing.DOWN, 0, x, x, y );
cubeBuilder.setCustomUv( EnumFacing.NORTH, 0, x, x, y );
cubeBuilder.setCustomUv( EnumFacing.SOUTH, 0, x, x, y );
cubeBuilder.setCustomUv( Direction.UP, 0, x, x, y );
cubeBuilder.setCustomUv( Direction.DOWN, 0, x, x, y );
cubeBuilder.setCustomUv( Direction.NORTH, 0, x, x, y );
cubeBuilder.setCustomUv( Direction.SOUTH, 0, x, x, y );
break;
case NORTH:
case SOUTH:
cubeBuilder.setCustomUv( EnumFacing.UP, x, 0, y, x );
cubeBuilder.setCustomUv( EnumFacing.DOWN, x, 0, y, x );
cubeBuilder.setCustomUv( EnumFacing.EAST, 0, x, x, y );
cubeBuilder.setCustomUv( EnumFacing.WEST, 0, x, x, y );
cubeBuilder.setCustomUv( Direction.UP, x, 0, y, x );
cubeBuilder.setCustomUv( Direction.DOWN, x, 0, y, x );
cubeBuilder.setCustomUv( Direction.EAST, 0, x, x, y );
cubeBuilder.setCustomUv( Direction.WEST, 0, x, x, y );
break;
}
}
public void addConstrainedCoveredConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
public void addConstrainedCoveredConnection( Direction facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
{
// The core of a covered cable reaches up to 5 voxels from the block edge, so
// drawing a connection can only occur from there onwards
@@ -345,7 +345,7 @@ class CableBuilder
}
public void addSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
public void addSmartConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
{
if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
{
@@ -399,7 +399,7 @@ class CableBuilder
addCoveredCableSizedCube( facing, cubeBuilder );
}
public void addStraightSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
public void addStraightSmartConnection( Direction facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -425,7 +425,7 @@ class CableBuilder
addStraightCoveredCableSizedCube( facing, cubeBuilder );
}
public void addConstrainedSmartConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, int channels, List<BakedQuad> quadsOut )
public void addConstrainedSmartConnection( Direction facing, AEColor cableColor, int distanceFromEdge, int channels, List<BakedQuad> quadsOut )
{
// Same as with covered cables, the smart cable's core extends up to 5 voxels away from the edge.
// Drawing a connection to any point before that point is fruitless
@@ -456,7 +456,7 @@ class CableBuilder
addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder );
}
public void addDenseCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
public void addDenseCoveredConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
{
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
if( connectionType == AECableType.COVERED || connectionType == AECableType.SMART || connectionType == AECableType.GLASS )
@@ -480,7 +480,7 @@ class CableBuilder
cubeBuilder.setTexture( texture );
}
public void addDenseSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
public void addDenseSmartConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
{
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
if( connectionType == AECableType.SMART )
@@ -532,7 +532,7 @@ class CableBuilder
}
public void addStraightDenseCoveredConnection( EnumFacing facing, AEColor cableColor, List<BakedQuad> quadsOut )
public void addStraightDenseCoveredConnection( Direction facing, AEColor cableColor, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -544,7 +544,7 @@ class CableBuilder
addStraightDenseCableSizedCube( facing, cubeBuilder );
}
public void addStraightDenseSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
public void addStraightDenseSmartConnection( Direction facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -573,7 +573,7 @@ class CableBuilder
addStraightDenseCableSizedCube( facing, cubeBuilder );
}
private static void addDenseCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
private static void addDenseCableSizedCube( Direction facing, CubeBuilder cubeBuilder )
{
switch( facing )
{
@@ -600,31 +600,31 @@ class CableBuilder
// Adds a cube to the given cube builder that has the size of a dense cable connection and spans the entire block
// for the given direction
private static void addStraightDenseCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
private static void addStraightDenseCableSizedCube( Direction facing, CubeBuilder cubeBuilder )
{
switch( facing )
{
case DOWN:
case UP:
cubeBuilder.setUvRotation( EnumFacing.EAST, 3 );
cubeBuilder.setUvRotation( Direction.EAST, 3 );
cubeBuilder.addCube( 3, 0, 3, 13, 16, 13 );
cubeBuilder.setUvRotation( EnumFacing.EAST, 0 );
cubeBuilder.setUvRotation( Direction.EAST, 0 );
break;
case EAST:
case WEST:
cubeBuilder.setUvRotation( EnumFacing.SOUTH, 3 );
cubeBuilder.setUvRotation( EnumFacing.NORTH, 3 );
cubeBuilder.setUvRotation( Direction.SOUTH, 3 );
cubeBuilder.setUvRotation( Direction.NORTH, 3 );
cubeBuilder.addCube( 0, 3, 3, 16, 13, 13 );
cubeBuilder.setUvRotation( EnumFacing.SOUTH, 0 );
cubeBuilder.setUvRotation( EnumFacing.NORTH, 0 );
cubeBuilder.setUvRotation( Direction.SOUTH, 0 );
cubeBuilder.setUvRotation( Direction.NORTH, 0 );
break;
case NORTH:
case SOUTH:
cubeBuilder.setUvRotation( EnumFacing.EAST, 3 );
cubeBuilder.setUvRotation( EnumFacing.WEST, 3 );
cubeBuilder.setUvRotation( Direction.EAST, 3 );
cubeBuilder.setUvRotation( Direction.WEST, 3 );
cubeBuilder.addCube( 3, 3, 0, 13, 13, 16 );
cubeBuilder.setUvRotation( EnumFacing.EAST, 0 );
cubeBuilder.setUvRotation( EnumFacing.WEST, 0 );
cubeBuilder.setUvRotation( Direction.EAST, 0 );
cubeBuilder.setUvRotation( Direction.WEST, 0 );
break;
}
@@ -632,7 +632,7 @@ class CableBuilder
// Adds a cube to the given cube builder that has the size of a covered cable connection from the core of the cable
// to the given face
private static void addCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
private static void addCoveredCableSizedCube( Direction facing, CubeBuilder cubeBuilder )
{
switch( facing )
{
@@ -659,36 +659,36 @@ class CableBuilder
// Adds a cube to the given cube builder that has the size of a covered cable connection and spans the entire block
// for the given direction
private static void addStraightCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
private static void addStraightCoveredCableSizedCube( Direction facing, CubeBuilder cubeBuilder )
{
switch( facing )
{
case DOWN:
case UP:
cubeBuilder.setUvRotation( EnumFacing.EAST, 3 );
cubeBuilder.setUvRotation( Direction.EAST, 3 );
cubeBuilder.addCube( 5, 0, 5, 11, 16, 11 );
cubeBuilder.setUvRotation( EnumFacing.EAST, 0 );
cubeBuilder.setUvRotation( Direction.EAST, 0 );
break;
case EAST:
case WEST:
cubeBuilder.setUvRotation( EnumFacing.SOUTH, 3 );
cubeBuilder.setUvRotation( EnumFacing.NORTH, 3 );
cubeBuilder.setUvRotation( Direction.SOUTH, 3 );
cubeBuilder.setUvRotation( Direction.NORTH, 3 );
cubeBuilder.addCube( 0, 5, 5, 16, 11, 11 );
cubeBuilder.setUvRotation( EnumFacing.SOUTH, 0 );
cubeBuilder.setUvRotation( EnumFacing.NORTH, 0 );
cubeBuilder.setUvRotation( Direction.SOUTH, 0 );
cubeBuilder.setUvRotation( Direction.NORTH, 0 );
break;
case NORTH:
case SOUTH:
cubeBuilder.setUvRotation( EnumFacing.EAST, 3 );
cubeBuilder.setUvRotation( EnumFacing.WEST, 3 );
cubeBuilder.setUvRotation( Direction.EAST, 3 );
cubeBuilder.setUvRotation( Direction.WEST, 3 );
cubeBuilder.addCube( 5, 5, 0, 11, 11, 16 );
cubeBuilder.setUvRotation( EnumFacing.EAST, 0 );
cubeBuilder.setUvRotation( EnumFacing.WEST, 0 );
cubeBuilder.setUvRotation( Direction.EAST, 0 );
cubeBuilder.setUvRotation( Direction.WEST, 0 );
break;
}
}
private static void addCoveredCableSizedCube( EnumFacing facing, int distanceFromEdge, CubeBuilder cubeBuilder )
private static void addCoveredCableSizedCube( Direction facing, int distanceFromEdge, CubeBuilder cubeBuilder )
{
switch( facing )
{
@@ -719,7 +719,7 @@ class CableBuilder
* that do not want to be connected to using a glass cable connection. This applies to most machines (interfaces,
* etc.)
*/
private void addBigCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
private void addBigCoveredCableSizedCube( Direction facing, CubeBuilder cubeBuilder )
{
switch( facing )
{
@@ -30,16 +30,16 @@ import java.util.Map.Entry;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.property.IExtendedBlockState;
@@ -64,7 +64,7 @@ public class CableBusBakedModel implements IBakedModel
private final TextureAtlasSprite particleTexture;
private final TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
private final TextureMap textureMap = Minecraft.getInstance().getTextureMapBlocks();
CableBusBakedModel( CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map<ResourceLocation, IBakedModel> partModels, TextureAtlasSprite particleTexture )
{
@@ -75,7 +75,7 @@ public class CableBusBakedModel implements IBakedModel
}
@Override
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, long rand )
{
CableBusRenderState renderState = getRenderingState( state );
@@ -104,7 +104,7 @@ public class CableBusBakedModel implements IBakedModel
quads.addAll( cableModel );
// Then handle attachments
for( EnumFacing facing : EnumFacing.values() )
for( Direction facing : Direction.values() )
{
final IPartModel partModel = renderState.getAttachments().get( facing );
if( partModel == null )
@@ -133,7 +133,7 @@ public class CableBusBakedModel implements IBakedModel
// Rotate quads accordingly
QuadRotator rotator = new QuadRotator();
partQuads = rotator.rotateQuads( partQuads, facing, EnumFacing.UP );
partQuads = rotator.rotateQuads( partQuads, facing, Direction.UP );
quads.addAll( partQuads );
}
@@ -145,16 +145,16 @@ public class CableBusBakedModel implements IBakedModel
}
// Determines whether a cable is connected to exactly two sides that are opposite each other
private static boolean isStraightLine( AECableType cableType, EnumMap<EnumFacing, AECableType> sides )
private static boolean isStraightLine( AECableType cableType, EnumMap<Direction, AECableType> sides )
{
final Iterator<Entry<EnumFacing, AECableType>> it = sides.entrySet().iterator();
final Iterator<Entry<Direction, AECableType>> it = sides.entrySet().iterator();
if( !it.hasNext() )
{
return false; // No connections
}
final Entry<EnumFacing, AECableType> nextConnection = it.next();
final EnumFacing firstSide = nextConnection.getKey();
final Entry<Direction, AECableType> nextConnection = it.next();
final Direction firstSide = nextConnection.getKey();
final AECableType firstType = nextConnection.getValue();
if( !it.hasNext() )
@@ -184,14 +184,14 @@ public class CableBusBakedModel implements IBakedModel
}
AEColor cableColor = renderState.getCableColor();
EnumMap<EnumFacing, AECableType> connectionTypes = renderState.getConnectionTypes();
EnumMap<Direction, AECableType> connectionTypes = renderState.getConnectionTypes();
// If the connection is straight, no busses are attached, and no covered core has been forced (in case of glass
// cables), then render the cable as a simplified straight line.
boolean noAttachments = !renderState.getAttachments().values().stream().anyMatch( IPartModel::requireCableConnection );
if( noAttachments && isStraightLine( cableType, connectionTypes ) )
{
EnumFacing facing = connectionTypes.keySet().iterator().next();
Direction facing = connectionTypes.keySet().iterator().next();
switch( cableType )
{
@@ -220,8 +220,8 @@ public class CableBusBakedModel implements IBakedModel
this.cableBuilder.addCableCore( renderState.getCoreType(), cableColor, quadsOut );
// Render all internal connections to attachments
EnumMap<EnumFacing, Integer> attachmentConnections = renderState.getAttachmentConnections();
for( EnumFacing facing : attachmentConnections.keySet() )
EnumMap<Direction, Integer> attachmentConnections = renderState.getAttachmentConnections();
for( Direction facing : attachmentConnections.keySet() )
{
int distance = attachmentConnections.get( facing );
int channels = renderState.getChannelsOnSide().get( facing );
@@ -247,9 +247,9 @@ public class CableBusBakedModel implements IBakedModel
}
// Render all outgoing connections using the appropriate type
for( final Entry<EnumFacing, AECableType> connection : connectionTypes.entrySet() )
for( final Entry<Direction, AECableType> connection : connectionTypes.entrySet() )
{
final EnumFacing facing = connection.getKey();
final Direction facing = connection.getKey();
final AECableType connectionType = connection.getValue();
final boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
final int channels = renderState.getChannelsOnSide().get( facing );
@@ -293,7 +293,7 @@ public class CableBusBakedModel implements IBakedModel
}
// If no core is present, just use the first part that comes into play
for( EnumFacing side : renderState.getAttachments().keySet() )
for( Direction side : renderState.getAttachments().keySet() )
{
IPartModel partModel = renderState.getAttachments().get( side );
@@ -320,7 +320,7 @@ public class CableBusBakedModel implements IBakedModel
return result;
}
private static CableBusRenderState getRenderingState( IBlockState state )
private static CableBusRenderState getRenderingState( BlockState state )
{
if( state == null || !( state instanceof IExtendedBlockState ) )
{
@@ -26,10 +26,10 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Objects;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
@@ -52,28 +52,28 @@ public class CableBusRenderState
private AEColor cableColor = AEColor.TRANSPARENT;
// Describes the outgoing connections of this cable bus to other blocks, and how they should be rendered
private EnumMap<EnumFacing, AECableType> connectionTypes = new EnumMap<>( EnumFacing.class );
private EnumMap<Direction, AECableType> connectionTypes = new EnumMap<>( Direction.class );
// Indicate on which sides signified by connectionTypes above, there is another cable bus. If a side is connected,
// but it is absent from this
// set, then it means that there is a Grid host, but not a cable bus on that side (i.e. an interface, a controller,
// etc.)
private EnumSet<EnumFacing> cableBusAdjacent = EnumSet.noneOf( EnumFacing.class );
private EnumSet<Direction> cableBusAdjacent = EnumSet.noneOf( Direction.class );
// Specifies the number of channels used for the connection to a given side. Only contains entries if
// connections contains a corresponding entry.
private EnumMap<EnumFacing, Integer> channelsOnSide = new EnumMap<>( EnumFacing.class );
private EnumMap<Direction, Integer> channelsOnSide = new EnumMap<>( Direction.class );
private EnumMap<EnumFacing, IPartModel> attachments = new EnumMap<>( EnumFacing.class );
private EnumMap<Direction, IPartModel> attachments = new EnumMap<>( Direction.class );
// For each attachment, this contains the distance from the edge until which a cable connection should be drawn
private EnumMap<EnumFacing, Integer> attachmentConnections = new EnumMap<>( EnumFacing.class );
private EnumMap<Direction, Integer> attachmentConnections = new EnumMap<>( Direction.class );
// Contains the facade to use for each side that has a facade attached
private EnumMap<EnumFacing, FacadeRenderState> facades = new EnumMap<>( EnumFacing.class );
private EnumMap<Direction, FacadeRenderState> facades = new EnumMap<>( Direction.class );
// Used for Facades.
private WeakReference<IBlockAccess> world;
private WeakReference<IBlockReader> world;
private BlockPos pos;
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This
@@ -81,7 +81,7 @@ public class CableBusRenderState
// facades on this cable bus
private List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
private EnumMap<EnumFacing, Long> partFlags = new EnumMap<>( EnumFacing.class );
private EnumMap<Direction, Long> partFlags = new EnumMap<>( Direction.class );
public CableCoreType getCoreType()
{
@@ -113,57 +113,57 @@ public class CableBusRenderState
this.cableColor = cableColor;
}
public EnumMap<EnumFacing, Integer> getChannelsOnSide()
public EnumMap<Direction, Integer> getChannelsOnSide()
{
return this.channelsOnSide;
}
public EnumMap<EnumFacing, AECableType> getConnectionTypes()
public EnumMap<Direction, AECableType> getConnectionTypes()
{
return this.connectionTypes;
}
public void setConnectionTypes( EnumMap<EnumFacing, AECableType> connectionTypes )
public void setConnectionTypes( EnumMap<Direction, AECableType> connectionTypes )
{
this.connectionTypes = connectionTypes;
}
public void setChannelsOnSide( EnumMap<EnumFacing, Integer> channelsOnSide )
public void setChannelsOnSide( EnumMap<Direction, Integer> channelsOnSide )
{
this.channelsOnSide = channelsOnSide;
}
public EnumSet<EnumFacing> getCableBusAdjacent()
public EnumSet<Direction> getCableBusAdjacent()
{
return this.cableBusAdjacent;
}
public void setCableBusAdjacent( EnumSet<EnumFacing> cableBusAdjacent )
public void setCableBusAdjacent( EnumSet<Direction> cableBusAdjacent )
{
this.cableBusAdjacent = cableBusAdjacent;
}
public EnumMap<EnumFacing, IPartModel> getAttachments()
public EnumMap<Direction, IPartModel> getAttachments()
{
return this.attachments;
}
public EnumMap<EnumFacing, Integer> getAttachmentConnections()
public EnumMap<Direction, Integer> getAttachmentConnections()
{
return this.attachmentConnections;
}
public EnumMap<EnumFacing, FacadeRenderState> getFacades()
public EnumMap<Direction, FacadeRenderState> getFacades()
{
return this.facades;
}
public IBlockAccess getWorld()
public IBlockReader getWorld()
{
return this.world.get();
}
public void setWorld( IBlockAccess world )
public void setWorld( IBlockReader world )
{
this.world = new WeakReference<>( world );
}
@@ -183,7 +183,7 @@ public class CableBusRenderState
return this.boundingBoxes;
}
public EnumMap<EnumFacing, Long> getPartFlags()
public EnumMap<Direction, Long> getPartFlags()
{
return this.partFlags;
}
@@ -24,16 +24,15 @@ import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
import javax.vecmath.Vector4f;
import com.google.common.base.Preconditions;
import net.minecraft.client.renderer.block.model.BakedQuad;
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.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import appeng.client.render.VertexFormats;
@@ -49,13 +48,13 @@ public class CubeBuilder
private final List<BakedQuad> output;
private final EnumMap<EnumFacing, TextureAtlasSprite> textures = new EnumMap<>( EnumFacing.class );
private final EnumMap<Direction, TextureAtlasSprite> textures = new EnumMap<>( Direction.class );
private EnumSet<EnumFacing> drawFaces = EnumSet.allOf( EnumFacing.class );
private EnumSet<Direction> drawFaces = EnumSet.allOf( Direction.class );
private final EnumMap<EnumFacing, Vector4f> customUv = new EnumMap<>( EnumFacing.class );
private final EnumMap<Direction, Vector4f> customUv = new EnumMap<>( Direction.class );
private byte[] uvRotations = new byte[EnumFacing.values().length];
private byte[] uvRotations = new byte[Direction.values().length];
private int color = 0xFFFFFFFF;
@@ -92,7 +91,7 @@ public class CubeBuilder
this.format = VertexFormats.getFormatWithLightMap( this.format );
}
for( EnumFacing face : this.drawFaces )
for( Direction face : this.drawFaces )
{
this.putFace( face, x1, y1, z1, x2, y2, z2 );
}
@@ -104,7 +103,7 @@ public class CubeBuilder
}
}
public void addQuad( EnumFacing face, float x1, float y1, float z1, float x2, float y2, float z2 )
public void addQuad( Direction face, float x1, float y1, float z1, float x2, float y2, float z2 )
{
// If brightness is forced to specific values, extend the vertex format to contain the multi-texturing lightmap
// offset
@@ -136,7 +135,7 @@ public class CubeBuilder
float v2;
}
private void putFace( EnumFacing face, float x1, float y1, float z1, float x2, float y2, float z2 )
private void putFace( Direction face, float x1, float y1, float z1, float x2, float y2, float z2 )
{
TextureAtlasSprite texture = this.textures.get( face );
@@ -210,7 +209,7 @@ public class CubeBuilder
this.output.add( builder.build() );
}
private UvVector getDefaultUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
private UvVector getDefaultUv( Direction face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
{
UvVector uv = new UvVector();
@@ -258,7 +257,7 @@ public class CubeBuilder
return uv;
}
private UvVector getStandardUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
private UvVector getStandardUv( Direction face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
{
UvVector uv = new UvVector();
switch( face )
@@ -304,7 +303,7 @@ public class CubeBuilder
}
// uv.u1, uv.v1
private void putVertexTL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
private void putVertexTL( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv )
{
float u, v;
@@ -333,7 +332,7 @@ public class CubeBuilder
}
// uv.u2, uv.v1
private void putVertexTR( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
private void putVertexTR( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv )
{
float u, v;
@@ -361,7 +360,7 @@ public class CubeBuilder
}
// uv.u2, uv.v2
private void putVertexBR( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
private void putVertexBR( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv )
{
float u;
@@ -392,7 +391,7 @@ public class CubeBuilder
}
// uv.u1, uv.v2
private void putVertexBL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
private void putVertexBL( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv )
{
float u;
@@ -422,7 +421,7 @@ public class CubeBuilder
this.putVertex( builder, face, x, y, z, u, v );
}
private void putVertex( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, float u, float v )
private void putVertex( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, float u, float v )
{
VertexFormat format = builder.getVertexFormat();
@@ -468,7 +467,7 @@ public class CubeBuilder
public void setTexture( TextureAtlasSprite texture )
{
for( EnumFacing face : EnumFacing.values() )
for( Direction face : Direction.values() )
{
this.textures.put( face, texture );
}
@@ -476,20 +475,20 @@ public class CubeBuilder
public void setTextures( TextureAtlasSprite up, TextureAtlasSprite down, TextureAtlasSprite north, TextureAtlasSprite south, TextureAtlasSprite east, TextureAtlasSprite west )
{
this.textures.put( EnumFacing.UP, up );
this.textures.put( EnumFacing.DOWN, down );
this.textures.put( EnumFacing.NORTH, north );
this.textures.put( EnumFacing.SOUTH, south );
this.textures.put( EnumFacing.EAST, east );
this.textures.put( EnumFacing.WEST, west );
this.textures.put( Direction.UP, up );
this.textures.put( Direction.DOWN, down );
this.textures.put( Direction.NORTH, north );
this.textures.put( Direction.SOUTH, south );
this.textures.put( Direction.EAST, east );
this.textures.put( Direction.WEST, west );
}
public void setTexture( EnumFacing facing, TextureAtlasSprite sprite )
public void setTexture( Direction facing, TextureAtlasSprite sprite )
{
this.textures.put( facing, sprite );
}
public void setDrawFaces( EnumSet<EnumFacing> drawFaces )
public void setDrawFaces( EnumSet<Direction> drawFaces )
{
this.drawFaces = drawFaces;
}
@@ -517,12 +516,12 @@ public class CubeBuilder
this.renderFullBright = renderFullBright;
}
public void setCustomUv( EnumFacing facing, float u1, float v1, float u2, float v2 )
public void setCustomUv( Direction facing, float u1, float v1, float u2, float v2 )
{
this.customUv.put( facing, new Vector4f( u1, v1, u2, v2 ) );
}
public void setUvRotation( EnumFacing facing, int rotation )
public void setUvRotation( Direction facing, int rotation )
{
if( rotation == 2 )
{
@@ -21,30 +21,30 @@ package appeng.client.render.cablebus;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.Biome;
/**
* This is used to retrieve the ExtendedState of a block for facade rendering.
* It fakes the block at BlockPos provided as the IBlockState provided.
* It fakes the block at BlockPos provided as the BlockState provided.
*
* @author covers1624
*/
public class FacadeBlockAccess implements IBlockAccess
public class FacadeBlockAccess implements IBlockReader
{
private final IBlockAccess world;
private final IBlockReader world;
private final BlockPos pos;
private final EnumFacing side;
private final IBlockState state;
private final Direction side;
private final BlockState state;
public FacadeBlockAccess( IBlockAccess world, BlockPos pos, EnumFacing side, IBlockState state )
public FacadeBlockAccess( IBlockReader world, BlockPos pos, Direction side, BlockState state )
{
this.world = world;
this.pos = pos;
@@ -66,7 +66,7 @@ public class FacadeBlockAccess implements IBlockAccess
}
@Override
public IBlockState getBlockState( BlockPos pos )
public BlockState getBlockState( BlockPos pos )
{
if( this.pos == pos )
{
@@ -78,7 +78,7 @@ public class FacadeBlockAccess implements IBlockAccess
@Override
public boolean isAirBlock( BlockPos pos )
{
IBlockState state = this.getBlockState( pos );
BlockState state = this.getBlockState( pos );
return state.getBlock().isAir( state, this.world, pos );
}
@@ -89,7 +89,7 @@ public class FacadeBlockAccess implements IBlockAccess
}
@Override
public int getStrongPower( BlockPos pos, EnumFacing direction )
public int getStrongPower( BlockPos pos, Direction direction )
{
return this.world.getStrongPower( pos, direction );
}
@@ -101,7 +101,7 @@ public class FacadeBlockAccess implements IBlockAccess
}
@Override
public boolean isSideSolid( BlockPos pos, EnumFacing side, boolean _default )
public boolean isSideSolid( BlockPos pos, Direction side, boolean _default )
{
if( pos.getX() < -30000000 || pos.getZ() < -30000000 || pos.getX() >= 30000000 || pos.getZ() >= 30000000 )
{
@@ -29,20 +29,20 @@ import java.util.function.Function;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.Direction;
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.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.client.ForgeHooksClient;
import appeng.api.AEApi;
@@ -110,17 +110,17 @@ public class FacadeBuilder
BakedPipeline pipeline = this.pipelines.get();
Quad collectorQuad = this.collectors.get();
boolean transparent = AEApi.instance().partHelper().getCableRenderMode().transparentFacades;
Map<EnumFacing, FacadeRenderState> facadeStates = renderState.getFacades();
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
List<AxisAlignedBB> partBoxes = renderState.getBoundingBoxes();
Set<EnumFacing> sidesWithParts = renderState.getAttachments().keySet();
IBlockAccess parentWorld = renderState.getWorld();
Set<Direction> sidesWithParts = renderState.getAttachments().keySet();
IBlockReader parentWorld = renderState.getWorld();
BlockPos pos = renderState.getPos();
BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
BlockColors blockColors = Minecraft.getInstance().getBlockColors();
boolean thinFacades = isUseThinFacades( partBoxes );
for( Entry<EnumFacing, FacadeRenderState> entry : facadeStates.entrySet() )
for( Entry<Direction, FacadeRenderState> entry : facadeStates.entrySet() )
{
EnumFacing side = entry.getKey();
Direction side = entry.getKey();
int sideIndex = side.ordinal();
FacadeRenderState facadeRenderState = entry.getValue();
boolean renderStilt = !sidesWithParts.contains( side );
@@ -130,7 +130,7 @@ public class FacadeBuilder
{
IBakedModel partModel = modelLookup.apply( part );
QuadRotator rotator = new QuadRotator();
quads.addAll( rotator.rotateQuads( gatherQuads( partModel, null, rand ), side, EnumFacing.UP ) );
quads.addAll( rotator.rotateQuads( gatherQuads( partModel, null, rand ), side, Direction.UP ) );
}
}
// If we are forcing transparency and this isn't the Translucent layer.
@@ -139,7 +139,7 @@ public class FacadeBuilder
continue;
}
IBlockState blockState = facadeRenderState.getSourceBlock();
BlockState blockState = facadeRenderState.getSourceBlock();
// If we aren't forcing transparency let the block decide if it should render.
if( !transparent && layer != null )
{
@@ -156,7 +156,7 @@ public class FacadeBuilder
{
double offset = thinFacades ? THIN_THICKNESS : THICK_THICKNESS;
AEAxisAlignedBB tmpBB = null;
for( EnumFacing face : EnumFacing.VALUES )
for( Direction face : Direction.VALUES )
{
// Only faces that aren't on our axis
if( face.getAxis() != side.getAxis() )
@@ -202,9 +202,9 @@ public class FacadeBuilder
AEAxisAlignedBB cutOutBox = getCutOutBox( facadeBox, partBoxes );
List<AxisAlignedBB> holeStrips = getBoxes( facadeBox, cutOutBox, side.getAxis() );
IBlockAccess facadeAccess = new FacadeBlockAccess( parentWorld, pos, side, blockState );
IBlockReader facadeAccess = new FacadeBlockAccess( parentWorld, pos, side, blockState );
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
try
{
@@ -261,9 +261,9 @@ public class FacadeBuilder
// calculate the side mask.
int facadeMask = 0;
for( Entry<EnumFacing, FacadeRenderState> ent : facadeStates.entrySet() )
for( Entry<Direction, FacadeRenderState> ent : facadeStates.entrySet() )
{
EnumFacing s = ent.getKey();
Direction s = ent.getKey();
if( s.getAxis() != side.getAxis() )
{
FacadeRenderState otherState = ent.getValue();
@@ -324,10 +324,10 @@ public class FacadeBuilder
*
* @return The model.
*/
public List<BakedQuad> buildFacadeItemQuads( ItemStack textureItem, EnumFacing side )
public List<BakedQuad> buildFacadeItemQuads( ItemStack textureItem, Direction side )
{
List<BakedQuad> facadeQuads = new ArrayList<>();
IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides( textureItem, null, null );
IBakedModel model = Minecraft.getInstance().getRenderItem().getItemModelWithOverrides( textureItem, null, null );
List<BakedQuad> modelQuads = gatherQuads( model, null, 0 );
BakedPipeline pipeline = this.pipelines.get();
@@ -348,7 +348,7 @@ public class FacadeBuilder
// If we have a tint index, setup the tinter and enable it.
if( quad.hasTintIndex() )
{
tinter.setTint( Minecraft.getMinecraft().getItemColors().colorMultiplier( textureItem, quad.getTintIndex() ) );
tinter.setTint( Minecraft.getInstance().getItemColors().colorMultiplier( textureItem, quad.getTintIndex() ) );
pipeline.enableElement( "tinter" );
}
// Disable elements we don't need for items.
@@ -370,10 +370,10 @@ public class FacadeBuilder
}
// Helper to gather all quads from a model into a list.
private static List<BakedQuad> gatherQuads( IBakedModel model, IBlockState state, long rand )
private static List<BakedQuad> gatherQuads( IBakedModel model, BlockState state, long rand )
{
List<BakedQuad> modelQuads = new ArrayList<>();
for( EnumFacing face : EnumFacing.VALUES )
for( Direction face : Direction.VALUES )
{
modelQuads.addAll( model.getQuads( state, face, rand ) );
}
@@ -2,7 +2,7 @@
package appeng.client.render.cablebus;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
/**
@@ -12,17 +12,17 @@ public class FacadeRenderState
{
// The block state to use for rendering this facade
private final IBlockState sourceBlock;
private final BlockState sourceBlock;
private final boolean transparent;
public FacadeRenderState( IBlockState sourceBlock, boolean transparent )
public FacadeRenderState( BlockState sourceBlock, boolean transparent )
{
this.sourceBlock = sourceBlock;
this.transparent = transparent;
}
public IBlockState getSourceBlock()
public BlockState getSourceBlock()
{
return this.sourceBlock;
}
@@ -9,13 +9,13 @@ import java.util.concurrent.ExecutionException;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import appeng.api.parts.IPartBakedModel;
import appeng.api.util.AEColor;
@@ -66,7 +66,7 @@ public class P2PTunnelFrequencyBakedModel implements IBakedModel, IPartBakedMode
}
@Override
public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
public List<BakedQuad> getQuads( BlockState state, Direction side, long rand )
{
if( side != null )
{
@@ -26,10 +26,10 @@ import javax.vecmath.Matrix4f;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3f;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import appeng.client.render.FacingToRotation;
import appeng.core.AELog;
@@ -42,9 +42,9 @@ import appeng.core.AELog;
public class QuadRotator
{
public List<BakedQuad> rotateQuads( List<BakedQuad> quads, EnumFacing newForward, EnumFacing newUp )
public List<BakedQuad> rotateQuads( List<BakedQuad> quads, Direction newForward, Direction newUp )
{
if( newForward == EnumFacing.NORTH && newUp == EnumFacing.UP )
if( newForward == Direction.NORTH && newUp == Direction.UP )
{
return quads; // This is the default orientation
}
@@ -59,18 +59,18 @@ public class QuadRotator
return result;
}
private BakedQuad rotateQuad( BakedQuad quad, EnumFacing forward, EnumFacing up )
private BakedQuad rotateQuad( BakedQuad quad, Direction forward, Direction up )
{
// Sanitize forward/up
if( forward.getAxis() == up.getAxis() )
{
if( up.getAxis() == EnumFacing.Axis.Y )
if( up.getAxis() == Direction.Axis.Y )
{
up = EnumFacing.NORTH;
up = Direction.NORTH;
}
else
{
up = EnumFacing.UP;
up = Direction.UP;
}
}
@@ -149,7 +149,7 @@ public class QuadRotator
}
}
EnumFacing newFace = rotation.rotate( quad.getFace() );
Direction newFace = rotation.rotate( quad.getFace() );
return new BakedQuad( newData, quad.getTintIndex(), newFace, quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat() );
}