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,10 +18,11 @@
package appeng.tile.crafting;
import java.io.IOException;
import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -30,176 +31,145 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AEColor;
import appeng.util.item.AEItemStack;
import net.minecraftforge.client.model.data.IModelData;
import javax.annotation.Nonnull;
public class TileCraftingMonitorTile extends TileCraftingTile implements IColorableTile {
@OnlyIn(Dist.CLIENT)
private Integer dspList;
public class TileCraftingMonitorTile extends TileCraftingTile implements IColorableTile
{
@OnlyIn(Dist.CLIENT)
private boolean updateList;
@OnlyIn( Dist.CLIENT )
private Integer dspList;
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.TRANSPARENT;
@OnlyIn( Dist.CLIENT )
private boolean updateList;
public TileCraftingMonitorTile(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
private IAEItemStack dspPlay;
private AEColor paintedColor = AEColor.TRANSPARENT;
@Override
protected boolean readFromStream(final PacketBuffer data) throws IOException {
final boolean c = super.readFromStream(data);
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
public TileCraftingMonitorTile(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
final boolean hasItem = data.readBoolean();
@Override
protected boolean readFromStream( final PacketBuffer data ) throws IOException
{
final boolean c = super.readFromStream( data );
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
if (hasItem) {
this.dspPlay = AEItemStack.fromPacket(data);
} else {
this.dspPlay = null;
}
final boolean hasItem = data.readBoolean();
this.setUpdateList(true);
return oldPaintedColor != this.paintedColor || c; // tesr!
}
if( hasItem )
{
this.dspPlay = AEItemStack.fromPacket( data );
}
else
{
this.dspPlay = null;
}
@Override
protected void writeToStream(final PacketBuffer data) throws IOException {
super.writeToStream(data);
data.writeByte(this.paintedColor.ordinal());
this.setUpdateList( true );
return oldPaintedColor != this.paintedColor || c; // tesr!
}
if (this.dspPlay == null) {
data.writeBoolean(false);
} else {
data.writeBoolean(true);
this.dspPlay.writeToPacket(data);
}
}
@Override
protected void writeToStream( final PacketBuffer data ) throws IOException
{
super.writeToStream( data );
data.writeByte( this.paintedColor.ordinal() );
@Override
public void read(final CompoundNBT data) {
super.read(data);
if (data.contains("paintedColor")) {
this.paintedColor = AEColor.values()[data.getByte("paintedColor")];
}
}
if( this.dspPlay == null )
{
data.writeBoolean( false );
}
else
{
data.writeBoolean( true );
this.dspPlay.writeToPacket( data );
}
}
@Override
public CompoundNBT write(final CompoundNBT data) {
super.write(data);
data.putByte("paintedColor", (byte) this.paintedColor.ordinal());
return data;
}
@Override
public void read(final CompoundNBT data )
{
super.read( data );
if( data.contains("paintedColor") )
{
this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
}
}
@Override
public boolean isAccelerator() {
return false;
}
@Override
public CompoundNBT write(final CompoundNBT data )
{
super.write( data );
data.putByte( "paintedColor", (byte) this.paintedColor.ordinal() );
return data;
}
@Override
public boolean isStatus() {
return true;
}
@Override
public boolean isAccelerator()
{
return false;
}
public void setJob(final IAEItemStack is) {
if ((is == null) != (this.dspPlay == null)) {
this.dspPlay = is == null ? null : is.copy();
this.markForUpdate();
} else if (is != null && this.dspPlay != null) {
if (is.getStackSize() != this.dspPlay.getStackSize()) {
this.dspPlay = is.copy();
this.markForUpdate();
}
}
}
@Override
public boolean isStatus()
{
return true;
}
public IAEItemStack getJobProgress() {
return this.dspPlay; // AEItemStack.create( new ItemStack( Items.DIAMOND, 64 ) );
}
public void setJob( final IAEItemStack is )
{
if( ( is == null ) != ( this.dspPlay == null ) )
{
this.dspPlay = is == null ? null : is.copy();
this.markForUpdate();
}
else if( is != null && this.dspPlay != null )
{
if( is.getStackSize() != this.dspPlay.getStackSize() )
{
this.dspPlay = is.copy();
this.markForUpdate();
}
}
}
@Override
public AEColor getColor() {
return this.paintedColor;
}
public IAEItemStack getJobProgress()
{
return this.dspPlay; // AEItemStack.create( new ItemStack( Items.DIAMOND, 64 ) );
}
@Override
public boolean recolourBlock(final Direction side, final AEColor newPaintedColor, final PlayerEntity who) {
if (this.paintedColor == newPaintedColor) {
return false;
}
@Override
public AEColor getColor()
{
return this.paintedColor;
}
this.paintedColor = newPaintedColor;
this.saveChanges();
this.markForUpdate();
return true;
}
@Override
public boolean recolourBlock( final Direction side, final AEColor newPaintedColor, final PlayerEntity who )
{
if( this.paintedColor == newPaintedColor )
{
return false;
}
public Integer getDisplayList() {
return this.dspList;
}
this.paintedColor = newPaintedColor;
this.saveChanges();
this.markForUpdate();
return true;
}
public void setDisplayList(final Integer dspList) {
this.dspList = dspList;
}
public Integer getDisplayList()
{
return this.dspList;
}
public boolean isUpdateList() {
return this.updateList;
}
public void setDisplayList( final Integer dspList )
{
this.dspList = dspList;
}
public void setUpdateList(final boolean updateList) {
this.updateList = updateList;
}
public boolean isUpdateList()
{
return this.updateList;
}
@Override
protected ItemStack getItemFromTile(final Object obj) {
final Optional<ItemStack> is = AEApi.instance().definitions().blocks().craftingMonitor().maybeStack(1);
public void setUpdateList( final boolean updateList )
{
this.updateList = updateList;
}
return is.orElseGet(() -> super.getItemFromTile(obj));
}
@Override
protected ItemStack getItemFromTile( final Object obj )
{
final Optional<ItemStack> is = AEApi.instance().definitions().blocks().craftingMonitor().maybeStack( 1 );
return is.orElseGet( () -> super.getItemFromTile( obj ) );
}
@Nonnull
@Override
public IModelData getModelData() {
return new CraftingMonitorModelData(getUp(), getForward(), getConnections(), getColor());
}
@Nonnull
@Override
public IModelData getModelData() {
return new CraftingMonitorModelData(getUp(), getForward(), getConnections(), getColor());
}
}