Skip to content

Commit

Permalink
update & bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMVoid95 committed Nov 21, 2020
1 parent 8f0c5b2 commit b752bb4
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 53 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ dependencies {

// LOAD GC ADDONS
compile "com.mjr.planetprogression:PlanetProgression:1.12.2-0.4.5:api"
compile "curse.maven:AsmodeusCore-Dev:3063158"
compile "curse.maven:AsmodeusCore-Dev:3117821"
compile "curse.maven:GSMod-0.0.14:3015062"
compile "curse.maven:ExtraPlanets-1.7.0:3031689"
runtime "curse.maven:MJRLib-1.2.0:3029769"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ mcp=snapshot_20171003

## Mod Versioning
versionMajor=1
versionMinor=4
versionRev=1
versionMinor=5
versionRev=0

## Cureforge Upload Configs
cf_project_id=359766
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package net.romvoid95.gctweaks.base.core;

import java.lang.reflect.Field;

import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider;
import micdoodle8.mods.galacticraft.core.client.gui.overlay.OverlayOxygenWarning;
import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient;
import micdoodle8.mods.galacticraft.core.tick.TickHandlerClient;
import micdoodle8.mods.galacticraft.core.util.PlayerUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;

public class TickHandlerClientOverride {

@SubscribeEvent
public void onRenderTick(RenderTickEvent event) {
long tickCount = 0;
try {
Field tick = TickHandlerClient.class.getDeclaredField("tickCount");
tick.setAccessible(true);
tickCount = tick.getLong(null);
} catch (Exception e) {

}
final Minecraft minecraft = FMLClientHandler.instance().getClient();
final EntityPlayerSP player = minecraft.player;
final EntityPlayerSP playerBaseClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);

if (player == null || playerBaseClient == null) {
return;
}

GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerBaseClient);

if (event.phase == Phase.END) {
if (playerBaseClient != null && player.world.provider instanceof IGalacticraftWorldProvider
&& !stats.isOxygenSetupValid()) {
if (minecraft.currentScreen == null && !minecraft.gameSettings.hideGUI
&& !(playerBaseClient.isCreative() || playerBaseClient.isSpectator())) {
OverlayOxygenWarning.renderOxygenWarningOverlay(minecraft, tickCount);
}
}
}
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package net.romvoid95.gctweaks.base.core.proxy;

import net.minecraftforge.fml.common.event.*;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.romvoid95.gctweaks.ModuleController;
import net.romvoid95.gctweaks.base.Module;
import net.romvoid95.gctweaks.base.core.TickHandlerClientOverride;
import net.romvoid95.gctweaks.internal.config.ConfigCore;
//import net.romvoid95.gctweaks.base.version.VersionChecker;
import net.romvoid95.gctweaks.internal.versioning.VersionChecker;

public class ClientProxy extends CommonProxy {

@Override
public void preInit(FMLPreInitializationEvent event) {
ModuleController.modules.forEach(Module::proxyPreInit);
MinecraftForge.EVENT_BUS.register(new TickHandlerClientOverride());
super.preInit(event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
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.oxytoggle.OxygenToggle;
import net.romvoid95.gctweaks.gc.features.schematic.UnlockSchematics;
import net.romvoid95.gctweaks.gc.features.spacerace.SpaceRaceFeature;
import net.romvoid95.gctweaks.gc.features.spawnitems.SpawnWithOxygenEquip;
Expand All @@ -31,7 +31,7 @@ public void addFeatures() {
registerFeature(new DimensionalComets());
registerFeature(new UnlockSchematics());
registerFeature(new SpawnDimension());
registerFeature(new OxygenPlanets());
registerFeature(new OxygenToggle());

}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package net.romvoid95.gctweaks.gc.features.oxytoggle;

import micdoodle8.mods.galacticraft.api.event.oxygen.GCCoreOxygenSuffocationEvent;
import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider;
import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
import micdoodle8.mods.galacticraft.core.util.DamageSourceGC;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.romvoid95.gctweaks.base.Feature;
import net.romvoid95.gctweaks.base.core.TickHandlerClientOverride;

public class OxygenToggle extends Feature {

private static boolean oxygenToggle;
private int[] setDimsBreatheable;
private int[] setDimsNonBreatheable;
private TickHandlerClientOverride clientHandler;

@Override
public String comment() {
return "Define which planets will be breatheable or not";
}

@Override
public String category() {
return "oxygenToggle";
}

@Override
public void syncConfig(String category) {
oxygenToggle = set(category, "enableFeature", false);
setDimsBreatheable = set(category, "breathableDims",
"Data consisting of which Dimensions Players can breahte in", new int[] { -29, -31 });
setDimsNonBreatheable = set(category, "nonBreathableDims",
"Data consisting of which Dimensions Players can NOT breahte in", new int[] { -1030 });
}

@Override
public boolean usesEvents() {
return true;
}

@SubscribeEvent
public void GCCoreOxygenSuffocationEvent(GCCoreOxygenSuffocationEvent.Pre event) {
if (oxygenToggle) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();

for (int dimId : setDimsBreatheable) {
if (setDimsBreatheable.length == 0) {
return;
}
if (player.world.provider.getDimensionType().getId() == dimId) {
event.setCanceled(true);
}
}
}
}

@SubscribeEvent
public void entityLivingEvent(LivingEvent.LivingUpdateEvent event) {
if (oxygenToggle) {
if (setDimsNonBreatheable.length == 0) {
return;
}
final EntityLivingBase entityLiving = event.getEntityLiving();
if (entityLiving instanceof EntityPlayer && entityLiving.ticksExisted % ConfigManagerCore.suffocationCooldown == 0) {
IGalacticraftWorldProvider galacticraftWorldProvider = (IGalacticraftWorldProvider) entityLiving.world.provider;
if (galacticraftWorldProvider.hasBreathableAtmosphere()) {
for (int dimId : setDimsNonBreatheable) {
if (entityLiving.world.provider.getDimensionType().getId() == dimId) {
GCCoreOxygenSuffocationEvent suffocationEvent = new GCCoreOxygenSuffocationEvent.Pre(
entityLiving);
MinecraftForge.EVENT_BUS.post(suffocationEvent);

entityLiving.attackEntityFrom(DamageSourceGC.oxygenSuffocation,
Math.max(ConfigManagerCore.suffocationDamage / 2, 1));

GCCoreOxygenSuffocationEvent suffocationEventPost = new GCCoreOxygenSuffocationEvent.Post(
entityLiving);
MinecraftForge.EVENT_BUS.post(suffocationEventPost);
}
}
}
}
}
}
}

0 comments on commit b752bb4

Please sign in to comment.