diff --git a/src/main/java/net/romvoid95/gctweaks/GalacticTweaks.java b/src/main/java/net/romvoid95/gctweaks/GalacticTweaks.java index 539b4e7..663a4cc 100644 --- a/src/main/java/net/romvoid95/gctweaks/GalacticTweaks.java +++ b/src/main/java/net/romvoid95/gctweaks/GalacticTweaks.java @@ -50,7 +50,7 @@ public void onFingerprintViolation(FMLFingerprintViolationEvent event) { logger.warn("Invalid fingerprint detected! The file " + event.getSource().getName() + " may have been tampered with. This version will NOT be supported by the author!"); } else { - logger.info("Ignoring fingerprint signing since we are in a Development Enviroment"); + logger.info("Ignoring fingerprint signing since we are in a Development Environment"); } } diff --git a/src/main/java/net/romvoid95/gctweaks/base/Module.java b/src/main/java/net/romvoid95/gctweaks/base/Module.java index bb80f13..f3214ce 100644 --- a/src/main/java/net/romvoid95/gctweaks/base/Module.java +++ b/src/main/java/net/romvoid95/gctweaks/base/Module.java @@ -71,6 +71,9 @@ public Configuration getConfig () { return config; } + /** + * Method in every feature class. You can just specify this in a class and auto adds to GalacticTweaks.cfg + */ public void syncConfig () { features.forEach(feature -> { feature.syncConfig(config, feature.category()); diff --git a/src/main/java/net/romvoid95/gctweaks/gc/GalacticraftModule.java b/src/main/java/net/romvoid95/gctweaks/gc/GalacticraftModule.java index d868b9c..2e1d428 100644 --- a/src/main/java/net/romvoid95/gctweaks/gc/GalacticraftModule.java +++ b/src/main/java/net/romvoid95/gctweaks/gc/GalacticraftModule.java @@ -1,12 +1,10 @@ package net.romvoid95.gctweaks.gc; import net.romvoid95.gctweaks.base.Module; -import net.romvoid95.gctweaks.gc.features.CompressorFixes; -import net.romvoid95.gctweaks.gc.features.FixAsmodeusMapIcons; -import net.romvoid95.gctweaks.gc.features.MobsBreatheInSpace; -import net.romvoid95.gctweaks.gc.features.NoSpaceMusic; -import net.romvoid95.gctweaks.gc.features.OverworldComets; +import net.romvoid95.gctweaks.gc.features.*; +import net.romvoid95.gctweaks.gc.features.DimensionalComets; import net.romvoid95.gctweaks.gc.features.galaxyfeature.SeperateAddonPlanets; +import net.romvoid95.gctweaks.gc.features.generation.DisableDungeonGeneration; import net.romvoid95.gctweaks.gc.features.oxygenfeature.SpawnWithOxygenEquip; import net.romvoid95.gctweaks.gc.features.sprfeature.SpaceRaceFeature; @@ -22,9 +20,13 @@ public void addFeatures() { registerFeature(new SpawnWithOxygenEquip()); registerFeature(new NoSpaceMusic()); registerFeature(new CompressorFixes()); - registerFeature(new OverworldComets()); registerFeature(new SeperateAddonPlanets()); registerFeature(new SpaceRaceFeature()); registerFeature(new FixAsmodeusMapIcons()); + registerFeature(new DimensionalComets()); + registerFeature(new UnlockSchematics()); + + //registerFeature(new OverworldComets()); No longer needed. Replaced with DimensionalComets.java + //registerFeature(new DisableDungeonGeneration()); I couldn't figure this our right now. Later } } diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/DimensionalComets.java b/src/main/java/net/romvoid95/gctweaks/gc/features/DimensionalComets.java new file mode 100644 index 0000000..d42972c --- /dev/null +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/DimensionalComets.java @@ -0,0 +1,95 @@ +package net.romvoid95.gctweaks.gc.features; + +import micdoodle8.mods.galacticraft.core.entities.EntityMeteor; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.romvoid95.gctweaks.base.Feature; + + + +public class DimensionalComets extends Feature { + + private static boolean cometModification; + private static int[] dimensionID; + private static double cometSpawnRate; + + + @Override + public String[] category() { + return new String[] {"dimensional-comets"}; + } + + @Override + public String comment() { + return "You can specify where asteroids will drop via dimension IDs\nCheck GC dimension ID's here https://wiki.micdoodle8.com/wiki/Dimensions"; + } + + @Override + public void syncConfig(Configuration config, String[] category) { + cometModification = config + .get(category[0],"comet-modification", false, "Set to true to specify what new dimensions asteroids drop").getBoolean(); + cometSpawnRate = config + .get(category[0], "cometSpawnRate", 1.0D, "Specify the global asteroid spawn rate between values 0.0 - 1.0").getDouble(); + dimensionID = config + .get(category[0], "dimension-id", new int[] {-1, 0, 1}, "dimension IDs for asteroids").getIntList(); + } + + @Override + public boolean usesEvents() { return true; } + + @SubscribeEvent + public void entityLivingEvent(LivingEvent.LivingUpdateEvent event) { + if (cometModification) { + final EntityLivingBase entityLiving = event.getEntityLiving(); + if (entityLiving instanceof EntityPlayerMP) { + this.onPlayerUpdate((EntityPlayerMP) entityLiving); + } + } + } + private void onPlayerUpdate(EntityPlayerMP player) { + for (int id : dimensionID) { + this.meteors(player, id); + } + } + + protected void meteors(EntityPlayerMP player, int dimensionid) { + World world = player.world; + if (world.provider.getDimensionType().getId() == dimensionid ) { + final int f = (int) ((int) 5D * 750D * (1.0 / cometSpawnRate)); + int e = world.rand.nextInt(f); + if (e < 3) { + final EntityPlayer closestPlayer = world.getClosestPlayerToEntity(player, 100); + if (closestPlayer == null || closestPlayer.getEntityId() <= player.getEntityId()) { + + int r = world.getMinecraftServer().getPlayerList().getViewDistance(); + int x, z; + double motX, motZ; + x = world.rand.nextInt(20) + 160; + z = world.rand.nextInt(20) - 10; + motX = world.rand.nextDouble() * 2 - 2.5D; + motZ = world.rand.nextDouble() * 5 - 2.5D; + int px = MathHelper.floor(player.posX); + if ((x + px >> 4) - (px >> 4) >= r) { + x = ((px >> 4) + r << 4) - 1 - px; + } + + final EntityMeteor meteor = new EntityMeteor(world, player.posX + x, 355D, player.posZ + z, motX, 0, + motZ, 1); + + if (!world.isRemote) { + world.spawnEntity(meteor); +// String pos = meteor.getPosition().toString().replace("[BlockPos{", "[").replace("}]", "]"); +// String[] msg = { "[DEBUG] ", "Meteor has spawned at ", pos}; +// Utilz.sendColorizedMulti(closestPlayer, msg); + } + } + } + } + } +} diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/MobsBreatheInSpace.java b/src/main/java/net/romvoid95/gctweaks/gc/features/MobsBreatheInSpace.java index cf5ec44..099db7a 100644 --- a/src/main/java/net/romvoid95/gctweaks/gc/features/MobsBreatheInSpace.java +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/MobsBreatheInSpace.java @@ -15,7 +15,7 @@ public class MobsBreatheInSpace extends Feature { @Override public String comment() { - return "Adds ability for passive mobs to beathe on other planets"; + return "Adds ability for passive mobs to breathe on other planets"; } @Override diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/OverworldComets.java b/src/main/java/net/romvoid95/gctweaks/gc/features/OverworldComets.java index 7d8f33b..8122b8b 100644 --- a/src/main/java/net/romvoid95/gctweaks/gc/features/OverworldComets.java +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/OverworldComets.java @@ -11,6 +11,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.romvoid95.gctweaks.base.Feature; +/** + * Replaced with DimensionalComets.java + */ +@Deprecated public class OverworldComets extends Feature { private static boolean overworldComets; @@ -23,7 +27,7 @@ public String[] category() { @Override public String comment() { - return "have comets also drop in the overworld - extending realism even further"; + return "Have comets also drop in the overworld - extending realism even further"; } @Override diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/UnlockSchematics.java b/src/main/java/net/romvoid95/gctweaks/gc/features/UnlockSchematics.java new file mode 100644 index 0000000..0db5d63 --- /dev/null +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/UnlockSchematics.java @@ -0,0 +1,63 @@ +package net.romvoid95.gctweaks.gc.features; + +import micdoodle8.mods.galacticraft.api.recipe.SchematicRegistry; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.PlayerEvent; +import net.romvoid95.gctweaks.GalacticTweaks; +import net.romvoid95.gctweaks.base.Feature; + +public class UnlockSchematics extends Feature { + + private static boolean unlockSchematicsOnJoin; + private static int[] schematicID; + + + + @Override + public String[] category() { + return new String[] {"unlock-schematics"}; + } + + @Override + public String comment() { return "Unlock all schematics specified when the player joins the world."; } + + @Override + public void syncConfig(Configuration config, String[] category) { + unlockSchematicsOnJoin = config.get(category[0], "unlock-schematics", false, + "Set to true unlock schematics specified in config on player join.\nYou can see what schematic IDs are in GC by default in configs.").getBoolean(); + schematicID = config.get(category[0], "schematic-ids", new int[] {0, 1, 2, 3, 4}, + "Check galacticraft/addon config for schematic IDs").getIntList(); //maybe have a link to list of IDs on GCTweaks wiki. I'll work on that -SebaSphere + } + + @Override + public boolean usesEvents() { + return true; + } + + @SubscribeEvent + public void PlayerWorldJoin(PlayerEvent.PlayerLoggedInEvent e) { + final EntityPlayerMP player = (EntityPlayerMP) e.player; + if (unlockSchematicsOnJoin) { + perPlayerSchems(player); + } + + } + + + private void perPlayerSchems(EntityPlayerMP player) { + for (int schem : schematicID) { + try { + SchematicRegistry.unlockNewPage(player, SchematicRegistry.getSchematicItem(schem)); + + } catch (Exception e) { + GalacticTweaks.logger.error("Please remove " + schem + " from the schematics config. This is a invalid value..." ); + } + + } + } + + //maybe we can have a command to clear everyones data or specific player. Prob gonna be people reeing "I think that mod brok, removed value and nothing happened." + +} diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/generation/DisableDungeonGeneration.java b/src/main/java/net/romvoid95/gctweaks/gc/features/generation/DisableDungeonGeneration.java new file mode 100644 index 0000000..d69e4ca --- /dev/null +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/generation/DisableDungeonGeneration.java @@ -0,0 +1,43 @@ +package net.romvoid95.gctweaks.gc.features.generation; + +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.event.terraingen.InitMapGenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import net.romvoid95.gctweaks.gc.features.generation.world.gen.EmptyMapGenDungeon; +import net.romvoid95.gctweaks.base.Feature; + +public class DisableDungeonGeneration extends Feature { + private static boolean disableDungeonGeneration; + + @Override + public String[] category () { + return new String[] { "worldgen" }; + } + + @Override + public String comment () { + return "Ability to disable dungeon generation"; + } + + @Override + public void syncConfig (Configuration config, String[] category) { + disableDungeonGeneration = config + .get(category[0], "disableDungeonGeneration", false, "Set to true if you want to disable GC dungeon generation.") + .getBoolean(); + } + + @Override + public boolean usesEvents() { + return true; + } + + @SubscribeEvent + public void onMapGen (InitMapGenEvent event) { + if (disableDungeonGeneration) { + new EmptyMapGenDungeon(); + System.out.println("testAAA"); + } + } + +} diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/EmptyMapGenDungeon.java b/src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/EmptyMapGenDungeon.java new file mode 100644 index 0000000..6971656 --- /dev/null +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/EmptyMapGenDungeon.java @@ -0,0 +1,29 @@ +package net.romvoid95.gctweaks.gc.features.generation.world.gen; + +import micdoodle8.mods.galacticraft.core.world.gen.dungeon.MapGenDungeon; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.world.World; + +import java.util.Random; + +public class EmptyMapGenDungeon extends MapGenDungeon { + + public EmptyMapGenDungeon() { + super(null); + System.out.println("AAAH"); + } + + + + @Override + public synchronized boolean generateStructure(World worldIn, Random randomIn, ChunkPos chunkCoord) { + return false; + } + + @Override + public boolean canSpawnStructureAtCoords (int chunkX, int chunkZ) { + + return false; + } + +} diff --git a/src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/MapGenEmpty.java b/src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/MapGenEmpty.java new file mode 100644 index 0000000..261ca94 --- /dev/null +++ b/src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/MapGenEmpty.java @@ -0,0 +1,15 @@ +package net.romvoid95.gctweaks.gc.features.generation.world.gen; + +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.MapGenBase; + +public class MapGenEmpty extends MapGenBase { + + + + @Override + public void generate (World worldIn, int x, int z, ChunkPrimer primer) { + + } +}