diff --git a/build.gradle b/build.gradle index 99af958..465be69 100644 --- a/build.gradle +++ b/build.gradle @@ -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.18p27' +String versionOverride = '0.0.18p28' 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) { diff --git a/dependencies.gradle b/dependencies.gradle index 95e606f..87bb21a 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -82,4 +82,6 @@ api("com.github.GTNewHorizons:NotEnoughEnergistics:1.5.1:dev") api("com.github.GTNewHorizons:ProjectRed:4.9.3-GTNH:dev") api("com.github.GTNewHorizons:MrTJPCore:1.1.6:dev") + api('com.github.GTNewHorizons:Navigator:1.0.12:dev') + runtimeOnlyNonPublishable(rfg.deobf('maven.modrinth:journeymap:5.2.6')) } diff --git a/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java b/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java index bf64700..a8135c6 100644 --- a/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java +++ b/src/main/java/reobf/proghatches/ae/PartAmountMaintainer.java @@ -551,7 +551,7 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) { .setPos(3+4, 3+18)); - builder.widget(new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_REDSTONE_ON).setPos(3+4+20, 3+18).setSize(18,18).setEnabled(s->{on=isOn();return on;}) + builder.widget(new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_REDSTONE_ON).setPos(3+4+20, 3+18).setSize(18,18).setEnabled(s->{return on;}) .addTooltip(StatCollector.translateToLocalFormatted("proghatches.amountmaintainer.redstone.state.on",amount)) ) ; @@ -559,7 +559,9 @@ protected void phantomClick(ClickData clickData, ItemStack cursorStack) { .addTooltip(StatCollector.translateToLocalFormatted("proghatches.amountmaintainer.redstone.state.off")) ) ; - builder.widget(new FakeSyncWidget.BooleanSyncer(()->on, s->on=s)); + builder.widget(new FakeSyncWidget.BooleanSyncer(()->{on=isOn(); return on;}, s->on=s) + .setSynced(true, false) + ); ItemStackHandler iss0=new ItemStackHandler(upgrade){ @@ -728,6 +730,9 @@ public IMEInventory getInv(StorageChannel ch){ this.inv.put(ch,inv); handlerHash.put(ch, newHandlerHash); return inv; + }else{ + + handlerHash.put(ch, 0); } return null; diff --git a/src/main/java/reobf/proghatches/ae/TileCyclicPatternSubmitter.java b/src/main/java/reobf/proghatches/ae/TileCyclicPatternSubmitter.java index cf573e6..34bdb84 100644 --- a/src/main/java/reobf/proghatches/ae/TileCyclicPatternSubmitter.java +++ b/src/main/java/reobf/proghatches/ae/TileCyclicPatternSubmitter.java @@ -80,10 +80,7 @@ import reobf.proghatches.util.ProghatchesUtil; -/** - * @author zyf - * - */ + public class TileCyclicPatternSubmitter extends TileEntity implements IGridProxyable, ICraftingRequester, ITileWithModularUI{ public static final int ALL = 0; public static final int DIM = 1; @@ -287,6 +284,7 @@ public void updateEntity() { last=null; index=(index+1); index=index%SLOT_SIZE; + updateComparator(); }else{ cpu = getCpu(last);} } @@ -339,6 +337,10 @@ public void updateEntity() { +} +private void updateComparator() { + this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + } Field task; { @@ -486,7 +488,7 @@ public void jobStateChange(ICraftingLink link) { -int index; + int index=0; protected class UIFactory { @@ -546,7 +548,7 @@ public boolean isItemValid(int slot, ItemStack stack) { }; Scrollable sc = new Scrollable().setVerticalScroll(); - builder.widget(new FakeSyncWidget.IntegerSyncer(() -> index, s -> index = s)); + builder.widget(new FakeSyncWidget.IntegerSyncer(() -> index, s ->{ index = s;updateComparator();})); builder.widget(new FakeSyncWidget.BooleanSyncer(() -> on, s -> on = s)); //builder.widget(new FakeSyncWidget.IntegerSyncer(() -> tankselected, s -> tankselected = s)); final IDrawable[] background = new IDrawable[] { GUITextureSet.DEFAULT.getItemSlot(), GT_UITextures.OVERLAY_SLOT_PATTERN_ME}; diff --git a/src/main/java/reobf/proghatches/block/BlockAnchorAlert.java b/src/main/java/reobf/proghatches/block/BlockAnchorAlert.java index 01526ec..e844e29 100644 --- a/src/main/java/reobf/proghatches/block/BlockAnchorAlert.java +++ b/src/main/java/reobf/proghatches/block/BlockAnchorAlert.java @@ -1,18 +1,27 @@ package reobf.proghatches.block; + + +import appeng.me.GridAccessException; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import journeymap.client.JourneymapClient; +import journeymap.client.model.Waypoint; +import journeymap.client.waypoint.WaypointStore; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IIcon; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +import reobf.proghatches.main.MyMod; +import reobf.proghatches.net.WayPointMessage; public class BlockAnchorAlert extends BlockContainer{ @@ -37,9 +46,33 @@ public void onBlockPlacedBy(World worldIn, int x, int y, int z, EntityLivingBase }@Override public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) { - if(worldIn.isRemote)return true; + if(worldIn.isRemote){ + /*journeymap.client.model.Waypoint deathpoint = journeymap.client.model.Waypoint + .at(x, y, z, Waypoint.Type.Normal,worldIn.provider.dimensionId); + WaypointStore.instance().save(deathpoint); + */ + + return true;} + + + + TileAnchorAlert a=((TileAnchorAlert)worldIn.getTileEntity(x, y, z)); + if(player.isSneaking()){ + try { + MyMod.net.sendTo(new WayPointMessage(((ChunkTrackingGridCahce) + (a).getProxy().getGrid().getCache(IChunkTrackingGridCahce.class) + ).improperlyUnloaded), (EntityPlayerMP) player); + } catch (GridAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + a.printUnloaded(player); + + return true;} + + if(player.getUniqueID().equals(a.owner)==false){ player.addChatComponentMessage(new ChatComponentTranslation("proghatch.chunk_loading_alert.owner")); return false;} diff --git a/src/main/java/reobf/proghatches/block/ChunkTrackingGridCahce.java b/src/main/java/reobf/proghatches/block/ChunkTrackingGridCahce.java index b525e1f..f0328bf 100644 --- a/src/main/java/reobf/proghatches/block/ChunkTrackingGridCahce.java +++ b/src/main/java/reobf/proghatches/block/ChunkTrackingGridCahce.java @@ -1,5 +1,10 @@ package reobf.proghatches.block; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -9,19 +14,28 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArraySet; +import org.apache.commons.io.output.ByteArrayOutputStream; + import appeng.api.networking.IGrid; import appeng.api.networking.IGridBlock; +import appeng.api.networking.IGridCache; import appeng.api.networking.IGridHost; import appeng.api.networking.IGridNode; import appeng.api.networking.IGridStorage; +import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.util.DimensionalCoord; +import appeng.me.Grid; +import it.unimi.dsi.fastutil.ints.IntArrayList; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.DimensionManager; import reobf.proghatches.main.MyMod; import reobf.proghatches.main.MyMod.Prop; @@ -29,6 +43,7 @@ public class ChunkTrackingGridCahce implements IChunkTrackingGridCahce{ public ChunkTrackingGridCahce(final IGrid g) { this.myGrid = g; callbacks.put(this, null); + } private final IGrid myGrid; @@ -36,9 +51,10 @@ public ChunkTrackingGridCahce(final IGrid g) { - static class ChunkInfo implements Cloneable{ - - public String toString() { + public static class ChunkInfo implements Cloneable,Serializable{ + + private static final long serialVersionUID = 12312312; + public String toString() { return chunkx+" "+ chunky+" "+dim; @@ -48,8 +64,13 @@ public String toString() { this.chunky=worldy>>4; this.dim=w.provider.dimensionId; } - final int chunkx,chunky; - final int dim; + public ChunkInfo(int worldx,int worldy,int w){ + this.chunkx=worldx; + this.chunky=worldy; + this.dim=w; + } + public final int chunkx,chunky; + public final int dim; @Override public boolean equals(Object obj) { if(obj==null)return false; @@ -114,26 +135,45 @@ public void addNode(IGridNode gridNode, IGridHost machine) { if(w==null){ return;//? } - - track.merge(new ChunkInfo(loc.x, loc.z,w), 1, (a,b)->a+b); + ChunkInfo ci=new ChunkInfo(loc.x, loc.z,w); + /*if(improperlyUnloaded.remove(ci)){ + //System.out.println(123); + }*/ + track.merge(ci, 1, (a,b)->a+b); } } + @Override public void onSplit(IGridStorage destinationStorage) { - - + populateGridStorage( destinationStorage); } + @SuppressWarnings("unchecked") @Override public void onJoin(IGridStorage sourceStorage) { + NBTTagCompound tag = sourceStorage.dataObject(); + //improperlyUnloaded.clear(); + if(tag.getTag("improperlyUnloaded") instanceof NBTTagIntArray==false){return;} + int[] x=tag.getIntArray("improperlyUnloaded"); + for(int i=0;i{ + arr.add(s.chunkx); + arr.add(s.chunky); + arr.add(s.dim); + }); + + tag.setIntArray("improperlyUnloaded", arr.toIntArray()); } @@ -319,10 +359,11 @@ public void warn(ChunkInfo info,int i){ } - + public HashSet improperlyUnloaded=new HashSet(); public void unload(Chunk o) {ChunkInfo info; Integer tck = track.get(info=new ChunkInfo(o.xPosition<<4, o.zPosition<<4, o.worldObj)); - if(tck!=null){ + if(tck!=null&&tck>0){ + improperlyUnloaded.add(info); warnAlt(info,tck); } } @@ -334,6 +375,21 @@ public void unload(World o) { } }); } + + public void load(Chunk chunk) { + ChunkInfo ci=new ChunkInfo(chunk.xPosition<<4, chunk.zPosition<<4,chunk.worldObj); + if(improperlyUnloaded.remove(ci)){ + //System.out.println(123); + + }; + } + + public static void merge(ChunkTrackingGridCahce cache, ChunkTrackingGridCahce cache2) { + if(cache.improperlyUnloaded.isEmpty()) + cache.improperlyUnloaded.addAll(cache2.improperlyUnloaded); + else if(cache2.improperlyUnloaded.isEmpty()) + cache2.improperlyUnloaded.addAll(cache.improperlyUnloaded); + } diff --git a/src/main/java/reobf/proghatches/block/TileAnchorAlert.java b/src/main/java/reobf/proghatches/block/TileAnchorAlert.java index a117391..4bd56c0 100644 --- a/src/main/java/reobf/proghatches/block/TileAnchorAlert.java +++ b/src/main/java/reobf/proghatches/block/TileAnchorAlert.java @@ -21,9 +21,15 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.util.ForgeDirection; +import reobf.proghatches.block.ChunkTrackingGridCahce.ChunkInfo; import reobf.proghatches.main.MyMod; import reobf.proghatches.util.ProghatchesUtil; @@ -83,13 +89,19 @@ public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCom }catch(Exception e){} - tag.setInteger("loaded", - - ((TileAnchorAlert)te).getLoadedChunks() - - - - ); + try { + tag.setInteger("loaded", + + ((ChunkTrackingGridCahce) + ((TileAnchorAlert)te).getProxy().getGrid().getCache(IChunkTrackingGridCahce.class) + ).improperlyUnloaded.size() + + + + ); + } catch (GridAccessException e) { + + } return tag; }}; @@ -207,8 +219,9 @@ public int getLoadedChunks(){ .stream().filter(s->{ - return this.worldObj.getChunkProvider().chunkExists(s.chunkx,s.chunky); - + WorldServer wd = DimensionManager.getWorld(s.dim); + if(wd==null)return false; + return wd.getChunkProvider().chunkExists(s.chunkx,s.chunky); }).count(); ; @@ -223,6 +236,39 @@ public int getLoadedChunks(){ return loadedChunksCache; } +public void printUnloaded(EntityPlayer player) { + try { + boolean any[]=new boolean[1]; + ((ChunkTrackingGridCahce) + ((TileAnchorAlert)this).getProxy().getGrid().getCache(IChunkTrackingGridCahce.class) + ).improperlyUnloaded.forEach((s)->{ + + /*WorldServer wd = DimensionManager.getWorld(s.dim); + if(wd==null|| + false==wd.getChunkProvider().chunkExists(s.chunkx,s.chunky)){ + */ any[0]=true; + ChunkInfo info = s; + player.addChatComponentMessage(new ChatComponentTranslation("proghatch.chunk_loading_alert.info", + "X:"+info.chunkx+",Z:"+info.chunky+",dim:"+info.dim+" "+ + "Center:"+((info.chunkx<<4)+8)+","+((info.chunky<<4)+8) + + )); + /*}; + */ + });; + + + if(any[0]==false){ + player.addChatComponentMessage(new ChatComponentTranslation("proghatch.chunk_loading_alert.info.none")); + + + } + } catch (GridAccessException e) { + e.printStackTrace(); + } + +} + } diff --git a/src/main/java/reobf/proghatches/main/MyMod.java b/src/main/java/reobf/proghatches/main/MyMod.java index c7be858..4c125fd 100644 --- a/src/main/java/reobf/proghatches/main/MyMod.java +++ b/src/main/java/reobf/proghatches/main/MyMod.java @@ -110,6 +110,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.net.GT_Packet_SendCoverData; import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; @@ -144,6 +145,7 @@ import reobf.proghatches.net.PriorityMessage; import reobf.proghatches.net.RenameMessage; import reobf.proghatches.net.UpgradesMessage; +import reobf.proghatches.net.WayPointMessage; import reobf.proghatches.oc.ItemAPICard; import reobf.proghatches.oc.ItemGTRedstoneCard; import reobf.proghatches.oc.WirelessPeripheralManager; @@ -160,7 +162,7 @@ public class MyMod { public static final Logger LOG = LogManager.getLogger(Tags.MODID); public static MyMod instance; { - //CraftingCPUCluster.class.getDeclaredFields(); + //GT_MetaTileEntity_MultiBlockBase.class.getDeclaredFields(); instance = this; } @@ -241,7 +243,7 @@ public void preInit(FMLPreInitializationEvent event) { net.registerMessage(new RenameMessage.Handler(), RenameMessage.class, 2, Side.SERVER); net.registerMessage(new UpgradesMessage.Handler(), UpgradesMessage.class, 3, Side.CLIENT); net.registerMessage(new MasterSetMessage.Handler(), MasterSetMessage.class, 4, Side.CLIENT); - + net.registerMessage(new WayPointMessage.Handler(), WayPointMessage.class, 5, Side.CLIENT); proxy.preInit(event); } @@ -536,7 +538,21 @@ public void onUnload(WorldEvent.Unload event) { } } - + @SubscribeEvent + public void onLoad(ChunkEvent.Load event) { + if (event.world.isRemote) + return; + + try { + ChunkTrackingGridCahce.callbacks.forEach((a, b) -> { + if (a != null) { + a.load(event.getChunk()); + } + }); + } catch (Throwable t) { + t.printStackTrace(); + } + } @SubscribeEvent public void onUnload(ChunkEvent.Unload event) { if (event.world.isRemote) diff --git a/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java b/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java index 0efff1c..9a4abf7 100644 --- a/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java +++ b/src/main/java/reobf/proghatches/main/mixin/MixinPlugin.java @@ -192,6 +192,7 @@ public List getMixins() { retLate.add("part2.MixinOC"); retLate.add("part2.MixinRecursiveSlotClickProtection"); retLate.add("part2.MixinMultiPattern"); + retLate.add("part2.MixinSplitDetect"); if (FMLLaunchHandler.side().isClient()) { if (!"true".equals(pp.get("noAEItemSortMixins"))) if(ff)retLate.add("MixinAEItemStackCompare"); diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAwarenessForDualHatch.java b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAwarenessForDualHatch.java index 5841e59..e900acb 100644 --- a/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAwarenessForDualHatch.java +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/MixinAwarenessForDualHatch.java @@ -2,6 +2,10 @@ import static gregtech.api.util.GT_Utility.filterValidMTEs; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.invoke.MethodType; import java.util.ArrayList; import java.util.Arrays; import java.util.Objects; @@ -11,7 +15,9 @@ import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; @@ -30,16 +36,70 @@ import reobf.proghatches.gt.metatileentity.util.IRecipeProcessingAwareDualHatch; @SuppressWarnings("unused") -@Mixin(value = GT_MetaTileEntity_MultiBlockBase.class, remap = false) +@Pseudo +@Mixin( + + value = GT_MetaTileEntity_MultiBlockBase.class, + targets={ + + "com.Nxer.TwistSpaceTechnology.common.modularizedMachine.ModularizedMachineLogic.MultiExecutionCoreMachineBase" + } + , + remap = false) public abstract class MixinAwarenessForDualHatch { - @Shadow - public ArrayList mDualInputHatches = new ArrayList<>(); - @Shadow - public CheckRecipeResult checkRecipeResult; - - @Inject(method = "startRecipeProcessing", at = { @At(value = "RETURN") },require=1) + + + //@Shadow + //public ArrayList mDualInputHatches = new ArrayList<>(); + //@Shadow + //public CheckRecipeResult checkRecipeResult; + //@Shadow + //public abstract void setResultIfFailure(CheckRecipeResult result) ; + + @Unique + private static MethodHandle MH_mDualInputHatches; + @Unique + private static MethodHandle MH_setResultIfFailure; + static{ + + try { + MH_mDualInputHatches=MethodHandles.lookup().findGetter( + GT_MetaTileEntity_MultiBlockBase.class, + "mDualInputHatches", ArrayList.class); + MH_setResultIfFailure=MethodHandles.lookup().findVirtual(GT_MetaTileEntity_MultiBlockBase.class, + "setResultIfFailure", MethodType.methodType(void.class,CheckRecipeResult.class)); + + + } catch (Exception e) { + e.printStackTrace(); + throw new AssertionError(e); + } + + + }@Unique + public void setResultIfFailure0(CheckRecipeResult endRecipeProcessing) { + try { + MH_setResultIfFailure.invoke((GT_MetaTileEntity_MultiBlockBase)(Object)this,endRecipeProcessing); + } catch (Throwable e) { + e.printStackTrace(); + throw new AssertionError(e); + } + + }@Unique + public ArrayList mDualInputHatches0(){ + try { + return (ArrayList) MH_mDualInputHatches.invoke((GT_MetaTileEntity_MultiBlockBase)(Object)this); + } catch (Throwable e) { + e.printStackTrace(); + throw new AssertionError(e); + } + } + + @Inject(method = "startRecipeProcessing", at = { @At(value = "RETURN") }/*,require=1*/) public void a(CallbackInfo c) { - for (IDualInputHatch hatch : (mDualInputHatches)) { + + + for (IDualInputHatch hatch : (mDualInputHatches0())) { if (hatch == null || !((MetaTileEntity) hatch).isValid()) continue; if (hatch instanceof IRecipeProcessingAwareDualHatch) { @@ -48,22 +108,24 @@ public void a(CallbackInfo c) { } } - @Inject(method = "endRecipeProcessing", at = { @At(value = "RETURN") },require=1) + @Inject(method = "endRecipeProcessing", at = { @At(value = "RETURN") }/*,require=1*/) public void b(CallbackInfo c) { - Consumer setResultIfFailure = result -> { + /*Consumer setResultIfFailure = result -> { if (!result.wasSuccessful()) { this.checkRecipeResult = result; } - }; + };*/ - for (IDualInputHatch hatch : (mDualInputHatches)) { + for (IDualInputHatch hatch : (mDualInputHatches0())) { if (hatch == null || !((MetaTileEntity) hatch).isValid()) continue; if (hatch instanceof IRecipeProcessingAwareDualHatch) { - setResultIfFailure.accept(((IRecipeProcessingAwareDualHatch) hatch) + setResultIfFailure0(((IRecipeProcessingAwareDualHatch) hatch) .endRecipeProcessing((GT_MetaTileEntity_MultiBlockBase) (Object) this)); } } } + + } diff --git a/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinSplitDetect.java b/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinSplitDetect.java new file mode 100644 index 0000000..9ab6ebb --- /dev/null +++ b/src/main/java/reobf/proghatches/main/mixin/mixins/part2/MixinSplitDetect.java @@ -0,0 +1,41 @@ +package reobf.proghatches.main.mixin.mixins.part2; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import appeng.me.GridConnection; +import appeng.me.GridNode; +import net.minecraftforge.common.util.ForgeDirection; +import reobf.proghatches.block.ChunkTrackingGridCahce; +import reobf.proghatches.block.IChunkTrackingGridCahce; +/** + * AE GridCache opSplit is not working as expected(?) + * so check it manually + * */ +@Mixin(value=GridConnection.class,remap=false) +public class MixinSplitDetect { + @Shadow + private GridNode sideA; + @Shadow + private GridNode sideB; + @Inject(method="destroy",at = { @At("RETURN") })public void a(CallbackInfo a) + { + + if(sideA.getGrid()!=sideB.getGrid()){ + ChunkTrackingGridCahce.merge ( + (ChunkTrackingGridCahce)sideA.getGrid().getCache(IChunkTrackingGridCahce.class), + (ChunkTrackingGridCahce)sideB.getGrid().getCache(IChunkTrackingGridCahce.class)); + + + }else{ + //System.out.println(sideA.getGrid()); + + } + + + } + +} diff --git a/src/main/java/reobf/proghatches/net/WayPointMessage.java b/src/main/java/reobf/proghatches/net/WayPointMessage.java new file mode 100644 index 0000000..cee5a9b --- /dev/null +++ b/src/main/java/reobf/proghatches/net/WayPointMessage.java @@ -0,0 +1,72 @@ +package reobf.proghatches.net; + +import java.util.HashSet; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import journeymap.client.model.Waypoint; +import journeymap.client.waypoint.WaypointStore; +import net.minecraft.util.StatCollector; +import reobf.proghatches.block.ChunkTrackingGridCahce.ChunkInfo; + +public class WayPointMessage implements IMessage{ + public WayPointMessage(){} + public WayPointMessage(HashSet improperlyUnloaded) { + this.improperlyUnloaded=improperlyUnloaded; + } + + HashSet improperlyUnloaded; + public static class Handler implements IMessageHandler { + + @Override + public WayPointMessage onMessage(WayPointMessage message, MessageContext ctx) { + + message.improperlyUnloaded.forEach(s->{ + journeymap.client.model.Waypoint deathpoint = journeymap.client.model.Waypoint + .at((s.chunkx<<4)+8, 0, (s.chunky<<4)+8, Waypoint.Type.Normal,s.dim) + ; + deathpoint.setName( + StatCollector.translateToLocal("proghatch.waypoint.info")); + WaypointStore.instance().save(deathpoint); + + + } + ); + + + return null; + } +} + @Override + public void fromBytes(ByteBuf buf) { + + int size=buf.readInt(); + improperlyUnloaded=new HashSet<>(); + for(int i=0;i + { + buf.writeByte(s.chunkx); + buf.writeByte(s.chunky); + buf.writeByte(s.dim); + } + ); + + + } +} diff --git a/src/main/resources/assets/proghatches/lang/en_US.lang b/src/main/resources/assets/proghatches/lang/en_US.lang index c65943b..bbdd3c2 100644 --- a/src/main/resources/assets/proghatches/lang/en_US.lang +++ b/src/main/resources/assets/proghatches/lang/en_US.lang @@ -480,7 +480,7 @@ anchoralert.dim.true=Block dimensional alert message from Alerting Anchor. anchoralert.dim.false=Allow dimensional alert message from Alerting Anchor. anchoralert.global.true=Block global alert message from Alerting Anchor. anchoralert.global.false=Allow global alert message from Alerting Anchor. -proghatch.chunk_loading_alert.count=Loaded/All Chunks of ME network: %s/%s +proghatch.chunk_loading_alert.count=All Chunks of ME network: %2$s Improperly unloaded Chunks: %1$s proghatches.largepcp.remove_circuit=Remove unused Programming Circuits in ME storage. proghatches.eucreafting.duty.all=Duty: All proghatches.eucreafting.duty.io=Duty: Only Item/Fluid Output @@ -558,3 +558,6 @@ tile.reactor_syncer.info.max=Set to 15 tile.reactor_syncer.info.min=Set to 0 hatch.dualinput.slave.item.name=Item Input Slave hatch.dualinput.slave.fluid.name=Fluid Input Slave +proghatch.chunk_loading_alert.info=Alerting Anchor: Chunk [%s] is not properly unloaded. +proghatch.chunk_loading_alert.info.none=Alerting Anchor: No improperly-unloaded chunks. +proghatch.waypoint.info=Alerting Anchor Mark diff --git a/src/main/resources/assets/proghatches/lang/zh_CN.lang b/src/main/resources/assets/proghatches/lang/zh_CN.lang index 9416b6f..a922630 100644 --- a/src/main/resources/assets/proghatches/lang/zh_CN.lang +++ b/src/main/resources/assets/proghatches/lang/zh_CN.lang @@ -479,7 +479,7 @@ anchoralert.dim.true=屏蔽警告锚的同维度警告 anchoralert.dim.false=允许警告锚的同维度警告 anchoralert.global.true=屏蔽警告锚的全服警告 anchoralert.global.false=允许警告锚的全服警告 -proghatch.chunk_loading_alert.count=ME网络已加载/所有区块:%s/%s +proghatch.chunk_loading_alert.count=ME所有区块:%2$s 非正确卸载区块:%1$s proghatches.largepcp.remove_circuit=移除网络中未使用的编程器电路 proghatches.eucreafting.duty.all=功能: 所有 proghatches.eucreafting.duty.io=功能: 仅物品/流体输出 @@ -556,3 +556,6 @@ tile.reactor_syncer.info.max=设为15 tile.reactor_syncer.info.min=设为0 hatch.dualinput.slave.item.name=物品输入镜像 hatch.dualinput.slave.fluid.name=流体输入镜像 +proghatch.chunk_loading_alert.info=警告锚:位于[%s]的区块未被正确卸载 +proghatch.chunk_loading_alert.info.none=警告锚: 没有非正常卸载区块 +proghatch.waypoint.info=警告锚标记