-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configurable Breatheable Planets
- Loading branch information
Showing
3 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,2 @@ | ||
## Delete Current Config For This Mod Before Running This Update | ||
|
||
[Fixed] | ||
|
||
- Fixed Custom Spawn Dimension player events firing even when disabled | ||
**[Added]** | ||
- Configurable Dimensions players can breathe in without oxygen gear |
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
45 changes: 45 additions & 0 deletions
45
src/main/java/net/romvoid95/gctweaks/gc/features/breathable/OxygenPlanets.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,45 @@ | ||
package net.romvoid95.gctweaks.gc.features.breathable; | ||
|
||
import micdoodle8.mods.galacticraft.api.event.oxygen.GCCoreOxygenSuffocationEvent; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.romvoid95.gctweaks.base.Feature; | ||
|
||
public class OxygenPlanets extends Feature { | ||
|
||
private static boolean breatheablePlanets; | ||
private int[] dimIds; | ||
|
||
@Override | ||
public String comment() { | ||
return "Define dimensions Players will be able to breathe in"; | ||
} | ||
|
||
@Override | ||
public String category() { | ||
return "breatheOnPlanets"; | ||
} | ||
|
||
@Override | ||
public void syncConfig(String category) { | ||
breatheablePlanets = set(category, "enableFeature", false); | ||
dimIds = set(category, "dimIds", "Data consisting of which Dimensions Players can breahte in",new int[] {-29, -31}); | ||
} | ||
|
||
@Override | ||
public boolean usesEvents() { | ||
return true; | ||
} | ||
|
||
@SubscribeEvent | ||
public void GCCoreOxygenSuffocationEvent(GCCoreOxygenSuffocationEvent.Pre event) { | ||
if (breatheablePlanets) { | ||
EntityPlayer player = (EntityPlayer) event.getEntityLiving(); | ||
for(int dimId : dimIds) { | ||
if(player.world.provider.getDimensionType().getId() == dimId) { | ||
event.setCanceled(true); | ||
} | ||
} | ||
} | ||
} | ||
} |