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,54 +18,45 @@
package appeng.client.me;
import javax.annotation.Nonnull;
import net.minecraft.client.resources.I18n;
import appeng.tile.inventory.AppEngInternalInventory;
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv> {
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
{
private final String unlocalizedName;
private final AppEngInternalInventory inventory;
private final String unlocalizedName;
private final AppEngInternalInventory inventory;
private final long id;
private final long sortBy;
private final long id;
private final long sortBy;
public ClientDCInternalInv(final int size, final long id, final long sortBy, final String unlocalizedName) {
this.inventory = new AppEngInternalInventory(null, size);
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
}
public ClientDCInternalInv( final int size, final long id, final long sortBy, final String unlocalizedName )
{
this.inventory = new AppEngInternalInventory( null, size );
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
}
public String getName() {
final String s = I18n.format(this.unlocalizedName + ".name");
if (s.equals(this.unlocalizedName + ".name")) {
return I18n.format(this.unlocalizedName);
}
return s;
}
public String getName()
{
final String s = I18n.format( this.unlocalizedName + ".name" );
if( s.equals( this.unlocalizedName + ".name" ) )
{
return I18n.format( this.unlocalizedName );
}
return s;
}
@Override
public int compareTo(@Nonnull final ClientDCInternalInv o) {
return Long.compare(this.sortBy, o.sortBy);
}
@Override
public int compareTo( @Nonnull final ClientDCInternalInv o )
{
return Long.compare( this.sortBy, o.sortBy );
}
public AppEngInternalInventory getInventory() {
return this.inventory;
}
public AppEngInternalInventory getInventory()
{
return this.inventory;
}
public long getId()
{
return this.id;
}
public long getId() {
return this.id;
}
}
+125 -163
View File
@@ -18,7 +18,6 @@
package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -26,6 +25,8 @@ import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import net.minecraft.util.text.ITextComponent;
import appeng.api.AEApi;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
@@ -40,205 +41,166 @@ import appeng.core.AEConfig;
import appeng.fluids.util.FluidSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
import net.minecraft.util.text.ITextComponent;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class FluidRepo
{
private final IItemList<IAEFluidStack> list = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
public class FluidRepo {
private final IItemList<IAEFluidStack> list = AEApi.instance().storage()
.getStorageChannel(IFluidStorageChannel.class).createList();
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
private int rowSize = 9;
private int rowSize = 9;
private String searchString = "";
private IPartitionList<IAEFluidStack> myPartitionList;
private boolean hasPower;
private String searchString = "";
private IPartitionList<IAEFluidStack> myPartitionList;
private boolean hasPower;
public FluidRepo( final IScrollSource src, final ISortSource sortSrc )
{
this.src = src;
this.sortSrc = sortSrc;
}
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
this.src = src;
this.sortSrc = sortSrc;
}
public void updateView()
{
this.view.clear();
public void updateView() {
this.view.clear();
this.view.ensureCapacity( this.list.size() );
this.view.ensureCapacity(this.list.size());
String innerSearch = this.searchString;
String innerSearch = this.searchString;
boolean searchMod = false;
if( innerSearch.startsWith( "@" ) )
{
searchMod = true;
innerSearch = innerSearch.substring( 1 );
}
boolean searchMod = false;
if (innerSearch.startsWith("@")) {
searchMod = true;
innerSearch = innerSearch.substring(1);
}
Pattern m;
try
{
m = Pattern.compile( innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
}
catch( final Exception ignore1 )
{
try
{
m = Pattern.compile( Pattern.quote( innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
}
catch( final Exception ignore2 )
{
return;
}
}
Pattern m;
try {
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
} catch (final Exception ignore1) {
try {
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
} catch (final Exception ignore2) {
return;
}
}
final Enum viewMode = this.sortSrc.getSortDisplay();
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
final Enum viewMode = this.sortSrc.getSortDisplay();
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager()
.getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
boolean notDone = false;
for( IAEFluidStack fs : this.list )
{
if( this.myPartitionList != null && !this.myPartitionList.isListed( fs ) )
{
continue;
}
boolean notDone = false;
for (IAEFluidStack fs : this.list) {
if (this.myPartitionList != null && !this.myPartitionList.isListed(fs)) {
continue;
}
if( viewMode == ViewItems.CRAFTABLE && !fs.isCraftable() )
{
continue;
}
if (viewMode == ViewItems.CRAFTABLE && !fs.isCraftable()) {
continue;
}
if( viewMode == ViewItems.STORED && fs.getStackSize() == 0 )
{
continue;
}
if (viewMode == ViewItems.STORED && fs.getStackSize() == 0) {
continue;
}
final String dspName = searchMod ? Platform.getModId( fs ) : Platform.getFluidDisplayName( fs ).getString();
boolean foundMatchingFluidStack = false;
notDone = true;
final String dspName = searchMod ? Platform.getModId(fs) : Platform.getFluidDisplayName(fs).getString();
boolean foundMatchingFluidStack = false;
notDone = true;
if( m.matcher( dspName.toLowerCase() ).find() )
{
notDone = false;
foundMatchingFluidStack = true;
}
if (m.matcher(dspName.toLowerCase()).find()) {
notDone = false;
foundMatchingFluidStack = true;
}
if( terminalSearchToolTips && notDone && !searchMod )
{
final List<ITextComponent> tooltip = Platform.getTooltip( fs );
if (terminalSearchToolTips && notDone && !searchMod) {
final List<ITextComponent> tooltip = Platform.getTooltip(fs);
for( final ITextComponent line : tooltip )
{
if( m.matcher( line.getString() ).find() )
{
foundMatchingFluidStack = true;
break;
}
}
}
for (final ITextComponent line : tooltip) {
if (m.matcher(line.getString()).find()) {
foundMatchingFluidStack = true;
break;
}
}
}
if( foundMatchingFluidStack )
{
if( needsZeroCopy )
{
fs = fs.copy();
fs.setStackSize( 0 );
}
if (foundMatchingFluidStack) {
if (needsZeroCopy) {
fs = fs.copy();
fs.setStackSize(0);
}
this.view.add( fs );
}
}
this.view.add(fs);
}
}
final Enum sortBy = this.sortSrc.getSortBy();
final Enum sortDir = this.sortSrc.getSortDir();
final Enum sortBy = this.sortSrc.getSortBy();
final Enum sortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection( (appeng.api.config.SortDir) sortDir );
FluidSorters.setDirection((appeng.api.config.SortDir) sortDir);
if( sortBy == SortOrder.MOD )
{
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_MOD );
}
else if( sortBy == SortOrder.AMOUNT )
{
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_SIZE );
}
else
{
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_NAME );
}
}
if (sortBy == SortOrder.MOD) {
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (sortBy == SortOrder.AMOUNT) {
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else {
Collections.sort(this.view, FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
}
public void postUpdate( final IAEFluidStack is )
{
final IAEFluidStack st = this.list.findPrecise( is );
public void postUpdate(final IAEFluidStack is) {
final IAEFluidStack st = this.list.findPrecise(is);
if( st != null )
{
st.reset();
st.add( is );
}
else
{
this.list.add( is );
}
}
if (st != null) {
st.reset();
st.add(is);
} else {
this.list.add(is);
}
}
public IAEFluidStack getReferenceFluid( int idx )
{
idx += this.src.getCurrentScroll() * this.rowSize;
public IAEFluidStack getReferenceFluid(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
if( idx >= this.view.size() )
{
return null;
}
return this.view.get( idx );
}
if (idx >= this.view.size()) {
return null;
}
return this.view.get(idx);
}
public int size()
{
return this.view.size();
}
public int size() {
return this.view.size();
}
public void clear()
{
this.list.resetStatus();
}
public void clear() {
this.list.resetStatus();
}
public boolean hasPower()
{
return this.hasPower;
}
public boolean hasPower() {
return this.hasPower;
}
public void setPower( final boolean hasPower )
{
this.hasPower = hasPower;
}
public void setPower(final boolean hasPower) {
this.hasPower = hasPower;
}
public int getRowSize()
{
return this.rowSize;
}
public int getRowSize() {
return this.rowSize;
}
public void setRowSize( final int rowSize )
{
this.rowSize = rowSize;
}
public void setRowSize(final int rowSize) {
this.rowSize = rowSize;
}
public String getSearchString()
{
return this.searchString;
}
public String getSearchString() {
return this.searchString;
}
public void setSearchString( @Nonnull final String searchString )
{
this.searchString = searchString;
}
public void setSearchString(@Nonnull final String searchString) {
this.searchString = searchString;
}
}
@@ -18,48 +18,40 @@
package appeng.client.me;
import appeng.api.storage.data.IAEFluidStack;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class InternalFluidSlotME
{
public class InternalFluidSlotME {
private final int offset;
private final int xPos;
private final int yPos;
private final FluidRepo repo;
private final int offset;
private final int xPos;
private final int yPos;
private final FluidRepo repo;
public InternalFluidSlotME( final FluidRepo def, final int offset, final int displayX, final int displayY )
{
this.repo = def;
this.offset = offset;
this.xPos = displayX;
this.yPos = displayY;
}
public InternalFluidSlotME(final FluidRepo def, final int offset, final int displayX, final int displayY) {
this.repo = def;
this.offset = offset;
this.xPos = displayX;
this.yPos = displayY;
}
IAEFluidStack getAEStack()
{
return this.repo.getReferenceFluid( this.offset );
}
IAEFluidStack getAEStack() {
return this.repo.getReferenceFluid(this.offset);
}
boolean hasPower()
{
return this.repo.hasPower();
}
boolean hasPower() {
return this.repo.hasPower();
}
int getxPosition()
{
return this.xPos;
}
int getxPosition() {
return this.xPos;
}
int getyPosition()
{
return this.yPos;
}
int getyPosition() {
return this.yPos;
}
}
@@ -18,50 +18,41 @@
package appeng.client.me;
import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
public class InternalSlotME {
public class InternalSlotME
{
private final int offset;
private final int xPos;
private final int yPos;
private final ItemRepo repo;
private final int offset;
private final int xPos;
private final int yPos;
private final ItemRepo repo;
public InternalSlotME(final ItemRepo def, final int offset, final int displayX, final int displayY) {
this.repo = def;
this.offset = offset;
this.xPos = displayX;
this.yPos = displayY;
}
public InternalSlotME( final ItemRepo def, final int offset, final int displayX, final int displayY )
{
this.repo = def;
this.offset = offset;
this.xPos = displayX;
this.yPos = displayY;
}
ItemStack getStack() {
return this.getAEStack() == null ? ItemStack.EMPTY : this.getAEStack().asItemStackRepresentation();
}
ItemStack getStack()
{
return this.getAEStack() == null ? ItemStack.EMPTY : this.getAEStack().asItemStackRepresentation();
}
IAEItemStack getAEStack() {
return this.repo.getReferenceItem(this.offset);
}
IAEItemStack getAEStack()
{
return this.repo.getReferenceItem( this.offset );
}
boolean hasPower() {
return this.repo.hasPower();
}
boolean hasPower()
{
return this.repo.hasPower();
}
int getxPosition() {
return this.xPos;
}
int getxPosition()
{
return this.xPos;
}
int getyPosition()
{
return this.yPos;
}
int getyPosition() {
return this.yPos;
}
}
+148 -192
View File
@@ -18,7 +18,6 @@
package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -26,8 +25,8 @@ import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import appeng.integration.abstraction.JEIFacade;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import appeng.api.AEApi;
import appeng.api.config.SearchBoxMode;
@@ -41,237 +40,194 @@ import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
import appeng.integration.abstraction.JEIFacade;
import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
import net.minecraft.util.text.ITextComponent;
public class ItemRepo {
public class ItemRepo
{
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
private final ArrayList<IAEItemStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
private final IItemList<IAEItemStack> list = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
private final ArrayList<IAEItemStack> view = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
private int rowSize = 9;
private int rowSize = 9;
private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList;
private String innerSearch = "";
private boolean hasPower;
private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList;
private String innerSearch = "";
private boolean hasPower;
public ItemRepo(final IScrollSource src, final ISortSource sortSrc) {
this.src = src;
this.sortSrc = sortSrc;
}
public ItemRepo( final IScrollSource src, final ISortSource sortSrc )
{
this.src = src;
this.sortSrc = sortSrc;
}
public IAEItemStack getReferenceItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
public IAEItemStack getReferenceItem( int idx )
{
idx += this.src.getCurrentScroll() * this.rowSize;
if (idx >= this.view.size()) {
return null;
}
return this.view.get(idx);
}
if( idx >= this.view.size() )
{
return null;
}
return this.view.get( idx );
}
void setSearch(final String search) {
this.searchString = search == null ? "" : search;
}
void setSearch( final String search )
{
this.searchString = search == null ? "" : search;
}
public void postUpdate(final IAEItemStack is) {
final IAEItemStack st = this.list.findPrecise(is);
public void postUpdate( final IAEItemStack is )
{
final IAEItemStack st = this.list.findPrecise( is );
if (st != null) {
st.reset();
st.add(is);
} else {
this.list.add(is);
}
}
if( st != null )
{
st.reset();
st.add( is );
}
else
{
this.list.add( is );
}
}
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.updateView();
}
public void setViewCell( final ItemStack[] list )
{
this.myPartitionList = ItemViewCell.createFilter( list );
this.updateView();
}
public void updateView() {
this.view.clear();
public void updateView()
{
this.view.clear();
this.view.ensureCapacity(this.list.size());
this.view.ensureCapacity( this.list.size() );
final Enum viewMode = this.sortSrc.getSortDisplay();
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_MODE);
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
final Enum viewMode = this.sortSrc.getSortDisplay();
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
if (searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH
|| searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP
|| searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP) {
this.updateJEI(this.searchString);
}
if( searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP )
{
this.updateJEI( this.searchString );
}
this.innerSearch = this.searchString;
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager()
.getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
this.innerSearch = this.searchString;
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
boolean searchMod = false;
if (this.innerSearch.startsWith("@")) {
searchMod = true;
this.innerSearch = this.innerSearch.substring(1);
}
boolean searchMod = false;
if( this.innerSearch.startsWith( "@" ) )
{
searchMod = true;
this.innerSearch = this.innerSearch.substring( 1 );
}
Pattern m = null;
try {
m = Pattern.compile(this.innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
} catch (final Throwable ignore) {
try {
m = Pattern.compile(Pattern.quote(this.innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
} catch (final Throwable __) {
return;
}
}
Pattern m = null;
try
{
m = Pattern.compile( this.innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
}
catch( final Throwable ignore )
{
try
{
m = Pattern.compile( Pattern.quote( this.innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
}
catch( final Throwable __ )
{
return;
}
}
boolean notDone = false;
for (IAEItemStack is : this.list) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
}
}
boolean notDone = false;
for( IAEItemStack is : this.list )
{
if( this.myPartitionList != null )
{
if( !this.myPartitionList.isListed( is ) )
{
continue;
}
}
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
continue;
}
if( viewMode == ViewItems.CRAFTABLE && !is.isCraftable() )
{
continue;
}
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
{
continue;
}
final String dspName = searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is).getString();
boolean foundMatchingItemStack = false;
notDone = true;
final String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is ).getString();
boolean foundMatchingItemStack = false;
notDone = true;
if (m.matcher(dspName.toLowerCase()).find()) {
notDone = false;
foundMatchingItemStack = true;
}
if( m.matcher( dspName.toLowerCase() ).find() )
{
notDone = false;
foundMatchingItemStack = true;
}
if (terminalSearchToolTips && notDone && !searchMod) {
final List<ITextComponent> tooltip = Platform.getTooltip(is);
if( terminalSearchToolTips && notDone && !searchMod )
{
final List<ITextComponent> tooltip = Platform.getTooltip( is );
for (final ITextComponent line : tooltip) {
if (m.matcher(line.getString()).find()) {
foundMatchingItemStack = true;
notDone = false;
break;
}
}
}
for( final ITextComponent line : tooltip )
{
if( m.matcher( line.getString() ).find() )
{
foundMatchingItemStack = true;
notDone = false;
break;
}
}
}
if (foundMatchingItemStack) {
if (needsZeroCopy) {
is = is.copy();
is.setStackSize(0);
}
if( foundMatchingItemStack )
{
if( needsZeroCopy )
{
is = is.copy();
is.setStackSize( 0 );
}
this.view.add(is);
}
}
this.view.add( is );
}
}
final Enum SortBy = this.sortSrc.getSortBy();
final Enum SortDir = this.sortSrc.getSortDir();
final Enum SortBy = this.sortSrc.getSortBy();
final Enum SortDir = this.sortSrc.getSortDir();
ItemSorters.setDirection((appeng.api.config.SortDir) SortDir);
ItemSorters.init();
ItemSorters.setDirection( (appeng.api.config.SortDir) SortDir );
ItemSorters.init();
if (SortBy == SortOrder.MOD) {
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
Collections.sort(this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME);
}
}
if( SortBy == SortOrder.MOD )
{
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_MOD );
}
else if( SortBy == SortOrder.AMOUNT )
{
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_SIZE );
}
else if( SortBy == SortOrder.INVTWEAKS )
{
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS );
}
else
{
Collections.sort( this.view, ItemSorters.CONFIG_BASED_SORT_BY_NAME );
}
}
private void updateJEI(String filter) {
JEIFacade.instance().setSearchText(filter);
}
private void updateJEI( String filter )
{
JEIFacade.instance().setSearchText( filter );
}
public int size() {
return this.view.size();
}
public int size()
{
return this.view.size();
}
public void clear() {
this.list.resetStatus();
}
public void clear()
{
this.list.resetStatus();
}
public boolean hasPower() {
return this.hasPower;
}
public boolean hasPower()
{
return this.hasPower;
}
public void setPower(final boolean hasPower) {
this.hasPower = hasPower;
}
public void setPower( final boolean hasPower )
{
this.hasPower = hasPower;
}
public int getRowSize() {
return this.rowSize;
}
public int getRowSize()
{
return this.rowSize;
}
public void setRowSize(final int rowSize) {
this.rowSize = rowSize;
}
public void setRowSize( final int rowSize )
{
this.rowSize = rowSize;
}
public String getSearchString() {
return this.searchString;
}
public String getSearchString()
{
return this.searchString;
}
public void setSearchString( @Nonnull final String searchString )
{
this.searchString = searchString;
}
public void setSearchString(@Nonnull final String searchString) {
this.searchString = searchString;
}
}
@@ -18,84 +18,69 @@
package appeng.client.me;
import appeng.items.misc.ItemEncodedPattern;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.container.slot.AppEngSlot;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform;
public class SlotDisconnected extends AppEngSlot {
public class SlotDisconnected extends AppEngSlot
{
private final ClientDCInternalInv mySlot;
private final ClientDCInternalInv mySlot;
public SlotDisconnected(final ClientDCInternalInv me, final int which, final int x, final int y) {
super(me.getInventory(), which, x, y);
this.mySlot = me;
}
public SlotDisconnected( final ClientDCInternalInv me, final int which, final int x, final int y )
{
super( me.getInventory(), which, x, y );
this.mySlot = me;
}
@Override
public boolean isItemValid(final ItemStack par1ItemStack) {
return false;
}
@Override
public boolean isItemValid( final ItemStack par1ItemStack )
{
return false;
}
@Override
public void putStack(final ItemStack par1ItemStack) {
@Override
public void putStack( final ItemStack par1ItemStack )
{
}
}
@Override
public boolean canTakeStack(final PlayerEntity par1PlayerEntity) {
return false;
}
@Override
public boolean canTakeStack( final PlayerEntity par1PlayerEntity )
{
return false;
}
@Override
public ItemStack getDisplayStack() {
if (Platform.isClient()) {
final ItemStack is = super.getStack();
if (!is.isEmpty() && is.getItem() instanceof ItemEncodedPattern) {
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ItemStack out = iep.getOutput(is);
if (!out.isEmpty()) {
return out;
}
}
}
return super.getStack();
}
@Override
public ItemStack getDisplayStack()
{
if( Platform.isClient() )
{
final ItemStack is = super.getStack();
if( !is.isEmpty() && is.getItem() instanceof ItemEncodedPattern)
{
final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
final ItemStack out = iep.getOutput( is );
if( !out.isEmpty() )
{
return out;
}
}
}
return super.getStack();
}
@Override
public boolean getHasStack() {
return !this.getStack().isEmpty();
}
@Override
public boolean getHasStack()
{
return !this.getStack().isEmpty();
}
@Override
public int getSlotStackLimit() {
return 0;
}
@Override
public int getSlotStackLimit()
{
return 0;
}
@Override
public ItemStack decrStackSize(final int par1) {
return ItemStack.EMPTY;
}
@Override
public ItemStack decrStackSize( final int par1 )
{
return ItemStack.EMPTY;
}
public ClientDCInternalInv getSlot()
{
return this.mySlot;
}
public ClientDCInternalInv getSlot() {
return this.mySlot;
}
}
+92 -106
View File
@@ -1,106 +1,92 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.me;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEFluidStack;
import appeng.fluids.container.slots.IMEFluidSlot;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot
{
private InternalFluidSlotME slot;
public SlotFluidME( InternalFluidSlotME slot )
{
super( null, 0, slot.getxPosition(), slot.getyPosition() );
this.slot = slot;
}
@Override
public IAEFluidStack getAEFluidStack()
{
if( this.slot.hasPower() )
{
return this.slot.getAEStack();
}
return null;
}
@Override
public boolean isItemValid( final ItemStack par1ItemStack )
{
return false;
}
@Nonnull
@Override
public ItemStack getStack()
{
return ItemStack.EMPTY;
}
@Override
public boolean getHasStack()
{
if( this.slot.hasPower() )
{
return this.getAEFluidStack() != null;
}
return false;
}
@Override
public void putStack( final ItemStack par1ItemStack )
{
}
@Override
public int getSlotStackLimit()
{
return 0;
}
@Nonnull
@Override
public ItemStack decrStackSize( final int par1 )
{
return ItemStack.EMPTY;
}
@Override
public boolean canTakeStack( final PlayerEntity par1PlayerEntity )
{
return false;
}
}
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.me;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEFluidStack;
import appeng.fluids.container.slots.IMEFluidSlot;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
private InternalFluidSlotME slot;
public SlotFluidME(InternalFluidSlotME slot) {
super(null, 0, slot.getxPosition(), slot.getyPosition());
this.slot = slot;
}
@Override
public IAEFluidStack getAEFluidStack() {
if (this.slot.hasPower()) {
return this.slot.getAEStack();
}
return null;
}
@Override
public boolean isItemValid(final ItemStack par1ItemStack) {
return false;
}
@Nonnull
@Override
public ItemStack getStack() {
return ItemStack.EMPTY;
}
@Override
public boolean getHasStack() {
if (this.slot.hasPower()) {
return this.getAEFluidStack() != null;
}
return false;
}
@Override
public void putStack(final ItemStack par1ItemStack) {
}
@Override
public int getSlotStackLimit() {
return 0;
}
@Nonnull
@Override
public ItemStack decrStackSize(final int par1) {
return ItemStack.EMPTY;
}
@Override
public boolean canTakeStack(final PlayerEntity par1PlayerEntity) {
return false;
}
}
+45 -60
View File
@@ -18,7 +18,6 @@
package appeng.client.me;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -26,74 +25,60 @@ import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEItemStack;
public class SlotME extends SlotItemHandler {
public class SlotME extends SlotItemHandler
{
private final InternalSlotME mySlot;
private final InternalSlotME mySlot;
public SlotME(final InternalSlotME me) {
super(null, 0, me.getxPosition(), me.getyPosition());
this.mySlot = me;
}
public SlotME( final InternalSlotME me )
{
super( null, 0, me.getxPosition(), me.getyPosition() );
this.mySlot = me;
}
public IAEItemStack getAEStack() {
if (this.mySlot.hasPower()) {
return this.mySlot.getAEStack();
}
return null;
}
public IAEItemStack getAEStack()
{
if( this.mySlot.hasPower() )
{
return this.mySlot.getAEStack();
}
return null;
}
@Override
public boolean isItemValid(final ItemStack par1ItemStack) {
return false;
}
@Override
public boolean isItemValid( final ItemStack par1ItemStack )
{
return false;
}
@Override
public ItemStack getStack() {
if (this.mySlot.hasPower()) {
return this.mySlot.getStack();
}
return ItemStack.EMPTY;
}
@Override
public ItemStack getStack()
{
if( this.mySlot.hasPower() )
{
return this.mySlot.getStack();
}
return ItemStack.EMPTY;
}
@Override
public boolean getHasStack() {
if (this.mySlot.hasPower()) {
return !this.getStack().isEmpty();
}
return false;
}
@Override
public boolean getHasStack()
{
if( this.mySlot.hasPower() )
{
return !this.getStack().isEmpty();
}
return false;
}
@Override
public void putStack(final ItemStack par1ItemStack) {
@Override
public void putStack( final ItemStack par1ItemStack )
{
}
}
@Override
public int getSlotStackLimit() {
return 0;
}
@Override
public int getSlotStackLimit()
{
return 0;
}
@Override
public ItemStack decrStackSize(final int par1) {
return ItemStack.EMPTY;
}
@Override
public ItemStack decrStackSize( final int par1 )
{
return ItemStack.EMPTY;
}
@Override
public boolean canTakeStack( final PlayerEntity par1PlayerEntity )
{
return false;
}
@Override
public boolean canTakeStack(final PlayerEntity par1PlayerEntity) {
return false;
}
}