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,61 +19,52 @@
package appeng.client.me;
import javax.annotation.Nonnull;
import appeng.tile.inventory.AppEngInternalInventory;
import net.minecraft.util.text.translation.I18n;
import appeng.tile.inventory.AppEngInternalInventory;
import javax.annotation.Nonnull;
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, 1 );
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, 1);
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
}
public ClientDCInternalInv( final int size, final long id, final long sortBy, final String unlocalizedName, int stackSize )
{
this.inventory = new AppEngInternalInventory( null, size, stackSize );
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
}
public ClientDCInternalInv(final int size, final long id, final long sortBy, final String unlocalizedName, int stackSize) {
this.inventory = new AppEngInternalInventory(null, size, stackSize);
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
}
public String getName()
{
final String s = I18n.translateToLocal( this.unlocalizedName + ".name" );
if( s.equals( this.unlocalizedName + ".name" ) )
{
return I18n.translateToLocal( this.unlocalizedName );
}
return s;
}
public String getName() {
final String s = I18n.translateToLocal(this.unlocalizedName + ".name");
if (s.equals(this.unlocalizedName + ".name")) {
return I18n.translateToLocal(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;
}
}
+127 -167
View File
@@ -19,13 +19,6 @@
package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import appeng.api.AEApi;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
@@ -41,203 +34,170 @@ import appeng.fluids.util.FluidSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
/**
* @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 );
boolean foundMatchingFluidStack = false;
notDone = true;
final String dspName = searchMod ? Platform.getModId(fs) : Platform.getFluidDisplayName(fs);
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<String> tooltip = Platform.getTooltip( fs );
if (terminalSearchToolTips && notDone && !searchMod) {
final List<String> tooltip = Platform.getTooltip(fs);
for( final String line : tooltip )
{
if( m.matcher( line ).find() )
{
foundMatchingFluidStack = true;
break;
}
}
}
for (final String line : tooltip) {
if (m.matcher(line).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;
}
}
@@ -27,39 +27,33 @@ import appeng.api.storage.data.IAEFluidStack;
* @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;
}
}
@@ -19,49 +19,41 @@
package appeng.client.me;
import appeng.api.storage.data.IAEItemStack;
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;
}
}
+164 -224
View File
@@ -19,21 +19,8 @@
package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.config.YesNo;
import appeng.api.config.*;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -46,255 +33,208 @@ import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
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 long getItemCount( final IAEItemStack is )
{
IAEItemStack st = this.list.findPrecise( is );
return st == null ? 0 : st.getStackSize();
}
public long getItemCount(final IAEItemStack is) {
IAEItemStack st = this.list.findPrecise(is);
return st == null ? 0 : st.getStackSize();
}
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);
}
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting(Settings.SEARCH_TOOLTIPS) != YesNo.NO;
boolean searchMod = false;
boolean searchMod = false;
this.innerSearch = searchString.toLowerCase();
if( this.innerSearch.startsWith( "@" ) )
{
searchMod = true;
this.innerSearch = this.innerSearch.substring( 1 );
}
this.innerSearch = searchString.toLowerCase();
if (this.innerSearch.startsWith("@")) {
searchMod = true;
this.innerSearch = this.innerSearch.substring(1);
}
Pattern m = null;
try
{
m = Pattern.compile( this.innerSearch, Pattern.CASE_INSENSITIVE );
}
catch( final Throwable ignore )
{
try
{
m = Pattern.compile( Pattern.quote( this.innerSearch ), Pattern.CASE_INSENSITIVE );
}
catch( final Throwable __ )
{
return;
}
}
Pattern m = null;
try {
m = Pattern.compile(this.innerSearch, Pattern.CASE_INSENSITIVE);
} catch (final Throwable ignore) {
try {
m = Pattern.compile(Pattern.quote(this.innerSearch), 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 ) ).toLowerCase();
boolean foundMatchingItemStack = true;
final String dspName = (searchMod ? Platform.getModId(is) : Platform.getItemDisplayName(is)).toLowerCase();
boolean foundMatchingItemStack = true;
for( String term : innerSearch.split( " " ) )
{
if( term.length() > 1 && ( term.startsWith( "-" ) || term.startsWith( "!" ) ) )
{
term = term.substring( 1 );
if( dspName.contains( term ) )
{
foundMatchingItemStack = false;
break;
}
}
else if( !dspName.contains( term ) )
{
foundMatchingItemStack = false;
break;
}
}
for (String term : innerSearch.split(" ")) {
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
term = term.substring(1);
if (dspName.contains(term)) {
foundMatchingItemStack = false;
break;
}
} else if (!dspName.contains(term)) {
foundMatchingItemStack = false;
break;
}
}
if( terminalSearchToolTips && !foundMatchingItemStack )
{
final List<String> tooltip = Platform.getTooltip( is );
for( final String line : tooltip )
{
if( m.matcher( line ).find() )
{
foundMatchingItemStack = true;
break;
}
}
}
if (terminalSearchToolTips && !foundMatchingItemStack) {
final List<String> tooltip = Platform.getTooltip(is);
for (final String line : tooltip) {
if (m.matcher(line).find()) {
foundMatchingItemStack = true;
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 )
{
if( InventoryBogoSortModule.isLoaded() )
{
Collections.sort( this.view, InventoryBogoSortModule.COMPARATOR );
}
else
{
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) {
if (InventoryBogoSortModule.isLoaded()) {
Collections.sort(this.view, InventoryBogoSortModule.COMPARATOR);
} else {
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 )
{
Integrations.jei().setSearchText( filter );
}
private void updateJEI(String filter) {
Integrations.jei().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;
}
}
@@ -19,90 +19,75 @@
package appeng.client.me;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.IJEITargetSlot;
import appeng.items.misc.ItemEncodedPattern;
import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
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 implements IJEITargetSlot {
public class SlotDisconnected extends AppEngSlot implements IJEITargetSlot
{
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 EntityPlayer par1EntityPlayer) {
return false;
}
@Override
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
{
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;
}
@Override
public boolean isHere(final IInventory inv, final int slotIn) {
return false;
}
@Override
public boolean isHere( final IInventory inv, final int slotIn )
{
return false;
}
public ClientDCInternalInv getSlot()
{
return this.mySlot;
}
public ClientDCInternalInv getSlot() {
return this.mySlot;
}
}
+52 -66
View File
@@ -19,15 +19,14 @@
package appeng.client.me;
import javax.annotation.Nonnull;
import appeng.api.storage.data.IAEFluidStack;
import appeng.fluids.container.slots.IMEFluidSlot;
import net.minecraft.entity.player.EntityPlayer;
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;
import javax.annotation.Nonnull;
/**
@@ -35,78 +34,65 @@ import appeng.fluids.container.slots.IMEFluidSlot;
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot
{
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
private InternalFluidSlotME slot;
private final InternalFluidSlotME slot;
public SlotFluidME( InternalFluidSlotME slot )
{
super( null, 0, slot.getxPosition(), slot.getyPosition() );
this.slot = 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 IAEFluidStack getAEFluidStack() {
if (this.slot.hasPower()) {
return this.slot.getAEStack();
}
return null;
}
@Override
public boolean isItemValid( final ItemStack par1ItemStack )
{
return false;
}
@Override
public boolean isItemValid(final ItemStack par1ItemStack) {
return false;
}
@Nonnull
@Override
public ItemStack getStack()
{
return ItemStack.EMPTY;
}
@Nonnull
@Override
public ItemStack getStack() {
return ItemStack.EMPTY;
}
@Override
public boolean getHasStack()
{
if( this.slot.hasPower() )
{
return this.getAEFluidStack() != null;
}
return false;
}
@Override
public boolean getHasStack() {
if (this.slot.hasPower()) {
return this.getAEFluidStack() != null;
}
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;
}
@Nonnull
@Override
public ItemStack decrStackSize( final int par1 )
{
return ItemStack.EMPTY;
}
@Nonnull
@Override
public ItemStack decrStackSize(final int par1) {
return ItemStack.EMPTY;
}
@Override
public boolean isHere( final IInventory inv, final int slotIn )
{
return false;
}
@Override
public boolean isHere(final IInventory inv, final int slotIn) {
return false;
}
@Override
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
{
return false;
}
@Override
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
return false;
}
}
+50 -65
View File
@@ -19,87 +19,72 @@
package appeng.client.me;
import appeng.api.storage.data.IAEItemStack;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
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 isHere(final IInventory inv, final int slotIn) {
return false;
}
@Override
public boolean isHere( final IInventory inv, final int slotIn )
{
return false;
}
@Override
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
{
return false;
}
@Override
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
return false;
}
}