Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Nov 12, 2024
1 parent 0127372 commit 7729a10
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/main/java/reobf/proghatches/gt/cover/LevelControlCover.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
builder.widget(new CycleButtonWidget().setGetter(()->getCoverData().invert?1:0)
.setSetter(s->getCoverData().invert=s==1).setLength(2)
.setTextureGetter(s->{
if(s==0)return GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ITEM;
if(s==1)return GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_FLUID;
if(s==0)return GT_UITextures.OVERLAY_BUTTON_CROSS;
if(s==1)return GT_UITextures.OVERLAY_BUTTON_CHECKMARK;
return GT_UITextures.OVERLAY_BUTTON_VOID_EXCESS_ALL;
})
//.addTooltip(0, StatCollector.translateToLocal("proghatches.amountmaintainer.phantomclick.mode.0"))
//.addTooltip(1, StatCollector.translateToLocal("proghatches.amountmaintainer.phantomclick.mode.1"))
.addTooltip(0, StatCollector.translateToLocal("proghatches.levelcontrolcover.invert.0"))
.addTooltip(1, StatCollector.translateToLocal("proghatches.levelcontrolcover.invert.1"))
.setBackground(() -> {
{
return new IDrawable[] { GT_UITextures.BUTTON_STANDARD,
Expand All @@ -150,7 +150,7 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
})

.setSize(18, 18)
.setPos(3+20, 3+20));
.setPos(3+20, 3+40));
builder.widget(new CycleButtonWidget().setGetter(()->getCoverData().mode)
.setSetter(s->getCoverData().mode=s).setLength(2)
.setTextureGetter(s->{
Expand All @@ -168,7 +168,7 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) {
})

.setSize(18, 18)
.setPos(3+20, 3+40));
.setPos(3+20, 3+20));
builder.widget(
new NumericWidget().setSetter(val -> getCoverData().amount = (long) val)
.setGetter(() -> getCoverData().amount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import gregtech.common.tileentities.casings.upgrade.Inventory;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_CraftingInput_ME;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_InputBus_ME;
import it.unimi.dsi.fastutil.Pair;
import li.cil.oc.api.network.Environment;
import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
Expand Down Expand Up @@ -756,28 +757,42 @@ public DimensionalCoord getLocation() {
public boolean isActive() {
return getProxy() != null && getProxy().isActive();
}

ItemStack[] patternItemCache = new ItemStack[36];
ICraftingPatternDetails[] patternDetailCache = new ICraftingPatternDetails[36];


@Override
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
if (!isActive())
return;

for (ItemStack slot : pattern) {
if (slot == null)
for (int index = 0; index < pattern.length; index++) {
ItemStack slot = pattern[index];

if (slot == null){
patternItemCache[index] = null;
patternDetailCache[index] = null;
continue;
}

if (patternItemCache[index] == pattern[index]) {//just compare object id
craftingTracker.addCraftingOption(this, patternDetailCache[index]);
continue;
}

ICraftingPatternDetails details = null;
try {
details = ((ICraftingPatternItem) slot.getItem()).getPatternForItem(slot,
this.getBaseMetaTileEntity().getWorld());

} catch (Exception e) {

}
if (details == null) {
GT_Mod.GT_FML_LOGGER.warn("Found an invalid pattern at " + getBaseMetaTileEntity().getCoords()
+ " in dim " + getBaseMetaTileEntity().getWorld().provider.dimensionId);
continue;
}
patternItemCache[index] = pattern[index];
patternDetailCache[index] = details;
craftingTracker.addCraftingOption(this, details);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,30 +861,45 @@ private boolean postMEPatternChange() {
}
return true;
}
ItemStack[] patternItemCache = new ItemStack[36];
ICraftingPatternDetails[] patternDetailCache = new ICraftingPatternDetails[36];


@Override
public void provideCrafting(ICraftingProviderHelper craftingTracker) {

if (!isActive())
return;

for (ItemStack slot : pattern) {
if (slot == null)
for (int index = 0; index < pattern.length; index++) {
ItemStack slot = pattern[index];

if (slot == null){
patternItemCache[index] = null;
patternDetailCache[index] = null;
continue;
}

if (patternItemCache[index] == pattern[index]) {//just compare object id
craftingTracker.addCraftingOption(this, patternDetailCache[index]);
continue;
}

ICraftingPatternDetails details = null;
try {
details = ((ICraftingPatternItem) slot.getItem()).getPatternForItem(slot,
this.getBaseMetaTileEntity().getWorld());

} catch (Exception e) {

}
if (details == null) {
GT_Mod.GT_FML_LOGGER.warn("Found an invalid pattern at " + getBaseMetaTileEntity().getCoords()
+ " in dim " + getBaseMetaTileEntity().getWorld().provider.dimensionId);
continue;
}
patternItemCache[index] = pattern[index];
patternDetailCache[index] = details;
craftingTracker.addCraftingOption(this, details);
}

}

protected ModularWindow createPatternWindow(final EntityPlayer player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ public ItemStack getOutput(InventoryCrafting craftingInv, World world) {
@Override
public int getPriority() {

return Integer.MIN_VALUE;
return Integer.MAX_VALUE-10;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void displayAllReleventItems(List p_78018_1_) {
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 4));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 0));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 1));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 100));
// p_78018_1_.add(new ItemStack(MyMod.cover, 1, 2));
p_78018_1_.add(new ItemStack(MyMod.oc_api, 1));
p_78018_1_.add(new ItemStack(MyMod.oc_redstone, 1));
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/proghatches/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -652,4 +652,5 @@ programmable_hatches.gt.cmmode.3=Do not use Dual Interface, even if your pattern
programmable_hatches.gt.cmmode.4=Does not accept items from cache of Interface(just like Molcular Assembler).
programmable_hatches.gt.cmmode.5=So do not place unexpected TEs around, or Interface will be tricked into pushing materials into cache!
programmable_hatches.gt.cmmode.6=This happens even it TE has no inventory in some version, or just use Interface in panel form.

proghatches.levelcontrolcover.invert.0=On if >=amount
proghatches.levelcontrolcover.invert.1=On if <=amount
2 changes: 2 additions & 0 deletions src/main/resources/assets/proghatches/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -650,3 +650,5 @@ programmable_hatches.gt.cmmode.3=不要用二合一接口,即使样板含有流
programmable_hatches.gt.cmmode.4=就像分子装配室一样,无法从接口的缓存中接受物品
programmable_hatches.gt.cmmode.5=所以不要在周围放TE方块,否则接口会试图向它输送物品,失败后放入缓存卡死合成!
programmable_hatches.gt.cmmode.6=某些版本中即使TE没有物品栏也被认为是容器!或者使用面板形式的接口避免这个问题
proghatches.levelcontrolcover.invert.0=开启条件: >=数量
proghatches.levelcontrolcover.invert.1=开启条件: <=数量

0 comments on commit 7729a10

Please sign in to comment.