Skip to content

Commit

Permalink
fix not being able to open guis with galacticraft
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueWeabo committed Jul 29, 2024
1 parent 1533cca commit 013e827
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ dependencies {
shadowImplementation("dev.dominion.ecs:dominion-ecs-engine:0.9.0") // MIT License
api("com.github.GTNewHorizons:waila:1.8.1:dev")
//api("com.github.GTNewHorizons:Angelica:1.0.0-alpha52:dev")
//implementation("com.github.GTNewHorizons:Galacticraft:3.2.0-GTNH:dev")
}

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ usesShadowedDependencies = true
minimizeShadowedDependencies = false

# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
relocateShadowedDependencies = false

# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gtnewhorizons/mutecore/MuTECore.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import dev.dominion.ecs.api.Entity;
import dev.dominion.ecs.api.Results;
import dev.dominion.ecs.engine.IntEntity;
import micdoodle8.mods.galacticraft.core.event.EventHandlerGC;

@Mod(
modid = MuTECore.MODID,
Expand Down Expand Up @@ -69,7 +70,7 @@ public void preInit(FMLPreInitializationEvent event) {
public void init(FMLInitializationEvent initEvent) {
proxy.init(initEvent);
EventRegistry.registerPlayerInteractionEvent(
new PlayerInteractionEvent(0, (p, e) -> {LOG.debug("gui event comp"); return PlayerHelper.isRealPlayer(p) ? new GUIEvent(p) : null;}));
new PlayerInteractionEvent(0, (p, e) -> PlayerHelper.isRealPlayer(p) ? new GUIEvent(p) : null));
SystemRegistrator.registerSystem(() -> {
Results<Results.With1<GUIEvent>> results = MuTECore.ENGINE.findEntitiesWith(GUIEvent.class);
for (Results.With1<GUIEvent> result : results) {
Expand All @@ -83,7 +84,6 @@ public void init(FMLInitializationEvent initEvent) {
validator.save(nbt);
}
}
LOG.debug("opening gui");
MultiTileEntityGuiFactory.open(event.getPlayer(), coords.getX(), coords.getY(), coords.getZ(), nbt);
entity.removeType(GUIEvent.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX,
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX,
float subY, float subZ) {
TileEntity te = worldIn.getTileEntity(x, y, z);
if (!(te instanceof MultiTileEntity mute)) return false;
if (player instanceof EntityPlayerMP playermp) {
MuTEPacket packet = new MuTEPacket();
NBTTagCompound nbt = new NBTTagCompound();
te.writeToNBT(nbt);
packet.setComponentData(nbt);
MuTENetwork.sendToPlayer(packet, playermp);
}
if (!(te instanceof MultiTileEntity mute)) return false;
Object eventComponent = null;
for (PlayerInteractionEvent preEvent : EventRegistry.PLAYER_INTERACTION_EVENTS) {
eventComponent = preEvent.generate(player, mute.getEntity());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public class PlayerHelper {
* {@link net.minecraftforge.common.util.FakePlayer}
*/
public static boolean isRealPlayer(@Nonnull EntityPlayer player) {
return player.getClass() == EntityPlayerSP.class || player.getClass() == EntityPlayerMP.class;
return player instanceof EntityPlayerSP || player instanceof EntityPlayerMP;
}
}

0 comments on commit 013e827

Please sign in to comment.