pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -18,95 +18,93 @@
package appeng.client.render.crafting;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.data.IModelData;
import appeng.api.util.AEColor;
import appeng.block.crafting.BlockCraftingMonitor;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.client.render.model.AEModelData;
import appeng.tile.crafting.CraftingMonitorModelData;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.data.IModelData;
/**
* The baked model for the crafting monitor. Please note that this model doesn't handle the item being displayed. That
* is handled by a TESR.
* Instead, this model adds 3 layered light textures using the [dark|medium|bright] color variants of the attached bus
* color. The textures
* are full-bright if the cube is powered.
* The baked model for the crafting monitor. Please note that this model doesn't
* handle the item being displayed. That is handled by a TESR. Instead, this
* model adds 3 layered light textures using the [dark|medium|bright] color
* variants of the attached bus color. The textures are full-bright if the cube
* is powered.
*/
public class MonitorBakedModel extends CraftingCubeBakedModel
{
public class MonitorBakedModel extends CraftingCubeBakedModel {
private final TextureAtlasSprite chassisTexture;
private final TextureAtlasSprite chassisTexture;
private final TextureAtlasSprite baseTexture;
private final TextureAtlasSprite baseTexture;
private final TextureAtlasSprite lightDarkTexture;
private final TextureAtlasSprite lightDarkTexture;
private final TextureAtlasSprite lightMediumTexture;
private final TextureAtlasSprite lightMediumTexture;
private final TextureAtlasSprite lightBrightTexture;
private final TextureAtlasSprite lightBrightTexture;
MonitorBakedModel( TextureAtlasSprite ringCorner, TextureAtlasSprite ringHor, TextureAtlasSprite ringVer, TextureAtlasSprite chassisTexture, TextureAtlasSprite baseTexture, TextureAtlasSprite lightDarkTexture, TextureAtlasSprite lightMediumTexture, TextureAtlasSprite lightBrightTexture )
{
super( ringCorner, ringHor, ringVer );
this.chassisTexture = chassisTexture;
this.baseTexture = baseTexture;
this.lightDarkTexture = lightDarkTexture;
this.lightMediumTexture = lightMediumTexture;
this.lightBrightTexture = lightBrightTexture;
}
MonitorBakedModel(TextureAtlasSprite ringCorner, TextureAtlasSprite ringHor, TextureAtlasSprite ringVer,
TextureAtlasSprite chassisTexture, TextureAtlasSprite baseTexture, TextureAtlasSprite lightDarkTexture,
TextureAtlasSprite lightMediumTexture, TextureAtlasSprite lightBrightTexture) {
super(ringCorner, ringHor, ringVer);
this.chassisTexture = chassisTexture;
this.baseTexture = baseTexture;
this.lightDarkTexture = lightDarkTexture;
this.lightMediumTexture = lightMediumTexture;
this.lightBrightTexture = lightBrightTexture;
}
@Override
protected void addInnerCube(Direction side, BlockState state, IModelData modelData, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2)
{
Direction forward = getForward( modelData );
@Override
protected void addInnerCube(Direction side, BlockState state, IModelData modelData, CubeBuilder builder, float x1,
float y1, float z1, float x2, float y2, float z2) {
Direction forward = getForward(modelData);
// For sides other than the front, use the chassis texture
if( side != forward )
{
builder.setTexture( this.chassisTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
return;
}
// For sides other than the front, use the chassis texture
if (side != forward) {
builder.setTexture(this.chassisTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
return;
}
builder.setTexture( this.baseTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
builder.setTexture(this.baseTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
// Now add the three layered light textures
AEColor color = getColor( modelData );
boolean powered = state.get( BlockCraftingMonitor.POWERED );
// Now add the three layered light textures
AEColor color = getColor(modelData);
boolean powered = state.get(BlockCraftingMonitor.POWERED);
builder.setRenderFullBright( powered );
builder.setRenderFullBright(powered);
builder.setColorRGB( color.whiteVariant );
builder.setTexture( this.lightBrightTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
builder.setColorRGB(color.whiteVariant);
builder.setTexture(this.lightBrightTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
builder.setColorRGB( color.mediumVariant );
builder.setTexture( this.lightMediumTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
builder.setColorRGB(color.mediumVariant);
builder.setTexture(this.lightMediumTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
builder.setColorRGB( color.blackVariant );
builder.setTexture( this.lightDarkTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
builder.setColorRGB(color.blackVariant);
builder.setTexture(this.lightDarkTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
}
}
private static AEColor getColor(IModelData modelData) {
if (modelData instanceof CraftingMonitorModelData) {
return ((CraftingMonitorModelData) modelData).getColor();
}
return AEColor.TRANSPARENT;
}
private static AEColor getColor(IModelData modelData) {
if (modelData instanceof CraftingMonitorModelData) {
return ((CraftingMonitorModelData) modelData).getColor();
}
return AEColor.TRANSPARENT;
}
private static Direction getForward(IModelData modelData) {
if (modelData instanceof AEModelData) {
return ((AEModelData) modelData).getForward();
}
return Direction.NORTH;
}
private static Direction getForward(IModelData modelData) {
if (modelData instanceof AEModelData) {
return ((AEModelData) modelData).getForward();
}
return Direction.NORTH;
}
}