Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Sep 5, 2024
1 parent a8ccf92 commit aa5f400
Show file tree
Hide file tree
Showing 11 changed files with 71 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.18p18'
String versionOverride = '0.0.18p19'
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
@@ -1,7 +1,15 @@
package reobf.proghatches.eucrafting;

import java.util.List;

import appeng.block.AEBaseItemBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import reobf.proghatches.main.mixin.MixinPlugin;

public class ItemBlockEUInterface extends AEBaseItemBlock {
//private final Block blockType;
Expand All @@ -10,4 +18,13 @@ public ItemBlockEUInterface(Block id) {
super(id);
//blockType = (Block) id;
}

@SideOnly(Side.CLIENT)
@Override
public void addCheckedInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
if(MixinPlugin.noEUMixin){p_77624_3_.add(
StatCollector.translateToLocal("proghatch.eucrafting.warn")
);}
super.addCheckedInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package reobf.proghatches.eucrafting;

import java.util.List;

import javax.annotation.Nullable;

import appeng.api.AEApi;
Expand All @@ -10,7 +12,9 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import reobf.proghatches.main.mixin.MixinPlugin;

public class ItemPartEUP2PInterface extends Item implements IPartItem {

Expand Down Expand Up @@ -49,6 +53,12 @@ public void registerIcons(IIconRegister _iconRegister) {
@SideOnly(Side.CLIENT)
public int getSpriteNumber() {
return 0;
}@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
if(MixinPlugin.noEUMixin){p_77624_3_.add(
StatCollector.translateToLocal("proghatch.eucrafting.warn")
);}
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
}

}
12 changes: 11 additions & 1 deletion src/main/java/reobf/proghatches/eucrafting/ItemPartEUSource.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package reobf.proghatches.eucrafting;

import java.util.List;

import javax.annotation.Nullable;

import appeng.api.AEApi;
Expand All @@ -15,6 +17,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import reobf.proghatches.main.mixin.MixinPlugin;

public class ItemPartEUSource extends Item implements IPartItem {

Expand Down Expand Up @@ -69,5 +72,12 @@ public void registerIcons(IIconRegister _iconRegister) {
public int getSpriteNumber() {
return 0;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
if(MixinPlugin.noEUMixin){p_77624_3_.add(
StatCollector.translateToLocal("proghatch.eucrafting.warn")
);}
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
}
}
8 changes: 5 additions & 3 deletions src/main/java/reobf/proghatches/main/asm/MUITransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
import reobf.proghatches.main.asm.repack.objectwebasm.tree.MethodNode;

public class MUITransformer implements IClassTransformer {

boolean done;
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass) {
if(!done)
if(name.equals("com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer")){
done=true;
ClassReader classReader = new ClassReader(basicClass);
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS|ClassWriter.COMPUTE_FRAMES);
ClassNode n=new ClassNode(Opcodes.ASM5){
Expand Down Expand Up @@ -65,7 +67,7 @@ public void visitLabel(Label label) {

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if(name.equals("iterator")/*desc.equals("java/util/List.iterator()Ljava/util/Iterator;")*/){
if(name.equals("iterator")/*desc.equals("()Ljava/util/Iterator;")*/){
ready=true;
}
if(arr.size()<=2)
Expand Down Expand Up @@ -94,7 +96,7 @@ public void visitJumpInsn(int opcode, Label label) {
, "(Lcom/gtnewhorizons/modularui/common/internal/wrapper/BaseSlot;Lcom/gtnewhorizons/modularui/common/internal/wrapper/BaseSlot;)Z", false);

super.visitJumpInsn(Opcodes.IFEQ, l);//result==false, pass
//result==true? this hould work like 'continue'
//result==true
super.visitInsn(Opcodes.POP2); //pop away top 2 ClickPriority to match stackmap
super.visitJumpInsn(Opcodes.GOTO, loop_entry);//return to loop entry
super.visitLabel(l);
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
"noAEItemSortMixins=false"+System.lineSeparator()

;
public static boolean noEUMixin;
static public ArrayList<String> retLate = new ArrayList<>();

//spotless:on
Expand Down Expand Up @@ -146,8 +147,15 @@ public List<String> getMixins() {
if(ff)retLate.add("eucrafting." + "MixinCpuClusterEUAutoRequest");
if(ff)retLate.add("eucrafting." + "MixinRemoveExcessiveEU");
if(ff)retLate.add("eucrafting." + "MixinCraftingRecursiveWorkaround");
} else{

}

noEUMixin=true;
}




if(ff)retLate.add("eucrafting." + "MixinEUSourceCoverChunkUnloadNotification");
if(ff) retLate.add("eucrafting." + "MixinCoverInsertion");
if (FMLLaunchHandler.side().isClient()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ private static void wrap(TileEntity capProvider, ForgeDirection face,
CallbackInfoReturnable<InventoryAdaptor> ret) {
*/

@Inject(method = "wrap", remap = false, at = { @At(value="INVOKE_ASSIGN",target="getTileEntity") },
@Inject(method = "wrap", remap = true, at = { @At(value="INVOKE_ASSIGN",target="Lnet/minecraft/world/World;getTileEntity(III)Lnet/minecraft/tileentity/TileEntity;") },
locals=LocalCapture.CAPTURE_FAILHARD,
cancellable = true)
cancellable = true,

require=1)
private static void wrap(TileEntity capProvider, ForgeDirection face,
CallbackInfoReturnable<InventoryAdaptor> ret, TileEntity inter) {



System.out.println(face);
Thread.dumpStack();
if (face == ForgeDirection.UNKNOWN) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public abstract class MixinAwarenessForDualHatch {
@Shadow
public CheckRecipeResult checkRecipeResult;

@Inject(method = "startRecipeProcessing", at = { @At(value = "RETURN") })
@Inject(method = "startRecipeProcessing", at = { @At(value = "RETURN") },require=1)
public void a(CallbackInfo c) {
for (IDualInputHatch hatch : (mDualInputHatches)) {
if (hatch == null || !((MetaTileEntity) hatch).isValid())
Expand All @@ -48,7 +48,7 @@ public void a(CallbackInfo c) {
}
}

@Inject(method = "endRecipeProcessing", at = { @At(value = "RETURN") })
@Inject(method = "endRecipeProcessing", at = { @At(value = "RETURN") },require=1)
public void b(CallbackInfo c) {
Consumer<CheckRecipeResult> setResultIfFailure = result -> {
if (!result.wasSuccessful()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ public Item getTabIconItem() {
@Override
public void displayAllReleventItems(List p_78018_1_) {
p_78018_1_.addAll(Registration.items_eucrafting);
for(int i=0;i<=30;i++)
p_78018_1_.add(new ItemStack(MyMod.eu_source_part,1,i));

//for(int i=0;i<=30;i++)
// p_78018_1_.add(new ItemStack(MyMod.eu_source_part,1,i));
p_78018_1_.add(new ItemStack(MyMod.eu_source_part,1,0));
p_78018_1_.add(new ItemStack(MyMod.block_euinterface));
// p_78018_1_.add(new ItemStack(MyMod.cover, 1, 2));

p_78018_1_.add(new ItemStack(MyMod.euinterface_p2p));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 3));

p_78018_1_.add(new ItemStack(MyMod.cover, 1, 32));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 33));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 34));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 35));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 36));
//p_78018_1_.add(new ItemStack(MyMod.cover, 1, 34));
//p_78018_1_.add(new ItemStack(MyMod.cover, 1, 35));
//p_78018_1_.add(new ItemStack(MyMod.cover, 1, 36));
p_78018_1_.add(new ItemStack(MyMod.cover, 1, 37));

super.displayAllReleventItems(p_78018_1_);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/proghatches/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,4 @@ proghatches.submitter.state.1=§cFailed
proghatches.submitter.state.2=§aSubmitted
hatch.input.dual.oc=Programmable Dual Input Hub(ME)
tile.proghatches.card_reader.name=Sensor Card Reader
proghatch.eucrafting.warn=§cExperimental item! Disabled by default, turn on Mixin in config to make it work.
1 change: 1 addition & 0 deletions src/main/resources/assets/proghatches/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,4 @@ proghatches.submitter.state.1=§c失败
proghatches.submitter.state.2=§a已提交
hatch.input.dual.oc=可编程二合一输入枢纽(ME)
tile.proghatches.card_reader.name=传感器卡片读卡器
proghatch.eucrafting.warn=§c实验性物品 默认禁用 需要在配置中打开Mixin才能工作

0 comments on commit aa5f400

Please sign in to comment.