Format sourcecode
This commit is contained in:
@@ -59,7 +59,8 @@ public class AutoRotatingModel implements IBakedModel
|
||||
{
|
||||
this.parent = parent;
|
||||
// 6 (DUNSWE) * 6 (DUNSWE) * 7 (DUNSWE + null) = 252
|
||||
this.quadCache = CacheBuilder.newBuilder().maximumSize( 252 ).build( new CacheLoader<AutoRotatingCacheKey, List<BakedQuad>>(){
|
||||
this.quadCache = CacheBuilder.newBuilder().maximumSize( 252 ).build( new CacheLoader<AutoRotatingCacheKey, List<BakedQuad>>()
|
||||
{
|
||||
@Override
|
||||
public List<BakedQuad> load( AutoRotatingCacheKey key ) throws Exception
|
||||
{
|
||||
@@ -98,13 +99,8 @@ public class AutoRotatingModel implements IBakedModel
|
||||
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
|
||||
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
|
||||
// to the AO lighter, thus fixing our problem.
|
||||
BakedQuad packedQuad = new BakedQuad( unpackedQuad.getVertexData(),
|
||||
quad.getTintIndex(),
|
||||
unpackedQuad.getFace(),
|
||||
quad.getSprite(),
|
||||
quad.shouldApplyDiffuseLighting(),
|
||||
quad.getFormat()
|
||||
);
|
||||
BakedQuad packedQuad = new BakedQuad( unpackedQuad.getVertexData(), quad.getTintIndex(), unpackedQuad.getFace(), quad.getSprite(), quad
|
||||
.shouldApplyDiffuseLighting(), quad.getFormat() );
|
||||
rotated.add( packedQuad );
|
||||
}
|
||||
return rotated;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
|
||||
@@ -66,7 +67,8 @@ class BiometricCardBakedModel implements IBakedModel
|
||||
this.modelCache = modelCache;
|
||||
}
|
||||
|
||||
private static Cache<Integer, BiometricCardBakedModel> createCache() {
|
||||
private static Cache<Integer, BiometricCardBakedModel> createCache()
|
||||
{
|
||||
return CacheBuilder.newBuilder()
|
||||
.maximumSize( 100 )
|
||||
.build();
|
||||
@@ -124,7 +126,8 @@ class BiometricCardBakedModel implements IBakedModel
|
||||
else
|
||||
{
|
||||
final float scale = 0.3f / 255.0f;
|
||||
builder.setColorRGB( ( ( col.blackVariant >> 16 ) & 0xff ) * scale, ( ( col.blackVariant >> 8 ) & 0xff ) * scale, ( col.blackVariant & 0xff ) * scale );
|
||||
builder.setColorRGB( ( ( col.blackVariant >> 16 ) & 0xff ) * scale, ( ( col.blackVariant >> 8 ) & 0xff ) * scale,
|
||||
( col.blackVariant & 0xff ) * scale );
|
||||
}
|
||||
|
||||
builder.addCube( 4 + x, 6 + y, 7.5f, 4 + x + 1, 6 + y + 1, 8.5f );
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
|
||||
@@ -18,7 +19,8 @@ import appeng.core.AppEng;
|
||||
|
||||
|
||||
/**
|
||||
* Model wrapper for the biometric card item model, which combines a base card layer with a "visual hash" of the player name
|
||||
* Model wrapper for the biometric card item model, which combines a base card layer with a "visual hash" of the player
|
||||
* name
|
||||
*/
|
||||
public class BiometricCardModel implements IModel
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
|
||||
@@ -34,8 +35,7 @@ class ColorApplicatorBakedModel implements IBakedModel
|
||||
|
||||
private final List<BakedQuad> generalQuads;
|
||||
|
||||
ColorApplicatorBakedModel( IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map,
|
||||
TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright )
|
||||
ColorApplicatorBakedModel( IBakedModel baseModel, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright )
|
||||
{
|
||||
this.baseModel = baseModel;
|
||||
this.transforms = map;
|
||||
@@ -75,14 +75,8 @@ class ColorApplicatorBakedModel implements IBakedModel
|
||||
continue;
|
||||
}
|
||||
|
||||
BakedQuad newQuad = new BakedQuad(
|
||||
quad.getVertexData(),
|
||||
tint,
|
||||
quad.getFace(),
|
||||
quad.getSprite(),
|
||||
quad.shouldApplyDiffuseLighting(),
|
||||
quad.getFormat()
|
||||
);
|
||||
BakedQuad newQuad = new BakedQuad( quad.getVertexData(), tint, quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad
|
||||
.getFormat() );
|
||||
result.add( newQuad );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
|
||||
@@ -23,7 +24,8 @@ import appeng.core.AppEng;
|
||||
|
||||
|
||||
/**
|
||||
* A color applicator uses the base model, and extends it with additional layers that are colored according to the selected color of the applicator.
|
||||
* A color applicator uses the base model, and extends it with additional layers that are colored according to the
|
||||
* selected color of the applicator.
|
||||
*/
|
||||
public class ColorApplicatorModel implements IModel
|
||||
{
|
||||
@@ -46,8 +48,7 @@ public class ColorApplicatorModel implements IModel
|
||||
return ImmutableList.of(
|
||||
TEXTURE_DARK,
|
||||
TEXTURE_MEDIUM,
|
||||
TEXTURE_BRIGHT
|
||||
);
|
||||
TEXTURE_BRIGHT );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* 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.model;
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* 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.model;
|
||||
|
||||
|
||||
@@ -49,8 +50,7 @@ public class DriveModel implements IModel
|
||||
DriveSlotState.OFFLINE, new ResourceLocation( "appliedenergistics2:block/drive_cell_off" ),
|
||||
DriveSlotState.ONLINE, new ResourceLocation( "appliedenergistics2:block/drive_cell_on" ),
|
||||
DriveSlotState.TYPES_FULL, new ResourceLocation( "appliedenergistics2:block/drive_cell_types_full" ),
|
||||
DriveSlotState.FULL, new ResourceLocation( "appliedenergistics2:block/drive_cell_full" )
|
||||
);
|
||||
DriveSlotState.FULL, new ResourceLocation( "appliedenergistics2:block/drive_cell_full" ) );
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
|
||||
@@ -134,14 +134,14 @@ class GlassBakedModel implements IBakedModel
|
||||
quads.add( createQuad( side, corners, glassTexture, u, v ) );
|
||||
|
||||
/*
|
||||
This needs some explanation:
|
||||
The bit-field contains 4-bits, one for each direction that a frame may be drawn.
|
||||
Converted to a number, the bit-field is then used as an index into the list of
|
||||
frame textures, which have been created in such a way that their filenames
|
||||
indicate, in which directions they contain borders.
|
||||
i.e. bitmask = 0101 means a border should be drawn up and down (in terms of u,v space).
|
||||
Converted to a number, this bitmask is 5. So the texture at index 5 is used.
|
||||
That texture had "0101" in its filename to indicate this.
|
||||
* This needs some explanation:
|
||||
* The bit-field contains 4-bits, one for each direction that a frame may be drawn.
|
||||
* Converted to a number, the bit-field is then used as an index into the list of
|
||||
* frame textures, which have been created in such a way that their filenames
|
||||
* indicate, in which directions they contain borders.
|
||||
* i.e. bitmask = 0101 means a border should be drawn up and down (in terms of u,v space).
|
||||
* Converted to a number, this bitmask is 5. So the texture at index 5 is used.
|
||||
* That texture had "0101" in its filename to indicate this.
|
||||
*/
|
||||
int edgeBitmask = makeBitmask( glassState, side );
|
||||
TextureAtlasSprite sideSprite = frameTextures[edgeBitmask];
|
||||
@@ -227,8 +227,9 @@ class GlassBakedModel implements IBakedModel
|
||||
}
|
||||
|
||||
/*
|
||||
This method is as complicated as it is, because the order in which we push data into the vertexbuffer actually has to be precisely the order
|
||||
in which the vertex elements had been declared in the vertex format.
|
||||
* This method is as complicated as it is, because the order in which we push data into the vertexbuffer actually
|
||||
* has to be precisely the order
|
||||
* in which the vertex elements had been declared in the vertex format.
|
||||
*/
|
||||
private void putVertex( UnpackedBakedQuad.Builder builder, Vec3d normal, double x, double y, double z, TextureAtlasSprite sprite, float u, float v )
|
||||
{
|
||||
|
||||
@@ -114,7 +114,8 @@ final class MatrixVertexTransformer extends QuadGatheringTransformer
|
||||
case 4:
|
||||
Vector4f vecc = new Vector4f( fs[0], fs[1], fs[2], fs[3] );
|
||||
// Otherwise all translation is lost
|
||||
if (elemCount == 3) {
|
||||
if( elemCount == 3 )
|
||||
{
|
||||
vecc.w = 1;
|
||||
}
|
||||
vecc.x -= 0.5f;
|
||||
|
||||
@@ -107,7 +107,8 @@ public class SkyCompassBakedModel implements IBakedModel
|
||||
transformer.setParent( builder );
|
||||
transformer.setVertexFormat( builder.getVertexFormat() );
|
||||
bakedQuad.pipe( transformer );
|
||||
builder.setQuadOrientation( null ); // After rotation, facing a specific side cannot be guaranteed anymore
|
||||
builder.setQuadOrientation( null ); // After rotation, facing a specific side cannot be guaranteed
|
||||
// anymore
|
||||
BakedQuad q = builder.build();
|
||||
quads.add( q );
|
||||
}
|
||||
@@ -150,8 +151,9 @@ public class SkyCompassBakedModel implements IBakedModel
|
||||
public ItemOverrideList getOverrides()
|
||||
{
|
||||
/*
|
||||
This handles setting the rotation of the compass when being held in hand. If it's not held in hand, it'll animate using the
|
||||
spinning animation.
|
||||
* This handles setting the rotation of the compass when being held in hand. If it's not held in hand, it'll
|
||||
* animate using the
|
||||
* spinning animation.
|
||||
*/
|
||||
return new ItemOverrideList( Collections.emptyList() )
|
||||
{
|
||||
@@ -188,7 +190,8 @@ public class SkyCompassBakedModel implements IBakedModel
|
||||
{
|
||||
CompassResult cr = CompassManager.INSTANCE.getCompassDirection( 0, pos.getX(), pos.getY(), pos.getZ() );
|
||||
|
||||
// Prefetch meteor positions from the server for adjacent blocks so they are available more quickly when we're moving
|
||||
// Prefetch meteor positions from the server for adjacent blocks so they are available more quickly when
|
||||
// we're moving
|
||||
if( prefetch )
|
||||
{
|
||||
for( int i = 0; i < 3; i++ )
|
||||
|
||||
@@ -106,7 +106,8 @@ public enum UVLModelLoader implements ICustomModelLoader
|
||||
modifiers.set( faceBakery, faceBakery.getModifiers() & ( ~Modifier.FINAL ) );
|
||||
|
||||
Class clas = Class.forName( ModelLoader.class.getName() + "$VanillaModelWrapper" );
|
||||
vanillaModelWrapper = clas.getDeclaredConstructor( ModelLoader.class, ResourceLocation.class, ModelBlock.class, boolean.class, ModelBlockAnimation.class );
|
||||
vanillaModelWrapper = clas.getDeclaredConstructor( ModelLoader.class, ResourceLocation.class, ModelBlock.class, boolean.class,
|
||||
ModelBlockAnimation.class );
|
||||
vanillaModelWrapper.setAccessible( true );
|
||||
|
||||
Class<?> vanillaLoaderClass = Class.forName( ModelLoader.class.getName() + "$VanillaLoader" );
|
||||
@@ -190,7 +191,10 @@ public enum UVLModelLoader implements ICustomModelLoader
|
||||
{
|
||||
modelPath = modelPath.substring( "models/".length() );
|
||||
}
|
||||
try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft().getResourceManager().getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) ).getInputStream() ) )
|
||||
try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft()
|
||||
.getResourceManager()
|
||||
.getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) )
|
||||
.getInputStream() ) )
|
||||
{
|
||||
return gson.fromJson( io, UVLMarker.class ).uvlMarker;
|
||||
}
|
||||
@@ -209,7 +213,14 @@ public enum UVLModelLoader implements ICustomModelLoader
|
||||
|
||||
public class UVLModelWrapper implements IModel
|
||||
{
|
||||
final Gson UVLSERIALIZER = ( new GsonBuilder() ).registerTypeAdapter( ModelBlock.class, deserializer( ModelBlock.class ) ).registerTypeAdapter( BlockPart.class, deserializer( BlockPart.class ) ).registerTypeAdapter( BlockPartFace.class, new BlockPartFaceOverrideSerializer() ).registerTypeAdapter( BlockFaceUV.class, deserializer( BlockFaceUV.class ) ).registerTypeAdapter( ItemTransformVec3f.class, deserializer( ItemTransformVec3f.class ) ).registerTypeAdapter( ItemCameraTransforms.class, deserializer( ItemCameraTransforms.class ) ).registerTypeAdapter( ItemOverride.class, deserializer( ItemOverride.class ) ).create();
|
||||
final Gson UVLSERIALIZER = ( new GsonBuilder() ).registerTypeAdapter( ModelBlock.class, deserializer( ModelBlock.class ) )
|
||||
.registerTypeAdapter( BlockPart.class, deserializer( BlockPart.class ) )
|
||||
.registerTypeAdapter( BlockPartFace.class, new BlockPartFaceOverrideSerializer() )
|
||||
.registerTypeAdapter( BlockFaceUV.class, deserializer( BlockFaceUV.class ) )
|
||||
.registerTypeAdapter( ItemTransformVec3f.class, deserializer( ItemTransformVec3f.class ) )
|
||||
.registerTypeAdapter( ItemCameraTransforms.class, deserializer( ItemCameraTransforms.class ) )
|
||||
.registerTypeAdapter( ItemOverride.class, deserializer( ItemOverride.class ) )
|
||||
.create();
|
||||
|
||||
private Map<BlockPartFace, Pair<Float, Float>> uvlightmap = new HashMap<>();
|
||||
|
||||
@@ -234,7 +245,8 @@ public enum UVLModelLoader implements ICustomModelLoader
|
||||
{
|
||||
String s = modelLocation.getResourcePath();
|
||||
|
||||
iresource = Minecraft.getMinecraft().getResourceManager().getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) );
|
||||
iresource = Minecraft.getMinecraft().getResourceManager().getResource(
|
||||
new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) );
|
||||
reader = new InputStreamReader( iresource.getInputStream(), Charsets.UTF_8 );
|
||||
|
||||
lvt_5_1_ = JsonUtils.gsonDeserialize( UVLSERIALIZER, reader, ModelBlock.class, false );
|
||||
@@ -339,7 +351,8 @@ public enum UVLModelLoader implements ICustomModelLoader
|
||||
{
|
||||
VertexFormat newFormat = VertexFormats.getFormatWithLightMap( quad.getFormat() );
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( newFormat );
|
||||
VertexLighterFlat trans = new VertexLighterFlat( Minecraft.getMinecraft().getBlockColors() ){
|
||||
VertexLighterFlat trans = new VertexLighterFlat( Minecraft.getMinecraft().getBlockColors() )
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void updateLightmap( float[] normal, float[] lightmap, float x, float y, float z )
|
||||
|
||||
Reference in New Issue
Block a user