diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java index c0a2387..97f33a1 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputBusME.java @@ -231,7 +231,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl final int WIDTH = 78; - final int HEIGHT = 80+18+18; + final int HEIGHT = parent.getSize().height+18+18+3; final int PARENT_WIDTH = getGUIWidth(); final int PARENT_HEIGHT = getGUIHeight(); ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT); @@ -250,7 +250,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl .add(WIDTH - 3, 0))); builder.widget( TextWidget.localised("proghatches.priority.filter") - .setPos(3, 80) + .setPos(3, parent.getSize().height) .setSize(74, 18)) .widget( new NumericWidget().setSetter(val -> filter = (int) val) @@ -260,7 +260,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl .setTextAlignment(Alignment.Center) .setTextColor(Color.WHITE.normal) .setSize(70, 18) - .setPos(3, 80+18) + .setPos(3, parent.getSize().height+18) .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD)); @@ -329,6 +329,16 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont } + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("filter", filter); + super.saveNBTData(aNBT); + } + @Override + public void loadNBTData(NBTTagCompound aNBT) { + filter =aNBT.getInteger("filter" ); + super.loadNBTData(aNBT); + } @Override public NBTTagCompound getCopiedData(EntityPlayer player) { return IDataCopyablePlaceHolderSuper.super.getCopiedData(player); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java index 803005b..949acd8 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/PriorityFilterInputHatchME.java @@ -232,7 +232,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl final int WIDTH = 78; - final int HEIGHT = 80+18+18; + final int HEIGHT = parent.getSize().height+18+18+3; final int PARENT_WIDTH = getGUIWidth(); final int PARENT_HEIGHT = getGUIHeight(); ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT); @@ -251,7 +251,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl .add(WIDTH - 3, 0))); builder.widget( TextWidget.localised("proghatches.priority.filter") - .setPos(3, 80) + .setPos(3, parent.getSize().height) .setSize(74, 18)) .widget( new NumericWidget().setSetter(val -> filter = (int) val) @@ -261,7 +261,7 @@ protected ModularWindow createStackSizeConfigurationWindow(final EntityPlayer pl .setTextAlignment(Alignment.Center) .setTextColor(Color.WHITE.normal) .setSize(70, 18) - .setPos(3, 80+18) + .setPos(3, parent.getSize().height+18) .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD)); @@ -328,7 +328,16 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont super.addUIWidgets(builder, buildContext); - } + } @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("filter", filter); + super.saveNBTData(aNBT); + } + @Override + public void loadNBTData(NBTTagCompound aNBT) { + filter =aNBT.getInteger("filter" ); + super.loadNBTData(aNBT); + } @Override public NBTTagCompound getCopiedData(EntityPlayer player) { return IDataCopyablePlaceHolderSuper.super.getCopiedData(player); diff --git a/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java b/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java index 6a36286..2861b3a 100644 --- a/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java +++ b/src/main/java/reobf/proghatches/gt/metatileentity/RestrictedInputBusME.java @@ -10,6 +10,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; @@ -48,6 +49,7 @@ import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.Text; +import com.gtnewhorizons.modularui.api.drawable.UITexture; import com.gtnewhorizons.modularui.api.math.Alignment; import com.gtnewhorizons.modularui.api.math.Color; import com.gtnewhorizons.modularui.api.math.Pos2d; @@ -139,9 +141,91 @@ public String[] getDescription() { static private int _mDescriptionArray_offset; static private int _mDescription_offset; + static Field f1,f2,f3; + static{ + try { + f1=GT_MetaTileEntity_Hatch_InputBus_ME.class.getDeclaredField("shadowInventory"); + f2=GT_MetaTileEntity_Hatch_InputBus_ME.class.getDeclaredField("savedStackSizes"); + f3=GT_MetaTileEntity_Hatch_InputBus_ME.class.getDeclaredField("processingRecipe"); + f1. + setAccessible(true); + f2. + setAccessible(true); + f3.setAccessible(true); + } catch (Exception e) { + e.printStackTrace(); + } + + + + } + public ItemStack[] shadowInventory(){ + try { + return (ItemStack[]) f1.get(this); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + public int[] savedStackSizes(){ + try { + return (int[]) f2.get(this); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + public boolean processingRecipe(){ + try { + return (boolean) f3.get(this); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + + } + @Override + public ItemStack getStackInSlot(int aIndex) { + + ItemStack s= super.getStackInSlot(aIndex); + if(!processingRecipe()){return s;} + if(s==null)return null; + if(aIndex==getCircuitSlot())return s; + s=s.copy(); + if(s!=null&&s.stackSize>restrict){ + s.stackSize=restrict; + } + if(s!=null&&s.stackSize0&&multiples==1){ + s.stackSize=(s.stackSize/restrict_lowbound)*restrict_lowbound; + } + if(s!=null&&restrict_lowbound>0&&multiples==2){ + // s.stackSize=(s.stackSize/restrict_lowbound)*restrict_lowbound; + s.stackSize=1<<(31-Integer.numberOfLeadingZeros(s.stackSize/restrict_lowbound)); + s.stackSize*=restrict_lowbound; + } + + //if(s.stackSize<0)s=null; + + if(s!=null){ + this.shadowInventory()[aIndex] = s; + this.savedStackSizes()[aIndex] = this.shadowInventory()[aIndex].stackSize; + this.setInventorySlotContents(aIndex + SLOT_COUNT, this.shadowInventory()[aIndex]); + return this.shadowInventory()[aIndex]; + }else{ + this.setInventorySlotContents(aIndex + SLOT_COUNT, null); + + } + return s; + } public ItemStack updateInformationSlot(int aIndex, ItemStack aStack) { @@ -329,6 +413,7 @@ Widget createMultiplesModeButton(IWidgetBuilder builder,int HEIGHT) { Widget button = new CycleButtonWidget() .setLength(3) + .setTextureGetter((I)->UITexture.EMPTY) .addTooltip( 0,LangManager.translateToLocal("proghatches.restricted.multiples.exact")) .addTooltip( diff --git a/src/main/resources/assets/proghatches/lang/en_US/SH.lang b/src/main/resources/assets/proghatches/lang/en_US/SH.lang index b8e44a0..b138f08 100644 --- a/src/main/resources/assets/proghatches/lang/en_US/SH.lang +++ b/src/main/resources/assets/proghatches/lang/en_US/SH.lang @@ -5,5 +5,5 @@ Programming Cover function integrated Buffer: 1 For each buffer: Capacity: 100,000,000L x24 types of fluid -16 Slots +4 Slots Slot maximum stacksize:64 \ No newline at end of file diff --git a/src/main/resources/assets/proghatches/lang/zh_CN/SH.lang b/src/main/resources/assets/proghatches/lang/zh_CN/SH.lang index 503041b..096046e 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN/SH.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN/SH.lang @@ -4,5 +4,5 @@ 自带编程覆盖板功能 缓冲数量: 1 缓冲容量: 100,000,000L x24种流体 -16 格 +4 格 每格堆叠限制:64 \ No newline at end of file