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,8 +19,8 @@
package appeng.container.slot;
import javax.annotation.Nonnull;
import appeng.container.AEBaseContainer;
import appeng.util.helpers.ItemHandlerUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryBasic;
@@ -30,270 +30,222 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import appeng.container.AEBaseContainer;
import appeng.util.helpers.ItemHandlerUtil;
import javax.annotation.Nonnull;
public class AppEngSlot extends Slot
{
private static IInventory emptyInventory = new InventoryBasic( "[Null]", true, 0 );
private final IItemHandler itemHandler;
private final int index;
public class AppEngSlot extends Slot {
private static final IInventory emptyInventory = new InventoryBasic("[Null]", true, 0);
private final IItemHandler itemHandler;
private final int index;
private final int defX;
private final int defY;
private boolean isDraggable = true;
private boolean isPlayerSide = false;
private AEBaseContainer myContainer = null;
private int IIcon = -1;
private hasCalculatedValidness isValid;
private boolean isDisplay = false;
private final int defX;
private final int defY;
private boolean isDraggable = true;
private boolean isPlayerSide = false;
private AEBaseContainer myContainer = null;
private int IIcon = -1;
private hasCalculatedValidness isValid;
private boolean isDisplay = false;
public AppEngSlot( final IItemHandler inv, final int idx, final int x, final int y )
{
super( emptyInventory, idx, x, y );
this.itemHandler = inv;
this.index = idx;
public AppEngSlot(final IItemHandler inv, final int idx, final int x, final int y) {
super(emptyInventory, idx, x, y);
this.itemHandler = inv;
this.index = idx;
this.defX = x;
this.defY = y;
this.setIsValid( hasCalculatedValidness.NotAvailable );
}
this.defX = x;
this.defY = y;
this.setIsValid(hasCalculatedValidness.NotAvailable);
}
public Slot setNotDraggable()
{
this.setDraggable( false );
return this;
}
public Slot setNotDraggable() {
this.setDraggable(false);
return this;
}
public Slot setPlayerSide()
{
this.isPlayerSide = true;
return this;
}
public Slot setPlayerSide() {
this.isPlayerSide = true;
return this;
}
public String getTooltip()
{
return null;
}
public String getTooltip() {
return null;
}
public void clearStack()
{
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, ItemStack.EMPTY );
}
public void clearStack() {
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, ItemStack.EMPTY);
}
@Override
public boolean isItemValid( @Nonnull final ItemStack par1ItemStack )
{
if( this.isSlotEnabled() )
{
return this.itemHandler.isItemValid( this.index, par1ItemStack );
}
return false;
}
@Override
public boolean isItemValid(@Nonnull final ItemStack par1ItemStack) {
if (this.isSlotEnabled()) {
return this.itemHandler.isItemValid(this.index, par1ItemStack);
}
return false;
}
@Override
@Nonnull
public ItemStack getStack()
{
if( !this.isSlotEnabled() )
{
return ItemStack.EMPTY;
}
@Override
@Nonnull
public ItemStack getStack() {
if (!this.isSlotEnabled()) {
return ItemStack.EMPTY;
}
if( this.itemHandler.getSlots() <= this.getSlotIndex() )
{
return ItemStack.EMPTY;
}
if (this.itemHandler.getSlots() <= this.getSlotIndex()) {
return ItemStack.EMPTY;
}
if( this.isDisplay() )
{
this.setDisplay( false );
return this.getDisplayStack();
}
if (this.isDisplay()) {
this.setDisplay(false);
return this.getDisplayStack();
}
return this.itemHandler.getStackInSlot( this.index );
}
return this.itemHandler.getStackInSlot(this.index);
}
@Override
public void putStack( final ItemStack stack )
{
if( this.isSlotEnabled() )
{
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, stack );
@Override
public void putStack(final ItemStack stack) {
if (this.isSlotEnabled()) {
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, stack);
if( this.getContainer() != null )
{
this.getContainer().onSlotChange( this );
}
}
}
if (this.getContainer() != null) {
this.getContainer().onSlotChange(this);
}
}
}
public IItemHandler getItemHandler()
{
return this.itemHandler;
}
public IItemHandler getItemHandler() {
return this.itemHandler;
}
@Override
public void onSlotChanged()
{
this.setIsValid( hasCalculatedValidness.NotAvailable );
if( this.isSlotEnabled() )
{
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, this.getStack().copy() );
@Override
public void onSlotChanged() {
this.setIsValid(hasCalculatedValidness.NotAvailable);
if (this.isSlotEnabled()) {
ItemHandlerUtil.setStackInSlot(this.itemHandler, this.index, this.getStack().copy());
if( this.getContainer() != null )
{
this.getContainer().onSlotChange( this );
}
}
super.onSlotChanged();
}
if (this.getContainer() != null) {
this.getContainer().onSlotChange(this);
}
}
super.onSlotChanged();
}
@Override
public int getSlotStackLimit()
{
return this.itemHandler.getSlotLimit( this.index );
}
@Override
public int getSlotStackLimit() {
return this.itemHandler.getSlotLimit(this.index);
}
@Override
public int getItemStackLimit( @Nonnull ItemStack stack )
{
return Math.min( this.getSlotStackLimit(), stack.getMaxStackSize() );
}
@Override
public int getItemStackLimit(@Nonnull ItemStack stack) {
return Math.min(this.getSlotStackLimit(), stack.getMaxStackSize());
}
@Override
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
{
if( this.isSlotEnabled() )
{
return !this.itemHandler.extractItem( this.index, Integer.MAX_VALUE, true ).isEmpty();
}
return false;
}
@Override
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
if (this.isSlotEnabled()) {
return !this.itemHandler.extractItem(this.index, Integer.MAX_VALUE, true).isEmpty();
}
return false;
}
@Override
@Nonnull
public ItemStack decrStackSize( int amount )
{
return this.itemHandler.extractItem( this.index, amount, false );
}
@Override
@Nonnull
public ItemStack decrStackSize(int amount) {
return this.itemHandler.extractItem(this.index, amount, false);
}
@Override
public boolean isSameInventory( Slot other )
{
return other instanceof AppEngSlot && ( (AppEngSlot) other ).itemHandler == this.itemHandler;
}
@Override
public boolean isSameInventory(Slot other) {
return other instanceof AppEngSlot && ((AppEngSlot) other).itemHandler == this.itemHandler;
}
@Override
@SideOnly( Side.CLIENT )
public boolean isEnabled()
{
return this.isSlotEnabled();
}
@Override
@SideOnly(Side.CLIENT)
public boolean isEnabled() {
return this.isSlotEnabled();
}
public boolean isSlotEnabled()
{
return true;
}
public boolean isSlotEnabled() {
return true;
}
public ItemStack getDisplayStack()
{
return this.itemHandler.getStackInSlot( this.index );
}
public ItemStack getDisplayStack() {
return this.itemHandler.getStackInSlot(this.index);
}
public float getOpacityOfIcon()
{
return 0.4f;
}
public float getOpacityOfIcon() {
return 0.4f;
}
public boolean renderIconWithItem()
{
return false;
}
public boolean renderIconWithItem() {
return false;
}
public int getIcon()
{
return this.getIIcon();
}
public int getIcon() {
return this.getIIcon();
}
public boolean isPlayerSide()
{
return this.isPlayerSide;
}
public boolean isPlayerSide() {
return this.isPlayerSide;
}
public boolean shouldDisplay()
{
return this.isSlotEnabled();
}
public boolean shouldDisplay() {
return this.isSlotEnabled();
}
public int getX()
{
return this.defX;
}
public int getX() {
return this.defX;
}
public int getY()
{
return this.defY;
}
public int getY() {
return this.defY;
}
private int getIIcon()
{
return this.IIcon;
}
private int getIIcon() {
return this.IIcon;
}
public void setIIcon( final int iIcon )
{
this.IIcon = iIcon;
}
public void setIIcon(final int iIcon) {
this.IIcon = iIcon;
}
private boolean isDisplay()
{
return this.isDisplay;
}
private boolean isDisplay() {
return this.isDisplay;
}
public void setDisplay( final boolean isDisplay )
{
this.isDisplay = isDisplay;
}
public void setDisplay(final boolean isDisplay) {
this.isDisplay = isDisplay;
}
public boolean isDraggable()
{
return this.isDraggable;
}
public boolean isDraggable() {
return this.isDraggable;
}
private void setDraggable( final boolean isDraggable )
{
this.isDraggable = isDraggable;
}
private void setDraggable(final boolean isDraggable) {
this.isDraggable = isDraggable;
}
void setPlayerSide( final boolean isPlayerSide )
{
this.isPlayerSide = isPlayerSide;
}
void setPlayerSide(final boolean isPlayerSide) {
this.isPlayerSide = isPlayerSide;
}
public hasCalculatedValidness getIsValid()
{
return this.isValid;
}
public hasCalculatedValidness getIsValid() {
return this.isValid;
}
public void setIsValid( final hasCalculatedValidness isValid )
{
this.isValid = isValid;
}
public void setIsValid(final hasCalculatedValidness isValid) {
this.isValid = isValid;
}
protected AEBaseContainer getContainer()
{
return this.myContainer;
}
protected AEBaseContainer getContainer() {
return this.myContainer;
}
public void setContainer( final AEBaseContainer myContainer )
{
this.myContainer = myContainer;
}
public void setContainer(final AEBaseContainer myContainer) {
this.myContainer = myContainer;
}
public enum hasCalculatedValidness
{
NotAvailable, Valid, Invalid
}
public enum hasCalculatedValidness {
NotAvailable, Valid, Invalid
}
}