-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Phantomface HUD Valid Check Server-Side
Fixes issues with capabilities not being detected for specific blocks. So far the only block found with this issue is ME Storage Exposers from NAE2.
- Loading branch information
1 parent
048c9e7
commit 86c00b9
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...a/com/nomiceu/nomilabs/integration/actuallyadditions/AccessibleTileEntityPhantomface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.nomiceu.nomilabs.integration.actuallyadditions; | ||
|
||
public interface AccessibleTileEntityPhantomface { | ||
|
||
boolean labs$boundValid(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/com/nomiceu/nomilabs/mixin/actuallyadditions/TileEntityPhantomfaceMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.nomiceu.nomilabs.mixin.actuallyadditions; | ||
|
||
import net.minecraft.nbt.NBTTagCompound; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
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.callback.CallbackInfo; | ||
|
||
import com.nomiceu.nomilabs.integration.actuallyadditions.AccessibleTileEntityPhantomface; | ||
|
||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; | ||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomface; | ||
|
||
/** | ||
* Checks whether bound target is valid server-side, so that tile entities with custom capabilities | ||
* (e.g. NAE2's Storage Exposer) shows correctly in HUD. | ||
*/ | ||
@Mixin(value = TileEntityPhantomface.class, remap = false) | ||
public abstract class TileEntityPhantomfaceMixin implements AccessibleTileEntityPhantomface { | ||
|
||
@Shadow | ||
public abstract boolean isBoundThingInRange(); | ||
|
||
@Unique | ||
private boolean labs$boundValid = false; | ||
|
||
@Unique | ||
@Override | ||
public boolean labs$boundValid() { | ||
return labs$boundValid; | ||
} | ||
|
||
@Inject(method = "writeSyncableNBT", at = @At("TAIL")) | ||
private void writeBoundValid(NBTTagCompound compound, TileEntityBase.NBTType type, CallbackInfo ci) { | ||
labs$boundValid = isBoundThingInRange(); | ||
if (type != TileEntityBase.NBTType.SAVE_BLOCK) | ||
compound.setBoolean("labs$boundValid", labs$boundValid); | ||
} | ||
|
||
@Inject(method = "readSyncableNBT", at = @At("TAIL")) | ||
private void readBoundValid(NBTTagCompound compound, TileEntityBase.NBTType type, CallbackInfo ci) { | ||
if (type != TileEntityBase.NBTType.SAVE_BLOCK) | ||
labs$boundValid = compound.getBoolean("labs$boundValid"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters