Skip to content

Commit

Permalink
Add configurable Breatheable Planets
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMVoid95 committed Nov 14, 2020
1 parent 61d62b6 commit 8f0c5b2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
7 changes: 2 additions & 5 deletions CHANGELOG.md
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.romvoid95.gctweaks.gc.features.MobsBreatheInSpace;
import net.romvoid95.gctweaks.gc.features.NoSpaceMusic;
import net.romvoid95.gctweaks.gc.features.SpawnDimension;
import net.romvoid95.gctweaks.gc.features.breathable.OxygenPlanets;
import net.romvoid95.gctweaks.gc.features.galaxy.SeperateAddonPlanets;
import net.romvoid95.gctweaks.gc.features.schematic.UnlockSchematics;
import net.romvoid95.gctweaks.gc.features.spacerace.SpaceRaceFeature;
Expand All @@ -30,6 +31,7 @@ public void addFeatures() {
registerFeature(new DimensionalComets());
registerFeature(new UnlockSchematics());
registerFeature(new SpawnDimension());
registerFeature(new OxygenPlanets());

}
}
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);
}
}
}
}
}

0 comments on commit 8f0c5b2

Please sign in to comment.