mirror of
https://github.com/chylex/Hardcore-Ender-Expansion.git
synced 2025-04-10 20:15:42 +02:00
Remove old SpawnEntry class used in biomes
This commit is contained in:
parent
098bed9f75
commit
25dde72069
src/main/java/chylex/hee
api/message
world
@ -23,6 +23,6 @@ public class SpawnEntryValue extends PreconditionComposite<SpawnEntry>{
|
||||
|
||||
@Override
|
||||
public SpawnEntry getValue(MessageRunner runner){
|
||||
return new SpawnEntry((Class<? extends EntityLiving>)EntityList.stringToClassMapping.get(runner.getString("id")),runner.getInt("limit"),runner.getInt("weight"));
|
||||
return null; // TODO new SpawnEntry((Class<? extends EntityLiving>)EntityList.stringToClassMapping.get(runner.getString("id")),runner.getInt("limit"),runner.getInt("weight"));
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import chylex.hee.world.structure.island.biome.IslandBiomeBurningMountains;
|
||||
import chylex.hee.world.structure.island.biome.IslandBiomeEnchantedIsland;
|
||||
import chylex.hee.world.structure.island.biome.IslandBiomeInfestedForest;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeContentVariation;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
|
||||
public final class ImcWorldHandlers extends ImcHandler{
|
||||
// TODO private static final Map<String,WeightedLootList> lootNames = new HashMap<>();
|
||||
@ -90,7 +89,7 @@ public final class ImcWorldHandlers extends ImcHandler{
|
||||
|
||||
private static final IMessageHandler biomeMobAdd = runner -> {
|
||||
Pair<IslandBiomeBase,BiomeContentVariation> pair = biomeNames.get(runner.getString("biome"));
|
||||
pair.getLeft().getSpawnEntries(pair.getRight()).add(runner.<SpawnEntry>getValue("mob"));
|
||||
// TODO pair.getLeft().getSpawnEntries(pair.getRight()).add(runner.<SpawnEntry>getValue("mob"));
|
||||
MessageLogger.logOk("Added 1 entry to the list.");
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package chylex.hee.world.structure.island.biome;
|
||||
import gnu.trove.map.hash.TByteObjectHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
@ -16,7 +15,6 @@ import chylex.hee.world.structure.island.biome.data.AbstractBiomeInteraction.Bio
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeContentVariation;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeRandomDeviation;
|
||||
import chylex.hee.world.structure.island.biome.data.IslandBiomeData;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
|
||||
public abstract class IslandBiomeBase{
|
||||
public static final IslandBiomeBase infestedForest = new IslandBiomeInfestedForest(0),
|
||||
@ -31,7 +29,6 @@ public abstract class IslandBiomeBase{
|
||||
|
||||
public final byte biomeID;
|
||||
|
||||
private final TByteObjectHashMap<WeightedList<SpawnEntry>> spawnEntries;
|
||||
protected final TByteObjectHashMap<CustomArrayList<BiomeInteraction>> interactions;
|
||||
protected final WeightedList<BiomeContentVariation> contentVariations;
|
||||
protected final List<BiomeRandomDeviation> randomDeviations;
|
||||
@ -40,21 +37,11 @@ public abstract class IslandBiomeBase{
|
||||
|
||||
protected IslandBiomeBase(int biomeID){
|
||||
this.biomeID = (byte)biomeID;
|
||||
this.spawnEntries = new TByteObjectHashMap<>();
|
||||
this.interactions = new TByteObjectHashMap<>();
|
||||
this.contentVariations = new WeightedList<>();
|
||||
this.randomDeviations = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Collection<WeightedList<SpawnEntry>> getAllSpawnEntries(){
|
||||
return spawnEntries.valueCollection();
|
||||
}
|
||||
|
||||
public WeightedList<SpawnEntry> getSpawnEntries(BiomeContentVariation contentVariation){
|
||||
spawnEntries.putIfAbsent(contentVariation.id,new WeightedList<SpawnEntry>());
|
||||
return spawnEntries.get(contentVariation.id);
|
||||
}
|
||||
|
||||
public CustomArrayList<BiomeInteraction> getInteractions(BiomeContentVariation contentVariation){
|
||||
interactions.putIfAbsent(contentVariation.id,new CustomArrayList<BiomeInteraction>());
|
||||
return interactions.get(contentVariation.id);
|
||||
|
@ -1,13 +1,9 @@
|
||||
package chylex.hee.world.structure.island.biome;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import chylex.hee.block.BlockEndstoneTerrain;
|
||||
import chylex.hee.entity.mob.EntityMobFireGolem;
|
||||
import chylex.hee.entity.mob.EntityMobHauntedMiner;
|
||||
import chylex.hee.entity.mob.EntityMobScorchingLens;
|
||||
import chylex.hee.game.achievements.AchievementManager;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeContentVariation;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeRandomDeviation;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
|
||||
public class IslandBiomeBurningMountains extends IslandBiomeBase{
|
||||
public static final BiomeContentVariation SCORCHING = new BiomeContentVariation(1,8);
|
||||
@ -31,14 +27,14 @@ public class IslandBiomeBurningMountains extends IslandBiomeBase{
|
||||
randomDeviations.add(LIMITED_ORES);
|
||||
randomDeviations.add(DEEP_RESOURCE_PITS);
|
||||
|
||||
getSpawnEntries(SCORCHING).add(new SpawnEntry[]{
|
||||
/*getSpawnEntries(SCORCHING).add(new SpawnEntry[]{
|
||||
new SpawnEntry(EntityMobFireGolem.class,14,10),
|
||||
new SpawnEntry(EntityMobScorchingLens.class,10,6)
|
||||
});
|
||||
|
||||
getSpawnEntries(MINE).add(new SpawnEntry[]{
|
||||
new SpawnEntry(EntityMobHauntedMiner.class,20,10)
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
/*@Override
|
||||
|
@ -1,16 +1,11 @@
|
||||
package chylex.hee.world.structure.island.biome;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import chylex.hee.block.BlockEndstoneTerrain;
|
||||
import chylex.hee.entity.mob.EntityMobBabyEnderman;
|
||||
import chylex.hee.entity.mob.EntityMobEnderGuardian;
|
||||
import chylex.hee.entity.mob.EntityMobEndermage;
|
||||
import chylex.hee.entity.mob.EntityMobEnderman;
|
||||
import chylex.hee.game.achievements.AchievementManager;
|
||||
import chylex.hee.world.structure.island.biome.data.AbstractBiomeInteraction.BiomeInteraction;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeContentVariation;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeRandomDeviation;
|
||||
import chylex.hee.world.structure.island.biome.interaction.BiomeInteractionEnchantedIsland.InteractionCellarSounds;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
|
||||
public class IslandBiomeEnchantedIsland extends IslandBiomeBase{
|
||||
public static final BiomeContentVariation HOMELAND = new BiomeContentVariation(2,6);
|
||||
@ -32,7 +27,7 @@ public class IslandBiomeEnchantedIsland extends IslandBiomeBase{
|
||||
randomDeviations.add(GOO_SWAMP);
|
||||
randomDeviations.add(MORE_SHADOW_ORCHIDS);
|
||||
|
||||
getSpawnEntries(HOMELAND).add(new SpawnEntry[]{
|
||||
/*getSpawnEntries(HOMELAND).add(new SpawnEntry[]{
|
||||
new SpawnEntry(EntityMobEnderman.class,22,38),
|
||||
new SpawnEntry(EntityMobBabyEnderman.class,14,20)
|
||||
});
|
||||
@ -41,7 +36,7 @@ public class IslandBiomeEnchantedIsland extends IslandBiomeBase{
|
||||
new SpawnEntry(EntityMobEndermage.class,7,15),
|
||||
new SpawnEntry(EntityMobEnderman.class,12,10),
|
||||
new SpawnEntry(EntityMobEnderGuardian.class,20,7)
|
||||
});
|
||||
});*/
|
||||
|
||||
getInteractions(HOMELAND).addAll(new BiomeInteraction[]{
|
||||
new BiomeInteraction("EI_Homeland_CellarSounds",InteractionCellarSounds.class,10,20)
|
||||
|
@ -1,14 +1,11 @@
|
||||
package chylex.hee.world.structure.island.biome;
|
||||
import net.minecraft.entity.monster.EntitySilverfish;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import chylex.hee.block.BlockEndstoneTerrain;
|
||||
import chylex.hee.entity.mob.EntityMobInfestedBat;
|
||||
import chylex.hee.game.achievements.AchievementManager;
|
||||
import chylex.hee.world.structure.island.biome.data.AbstractBiomeInteraction.BiomeInteraction;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeContentVariation;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeRandomDeviation;
|
||||
import chylex.hee.world.structure.island.biome.interaction.BiomeInteractionsInfestedForest.InteractionCollapsingTrees;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
|
||||
public class IslandBiomeInfestedForest extends IslandBiomeBase{
|
||||
public static final BiomeContentVariation DEEP = new BiomeContentVariation(0,8);
|
||||
@ -29,10 +26,10 @@ public class IslandBiomeInfestedForest extends IslandBiomeBase{
|
||||
randomDeviations.add(TALL_TREES);
|
||||
randomDeviations.add(MORE_THORNY_BUSHES);
|
||||
|
||||
getSpawnEntries(DEEP).add(new SpawnEntry[]{
|
||||
/*getSpawnEntries(DEEP).add(new SpawnEntry[]{
|
||||
new SpawnEntry(EntitySilverfish.class,35,35),
|
||||
new SpawnEntry(EntityMobInfestedBat.class,8,10)
|
||||
});
|
||||
});*/
|
||||
|
||||
getInteractions(DEEP).addAll(new BiomeInteraction[]{
|
||||
new BiomeInteraction("IF_Deep_CollapsingTrees",InteractionCollapsingTrees.class,40,2)
|
||||
|
@ -1,43 +0,0 @@
|
||||
package chylex.hee.world.util;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.world.World;
|
||||
import chylex.hee.system.collections.weight.IWeightProvider;
|
||||
|
||||
public class SpawnEntry implements IWeightProvider{
|
||||
private final Class<? extends EntityLiving> mobClass;
|
||||
private final byte maxAmount;
|
||||
private final byte weight;
|
||||
public final boolean isMob;
|
||||
|
||||
public SpawnEntry(Class<? extends EntityLiving> mobClass, int maxAmount, int weight){
|
||||
this.mobClass = mobClass;
|
||||
this.maxAmount = (byte)maxAmount;
|
||||
this.weight = (byte)weight;
|
||||
this.isMob = IMob.class.isAssignableFrom(mobClass);
|
||||
}
|
||||
|
||||
public Class<? extends EntityLiving> getMobClass(){
|
||||
return mobClass;
|
||||
}
|
||||
|
||||
public int getMaxAmount(){
|
||||
return maxAmount;
|
||||
}
|
||||
|
||||
public EntityLiving createMob(World world){
|
||||
try{
|
||||
return mobClass.getConstructor(World.class).newInstance(world);
|
||||
}catch(NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight(){
|
||||
return weight;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user