Skip to content

Commit 209aa84

Browse files
committed
Fix being able to place fluids in compact sky hub
Also disable flowing fluids while we're at it. Fixes #397
1 parent a52ee22 commit 209aa84

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/main/java/org/dave/compactmachines3/skyworld/SkyWorldEvents.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.minecraft.util.text.TextComponentTranslation;
88
import net.minecraft.world.World;
99
import net.minecraft.world.WorldServer;
10+
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
1011
import net.minecraftforge.event.world.BlockEvent;
1112
import net.minecraftforge.event.world.WorldEvent;
1213
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -98,6 +99,40 @@ public static void createSpawnPoint(WorldEvent.CreateSpawnPosition event) {
9899
event.setCanceled(true);
99100
}
100101

102+
@SubscribeEvent
103+
public static void preventUsingItemsInHub(PlayerInteractEvent.RightClickItem event) {
104+
World world = event.getWorld();
105+
if(world.isRemote || !(world instanceof WorldServer)) {
106+
return;
107+
}
108+
109+
WorldServer worldServer = (WorldServer)world;
110+
if(!(worldServer.getChunkProvider().chunkGenerator instanceof SkyChunkGenerator)) {
111+
return;
112+
}
113+
114+
if(ShrinkingDeviceUtils.isShrinkingDevice(event.getItemStack())) {
115+
return;
116+
}
117+
118+
event.setCanceled(true);
119+
}
120+
121+
@SubscribeEvent
122+
public static void preventFlowingFluidsInHub(BlockEvent.FluidPlaceBlockEvent event) {
123+
World world = event.getWorld();
124+
if(world.isRemote || !(world instanceof WorldServer)) {
125+
return;
126+
}
127+
128+
WorldServer worldServer = (WorldServer)world;
129+
if(!(worldServer.getChunkProvider().chunkGenerator instanceof SkyChunkGenerator)) {
130+
return;
131+
}
132+
133+
event.setCanceled(true);
134+
}
135+
101136
@SubscribeEvent
102137
public static void preventPlacingInHub(BlockEvent.PlaceEvent event) {
103138
World world = event.getWorld();

0 commit comments

Comments
 (0)