-
-
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.
Co-authored-by: SebaSphere <SebaSphereEmails@gmail.com>
- Loading branch information
1 parent
4a4036e
commit dbec4c9
Showing
10 changed files
with
263 additions
and
9 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
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
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
95 changes: 95 additions & 0 deletions
95
src/main/java/net/romvoid95/gctweaks/gc/features/DimensionalComets.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,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); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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
63 changes: 63 additions & 0 deletions
63
src/main/java/net/romvoid95/gctweaks/gc/features/UnlockSchematics.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,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." | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/net/romvoid95/gctweaks/gc/features/generation/DisableDungeonGeneration.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,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"); | ||
} | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/EmptyMapGenDungeon.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,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; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/net/romvoid95/gctweaks/gc/features/generation/world/gen/MapGenEmpty.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,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) { | ||
|
||
} | ||
} |