-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #540 from jchung01/mod-tweaks
Add Compact Machines tweak to properly control mob spawn checks
- Loading branch information
Showing
9 changed files
with
88 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
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
2 changes: 1 addition & 1 deletion
2
...mpactmachines/mixin/UTCubeToolsMixin.java → ...chines/render/mixin/UTCubeToolsMixin.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
41 changes: 41 additions & 0 deletions
41
...ming/universaltweaks/mods/compactmachines/spawns/mixin/UTChunkGeneratorMachinesMixin.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,41 @@ | ||
package mod.acgaming.universaltweaks.mods.compactmachines.spawns.mixin; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import net.minecraft.entity.EnumCreatureType; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
|
||
import org.dave.compactmachines3.misc.ConfigurationHandler; | ||
import org.dave.compactmachines3.world.ChunkGeneratorMachines; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
// Courtesy of jchung01 | ||
@Mixin(value = ChunkGeneratorMachines.class) | ||
public class UTChunkGeneratorMachinesMixin | ||
{ | ||
@Shadow(remap = false) | ||
@Final | ||
private World world; | ||
|
||
/** | ||
* Another spot the CM config should control spawns; here for redundancy. | ||
* @reason Control mob spawn based on type | ||
* @author jchung01 | ||
*/ | ||
@Overwrite | ||
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) | ||
{ | ||
if ((creatureType.getPeacefulCreature() && ConfigurationHandler.MachineSettings.allowPeacefulSpawns) || | ||
(!creatureType.getPeacefulCreature() && ConfigurationHandler.MachineSettings.allowHostileSpawns)) | ||
{ | ||
return this.world.getBiome(pos).getSpawnableList(creatureType); | ||
} | ||
else return Collections.emptyList(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...aming/universaltweaks/mods/compactmachines/spawns/mixin/UTWorldProviderMachinesMixin.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,22 @@ | ||
package mod.acgaming.universaltweaks.mods.compactmachines.spawns.mixin; | ||
|
||
import net.minecraft.world.WorldProvider; | ||
|
||
import org.dave.compactmachines3.misc.ConfigurationHandler; | ||
import org.dave.compactmachines3.world.WorldProviderMachines; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
// Courtesy of jchung01 | ||
@Mixin(value = WorldProviderMachines.class) | ||
public abstract class UTWorldProviderMachinesMixin extends WorldProvider | ||
{ | ||
/** | ||
* Let CM config set allowed spawns when the dim loads. | ||
* This helps server performance especially when both hostile and peaceful spawns are disabled. | ||
*/ | ||
@Override | ||
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) | ||
{ | ||
super.setAllowedSpawnTypes(ConfigurationHandler.MachineSettings.allowHostileSpawns, ConfigurationHandler.MachineSettings.allowPeacefulSpawns); | ||
} | ||
} |
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
4 changes: 2 additions & 2 deletions
4
...esources/mixins.mods.compactmachines.json → ...s/mixins.mods.compactmachines.render.json
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,7 +1,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.mods.compactmachines.mixin", | ||
"package": "mod.acgaming.universaltweaks.mods.compactmachines.render.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTCubeToolsMixin"] | ||
"client": ["UTCubeToolsMixin"] | ||
} |
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.mods.compactmachines.spawns.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTChunkGeneratorMachinesMixin", "UTWorldProviderMachinesMixin"] | ||
} |