reformatted all src files (#141)

This commit is contained in:
YoungOnion
2022-09-17 05:08:02 -06:00
committed by GitHub
parent 3328bfcda2
commit 9011273229
1056 changed files with 88127 additions and 110597 deletions
@@ -19,10 +19,10 @@
package appeng.tile.storage;
import java.io.IOException;
import appeng.tile.AEBaseInvTile;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.inv.InvOperation;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
@@ -30,185 +30,153 @@ import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.items.IItemHandler;
import appeng.tile.AEBaseInvTile;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.inv.InvOperation;
import java.io.IOException;
public class TileSkyChest extends AEBaseInvTile implements ITickable
{
public class TileSkyChest extends AEBaseInvTile implements ITickable {
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 * 4 );
// server
private int numPlayersUsing;
// client..
private long lastEvent;
private float lidAngle;
private float prevLidAngle;
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 9 * 4);
// server
private int numPlayersUsing;
// client..
private long lastEvent;
private float lidAngle;
private float prevLidAngle;
@Override
protected void writeToStream( final ByteBuf data ) throws IOException
{
super.writeToStream( data );
data.writeBoolean( this.getPlayerOpen() > 0 );
}
@Override
protected void writeToStream(final ByteBuf data) throws IOException {
super.writeToStream(data);
data.writeBoolean(this.getPlayerOpen() > 0);
}
@Override
protected boolean readFromStream( final ByteBuf data ) throws IOException
{
final boolean c = super.readFromStream( data );
final int wasOpen = this.getPlayerOpen();
this.setPlayerOpen( data.readBoolean() ? 1 : 0 );
@Override
protected boolean readFromStream(final ByteBuf data) throws IOException {
final boolean c = super.readFromStream(data);
final int wasOpen = this.getPlayerOpen();
this.setPlayerOpen(data.readBoolean() ? 1 : 0);
if( wasOpen != this.getPlayerOpen() )
{
this.setLastEvent( System.currentTimeMillis() );
}
if (wasOpen != this.getPlayerOpen()) {
this.setLastEvent(System.currentTimeMillis());
}
return c; // TESR yo!
}
return c; // TESR yo!
}
@Override
public boolean requiresTESR()
{
return true;
}
@Override
public boolean requiresTESR() {
return true;
}
@Override
public boolean canRenderBreaking()
{
return true;
}
@Override
public boolean canRenderBreaking() {
return true;
}
@Override
public IItemHandler getInternalInventory()
{
return this.inv;
}
@Override
public IItemHandler getInternalInventory() {
return this.inv;
}
public void openInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() + 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
public void openInventory(final EntityPlayer player) {
if (!player.isSpectator()) {
this.setPlayerOpen(this.getPlayerOpen() + 1);
this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), true);
this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), true);
if( this.getPlayerOpen() == 1 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
if (this.getPlayerOpen() == 1) {
this.getWorld()
.playSound(player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_OPEN,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F);
this.markForUpdate();
}
}
}
public void closeInventory( final EntityPlayer player )
{
if( !player.isSpectator() )
{
this.setPlayerOpen( this.getPlayerOpen() - 1 );
this.world.addBlockEvent( this.pos, this.getBlockType(), 1, this.numPlayersUsing );
this.world.notifyNeighborsOfStateChange( this.pos, this.getBlockType(), true );
this.world.notifyNeighborsOfStateChange( this.pos.down(), this.getBlockType(), true );
public void closeInventory(final EntityPlayer player) {
if (!player.isSpectator()) {
this.setPlayerOpen(this.getPlayerOpen() - 1);
this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
this.world.notifyNeighborsOfStateChange(this.pos, this.getBlockType(), true);
this.world.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType(), true);
if( this.getPlayerOpen() < 0 )
{
this.setPlayerOpen( 0 );
}
if (this.getPlayerOpen() < 0) {
this.setPlayerOpen(0);
}
if( this.getPlayerOpen() == 0 )
{
this.getWorld()
.playSound( player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
this.markForUpdate();
}
}
}
if (this.getPlayerOpen() == 0) {
this.getWorld()
.playSound(player, this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D, SoundEvents.BLOCK_CHEST_CLOSE,
SoundCategory.BLOCKS, 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F);
this.markForUpdate();
}
}
}
@Override
public void update()
{
int i = this.pos.getX();
int j = this.pos.getY();
int k = this.pos.getZ();
@Override
public void update() {
int i = this.pos.getX();
int j = this.pos.getY();
int k = this.pos.getZ();
this.prevLidAngle = this.lidAngle;
float f1 = 0.1F;
this.prevLidAngle = this.lidAngle;
float f1 = 0.1F;
if( this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F )
{
float f2 = this.lidAngle;
if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) {
float f2 = this.lidAngle;
if( this.numPlayersUsing > 0 )
{
this.lidAngle += 0.1F;
}
else
{
this.lidAngle -= 0.1F;
}
if (this.numPlayersUsing > 0) {
this.lidAngle += 0.1F;
} else {
this.lidAngle -= 0.1F;
}
if( this.lidAngle > 1.0F )
{
this.lidAngle = 1.0F;
}
if (this.lidAngle > 1.0F) {
this.lidAngle = 1.0F;
}
float f3 = 0.5F;
float f3 = 0.5F;
if( this.lidAngle < 0.0F )
{
this.lidAngle = 0.0F;
}
}
}
if (this.lidAngle < 0.0F) {
this.lidAngle = 0.0F;
}
}
}
@Override
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added )
{
@Override
public void onChangeInventory(final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removed, final ItemStack added) {
}
}
public float getLidAngle()
{
return this.lidAngle;
}
public float getLidAngle() {
return this.lidAngle;
}
public void setLidAngle( final float lidAngle )
{
this.lidAngle = lidAngle;
}
public void setLidAngle(final float lidAngle) {
this.lidAngle = lidAngle;
}
public float getPrevLidAngle()
{
return this.prevLidAngle;
}
public float getPrevLidAngle() {
return this.prevLidAngle;
}
public void setPrevLidAngle( float prevLidAngle )
{
this.prevLidAngle = prevLidAngle;
}
public void setPrevLidAngle(float prevLidAngle) {
this.prevLidAngle = prevLidAngle;
}
public int getPlayerOpen()
{
return this.numPlayersUsing;
}
public int getPlayerOpen() {
return this.numPlayersUsing;
}
private void setPlayerOpen( final int playerOpen )
{
this.numPlayersUsing = playerOpen;
}
private void setPlayerOpen(final int playerOpen) {
this.numPlayersUsing = playerOpen;
}
public long getLastEvent()
{
return this.lastEvent;
}
public long getLastEvent() {
return this.lastEvent;
}
private void setLastEvent( final long lastEvent )
{
this.lastEvent = lastEvent;
}
private void setLastEvent(final long lastEvent) {
this.lastEvent = lastEvent;
}
}