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,7 +18,6 @@
package appeng.client.render.cablebus;
import java.util.Arrays;
import java.util.function.Function;
@@ -29,72 +28,58 @@ import net.minecraft.util.ResourceLocation;
import appeng.core.AppEng;
/**
* Manages the channel textures for smart cables.
*/
public class SmartCableTextures
{
public class SmartCableTextures {
public static final Material[] SMART_CHANNELS_TEXTURES = Arrays.stream( new ResourceLocation[] {
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_00" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_01" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_02" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_03" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_04" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_10" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_11" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_12" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_13" ),//
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_14" )//
} ).map( e -> new Material( AtlasTexture.LOCATION_BLOCKS_TEXTURE, e ) ).toArray( Material[]::new );
public static final Material[] SMART_CHANNELS_TEXTURES = Arrays
.stream(new ResourceLocation[] { new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"), //
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14")//
}).map(e -> new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, e)).toArray(Material[]::new);
// Textures used to display channels on smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] textures;
// Textures used to display channels on smart cables. There's two sets of 5
// textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] textures;
public SmartCableTextures( Function<Material, TextureAtlasSprite> bakedTextureGetter )
{
this.textures = Arrays.stream( SMART_CHANNELS_TEXTURES )//
.map( bakedTextureGetter )//
.toArray( TextureAtlasSprite[]::new );
}
public SmartCableTextures(Function<Material, TextureAtlasSprite> bakedTextureGetter) {
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES)//
.map(bakedTextureGetter)//
.toArray(TextureAtlasSprite[]::new);
}
/**
* The odd variant is used for displaying channels 1-4 as in use.
*/
public TextureAtlasSprite getOddTextureForChannels( int channels )
{
if( channels < 0 )
{
return this.textures[0];
}
else if( channels <= 4 )
{
return this.textures[channels];
}
else
{
return this.textures[4];
}
}
/**
* The odd variant is used for displaying channels 1-4 as in use.
*/
public TextureAtlasSprite getOddTextureForChannels(int channels) {
if (channels < 0) {
return this.textures[0];
} else if (channels <= 4) {
return this.textures[channels];
} else {
return this.textures[4];
}
}
/**
* The odd variant is used for displaying channels 5-8 as in use.
*/
public TextureAtlasSprite getEvenTextureForChannels( int channels )
{
if( channels < 5 )
{
return this.textures[5];
}
else if( channels <= 8 )
{
return this.textures[1 + channels];
}
else
{
return this.textures[9];
}
}
/**
* The odd variant is used for displaying channels 5-8 as in use.
*/
public TextureAtlasSprite getEvenTextureForChannels(int channels) {
if (channels < 5) {
return this.textures[5];
} else if (channels <= 8) {
return this.textures[1 + channels];
} else {
return this.textures[9];
}
}
}