Skip to content

Commit

Permalink
fix Programming Circuit tag data
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Jun 3, 2024
1 parent 783a900 commit 31823c5
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ catch (Exception ignored) {

// Pulls version first from the VERSION env and then git tag
String identifiedVersion = null
String versionOverride = '0.0.15'
String versionOverride = '0.0.15p1'
try {
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ private boolean postEvent() {
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void write(NBTTagCompound data) {
ProghatchesUtil.ser(data, id, "EUFI");
if(customName!=null)
data.setString("customName",customName);
data.setLong("amp", amp);
data.setLong("voltage", voltage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ public DualInputHatch(int id, String name, String nameRegional, int tier, int sl
initTierBasedField();
}
public int fluidSlots(){
return Math.max(4, mTier-2);
return Math.max(4, mTier-1);

}
public static int fluidSlots(int mTier){
return Math.max(4, mTier-2);
return Math.max(4, mTier-1);

}
public void initTierBasedField() {
Expand Down Expand Up @@ -906,7 +906,7 @@ public int getInventoryStackLimit() {

public static int getInventoryStackLimit(int mTier) {

return 64+32*mTier;
return 64+64*Math.max(0,mTier-3);
}

public void add1by1Slot(ModularWindow.Builder builder, IDrawable... background) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ public void loadNBTData(NBTTagCompound aNBT) {
pattern[i] = Optional.ofNullable(tag.getCompoundTag("i" + i)).map(ItemStack::loadItemStackFromNBT)
.orElse(null);
}
Optional.ofNullable(customName).ifPresent(s -> aNBT.setString("customName", s));
customName = aNBT.getString("customName");

getProxy().readFromNBT(aNBT);
super.loadNBTData(aNBT);
}
Expand All @@ -443,7 +444,7 @@ public void saveNBTData(NBTTagCompound aNBT) {
.ifPresent(s -> tag.setTag("i" + ii, s));
}
aNBT.setTag("patternSlots", tag);
Optional.ofNullable(aNBT.getTag("customName")).map(NBTBase::toString).ifPresent(s -> customName = s);
Optional.ofNullable(customName).ifPresent(s -> aNBT.setString("customName", s));
getProxy().writeToNBT(aNBT);
super.saveNBTData(aNBT);
}
Expand Down Expand Up @@ -625,7 +626,7 @@ public String getCustomName() {
@Override
public boolean hasCustomName() {

return customName != null;
return customName != null&&(!customName.equals(""));
}
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, ForgeDirection side,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ public void saveNBTData(NBTTagCompound aNBT) {
int[] count = new int[1];
toReturn.forEach(s -> aNBT.setTag("toReturn" + (count[0]++), s.writeToNBT(new NBTTagCompound())));
getProxy().writeToNBT(aNBT);
aNBT.setString("customName",customName);
Optional.ofNullable(customName).ifPresent(s -> aNBT.setString("customName", s));
//aNBT.setString("customName",customName);
aNBT.setBoolean("disabled", disabled);
aNBT.setBoolean("legacy", disabled);
aNBT.setInteger("tech", tech);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ public static ItemStack wrap(ItemStack is,int i,boolean legacy) {
public static ItemStack parse(NBTTagCompound tag){

String s=tag.getString("string_id");

if(s.isEmpty()==false){
//if string id is present, replace the number id
tag=(NBTTagCompound) tag.copy();//note to self: copy it before modifying it!!!
tag.setInteger("id", Item.itemRegistry.getIDForObject(Item.itemRegistry.getObject(s)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/reobf/proghatches/main/MyMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:appliedenergistics2;required-after:gregtech;"

,acceptableRemoteVersions="*"
/*
* ,dependencies= "required-after:neenergistics;"
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ public void run() {
6+Math.max(i-4, 0)*2);

}

new ProgrammingCircuitProvider(
Config.metaTileEntityOffset + CircuitProviderOffset,
"circuitprovider",
LangManager.translateToLocal("circuitprovider.name"),
5,
4, 1);
new ProgrammingCircuitProvider(
new ProgrammingCircuitProvider(
Config.metaTileEntityOffset + CircuitProviderOffsetT0,
"circuitprovider",
LangManager.translateToLocal("circuitprovider.name.tech0"),
3,
1, 0);

new ProgrammingCircuitProvider(
Config.metaTileEntityOffset + CircuitProviderOffset,
"circuitprovider",
LangManager.translateToLocal("circuitprovider.name"),
5,
4, 1);


GregTech_API.registerCover(
new ItemStack(MyMod.cover, 1, 0),
Expand Down Expand Up @@ -302,7 +302,7 @@ public void run() {

new LargeProgrammingCircuitProvider(
Config.metaTileEntityOffset + LargeProviderOffset,
"multimachine.largeprogrammingcircuitprovider",
"multimachine.largeprogrammingcircuit",
LangManager.translateToLocalFormatted("multimachine.largeprogrammingcircuitprovider.name"));
new ProviderChainer(
Config.metaTileEntityOffset + ChainerOffset ,
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/assets/proghatches/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,3 @@ programmable_hatches.gt.insertion.tooltip.1=这里的物品插入不受最大堆
programmable_hatches.gt.insertion.tooltip.2=ME接口同样也不受最大堆叠限制
programmable_hatches.gt.insertion.tooltip.3=警告!关闭这个窗口会丢出剩下的物品
programmable_hatches.gt.insertion.tooltip=4

0 comments on commit 31823c5

Please sign in to comment.