mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-26 14:24:03 +00:00
Tweaks and optimizations
This commit is contained in:
1 parent
fcfb831c4a
commit
2aa5d63a5c
8 files changed
+59
-32
No files matched your search
@@ -255,8 +255,10 @@ public class HardcoreEnderExpansion{
|
||||
@EventHandler
|
||||
public void onPostInit(FMLPostInitializationEvent e){
|
||||
Stopwatch.time("PostInitEvent");
|
||||
|
||||
ModIntegrationManager.integrateMods();
|
||||
DimensionOverride.postInit();
|
||||
|
||||
Stopwatch.finish("PostInitEvent");
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import chylex.hee.mechanics.knowledge.fragment.CraftingKnowledgeFragment;
|
||||
import chylex.hee.mechanics.knowledge.fragment.IFragmentUnlockAction;
|
||||
import chylex.hee.mechanics.knowledge.fragment.KnowledgeFragment;
|
||||
import chylex.hee.mechanics.knowledge.fragment.TextKnowledgeFragment;
|
||||
import chylex.hee.system.logging.Stopwatch;
|
||||
|
||||
public final class KnowledgeRegistrations{
|
||||
private static final int dist = 28, hdist = dist/2;
|
||||
@@ -119,6 +120,8 @@ public final class KnowledgeRegistrations{
|
||||
MUSIC_DISCS = new KnowledgeRegistration(MISCELLANEOUS, "musicDiscs"); //
|
||||
|
||||
public static void initialize(){
|
||||
Stopwatch.time("KnowledgeRegistrations");
|
||||
|
||||
HELP
|
||||
.setFragments(new KnowledgeFragment[]{
|
||||
new TextKnowledgeFragment(0).setLocalizedText("Ender Compendium is the source of knowledge about the End dimension."),
|
||||
@@ -882,6 +885,8 @@ public final class KnowledgeRegistrations{
|
||||
.setFragments(new KnowledgeFragment[]{
|
||||
new TextKnowledgeFragment(0).setLocalizedText("Discs containing various music that plays in the End, found in various dungeons of the dimension.")
|
||||
});
|
||||
|
||||
Stopwatch.finish("KnowledgeRegistrations");
|
||||
}
|
||||
|
||||
private KnowledgeRegistrations(){}
|
||||
|
||||
@@ -14,13 +14,17 @@ import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import chylex.hee.item.ItemList;
|
||||
import chylex.hee.system.logging.Stopwatch;
|
||||
|
||||
public final class OrbAcquirableItems{
|
||||
public static final WeightedItemList idList = new WeightedItemList();
|
||||
|
||||
public static void initialize(){
|
||||
Stopwatch.time("OrbAcquirableItems");
|
||||
|
||||
for(BiomeGenBase biome:BiomeGenBase.getBiomeGenArray()){
|
||||
if (biome == null)continue;
|
||||
else if (biome.biomeID >= 128)break;
|
||||
idList.add(new WeightedItem(biome.topBlock,0,34));
|
||||
idList.add(new WeightedItem(biome.fillerBlock,0,34));
|
||||
}
|
||||
@@ -35,7 +39,22 @@ public final class OrbAcquirableItems{
|
||||
}
|
||||
|
||||
for(Object o:CraftingManager.getInstance().getRecipeList()){
|
||||
if (o instanceof ShapelessRecipes){
|
||||
if (o instanceof ShapedRecipes){
|
||||
ShapedRecipes shaped = (ShapedRecipes)o;
|
||||
|
||||
ItemStack output = shaped.getRecipeOutput();
|
||||
if (output == null)continue;
|
||||
if (output.getItem() == null){
|
||||
throw new RuntimeException("Hardcore Ender Expansion has found a defective recipe! Another mod is most likely registering a recipe BEFORE registering blocks and items. This is not a fault of Hardcore Ender Expansion, but it will cause a crash when crafting blocks from the defective mod! Please, remove other mods until this message stops appearing to find which mod causes the issue, and then report it to the mod author.");
|
||||
}
|
||||
|
||||
idList.add(new WeightedItem(output.getItem(),output.getItemDamage(),21-shaped.recipeWidth*2-shaped.recipeHeight*2));
|
||||
|
||||
for(ItemStack is:shaped.recipeItems){
|
||||
if (is != null)idList.add(new WeightedItem(is.getItem(),is.getItemDamage(),23-shaped.recipeWidth*2-shaped.recipeHeight*2));
|
||||
}
|
||||
}
|
||||
else if (o instanceof ShapelessRecipes){
|
||||
ShapelessRecipes shapeless = (ShapelessRecipes)o;
|
||||
|
||||
ItemStack output = shapeless.getRecipeOutput();
|
||||
@@ -51,21 +70,6 @@ public final class OrbAcquirableItems{
|
||||
idList.add(new WeightedItem(is.getItem(),is.getItemDamage(),25-shapeless.getRecipeSize()*2));
|
||||
}
|
||||
}
|
||||
else if (o instanceof ShapedRecipes){
|
||||
ShapedRecipes shaped = (ShapedRecipes)o;
|
||||
|
||||
ItemStack output = shaped.getRecipeOutput();
|
||||
if (output == null)continue;
|
||||
if (output.getItem() == null){
|
||||
throw new RuntimeException("Hardcore Ender Expansion has found a defective recipe! Another mod is most likely registering a recipe BEFORE registering blocks and items. This is not a fault of Hardcore Ender Expansion, but it will cause a crash when crafting blocks from the defective mod! Please, remove other mods until this message stops appearing to find which mod causes the issue, and then report it to the mod author.");
|
||||
}
|
||||
|
||||
idList.add(new WeightedItem(output.getItem(),output.getItemDamage(),21-shaped.recipeWidth*2-shaped.recipeHeight*2));
|
||||
|
||||
for(ItemStack is:shaped.recipeItems){
|
||||
if (is != null)idList.add(new WeightedItem(is.getItem(),is.getItemDamage(),23-shaped.recipeWidth*2-shaped.recipeHeight*2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -81,6 +85,8 @@ public final class OrbAcquirableItems{
|
||||
if (block instanceof IFluidBlock || block instanceof BlockLiquid)iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Stopwatch.finish("OrbAcquirableItems");
|
||||
}
|
||||
|
||||
private OrbAcquirableItems(){}
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.entity.monster.EntityWitch;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
|
||||
import chylex.hee.system.logging.Stopwatch;
|
||||
import chylex.hee.system.weight.WeightedList;
|
||||
import chylex.hee.world.structure.island.biome.IslandBiomeBase;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
@@ -19,6 +20,8 @@ public final class OrbSpawnableMobs{
|
||||
public static final Set<Class<?>> classList = new HashSet<>();
|
||||
|
||||
public static void initialize(){
|
||||
Stopwatch.time("OrbSpawnableMobs");
|
||||
|
||||
for(BiomeGenBase biome:BiomeGenBase.getBiomeGenArray()){
|
||||
if (biome == null)continue;
|
||||
|
||||
@@ -40,6 +43,8 @@ public final class OrbSpawnableMobs{
|
||||
EntityCaveSpider.class, EntityWitch.class, EntitySnowman.class,
|
||||
EntityVillager.class, EntitySilverfish.class, EntityIronGolem.class
|
||||
})classList.add(cls);
|
||||
|
||||
Stopwatch.finish("OrbSpawnableMobs");
|
||||
}
|
||||
|
||||
private OrbSpawnableMobs(){}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import chylex.hee.system.logging.Stopwatch;
|
||||
import com.google.common.reflect.ClassPath;
|
||||
import com.google.common.reflect.ClassPath.ClassInfo;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -46,6 +47,8 @@ public class PacketPipeline{
|
||||
private PacketPipeline(){}
|
||||
|
||||
private void load(){
|
||||
Stopwatch.time("PacketPipeline");
|
||||
|
||||
eventDrivenChannel = NetworkRegistry.INSTANCE.newEventDrivenChannel(channelName);
|
||||
eventDrivenChannel.register(this);
|
||||
|
||||
@@ -56,20 +59,19 @@ public class PacketPipeline{
|
||||
|
||||
int id = -1;
|
||||
|
||||
ClassPath path = ClassPath.from(PacketPipeline.class.getClassLoader());
|
||||
|
||||
for(ClassInfo clsInfo:path.getTopLevelClasses("chylex.hee.packets.client")){
|
||||
Class cls = clsInfo.load();
|
||||
if (!cls.getName().endsWith("__"))registerPacket(++id,cls);
|
||||
}
|
||||
|
||||
for(ClassInfo clsInfo:path.getTopLevelClasses("chylex.hee.packets.server")){
|
||||
Class cls = clsInfo.load();
|
||||
if (!cls.getName().endsWith("__"))registerPacket(++id,cls);
|
||||
for(ClassInfo clsInfo:ClassPath.from(PacketPipeline.class.getClassLoader()).getTopLevelClassesRecursive("chylex.hee.packets")){
|
||||
String name = clsInfo.getName();
|
||||
|
||||
if (name.startsWith("chylex.hee.packets.client.C") || name.startsWith("chylex.hee.packets.server.S")){
|
||||
Class cls = clsInfo.load();
|
||||
registerPacket(++id,cls);
|
||||
}
|
||||
}
|
||||
}catch(NoSuchFieldException | IllegalArgumentException | IllegalAccessException | IOException e){
|
||||
throw new RuntimeException("Unable to load the Packet system!",e);
|
||||
}
|
||||
|
||||
Stopwatch.finish("PacketPipeline");
|
||||
}
|
||||
|
||||
private void registerPacket(int id, Class<? extends AbstractPacket> cls){
|
||||
|
||||
+3
-3
@@ -5,11 +5,11 @@ import chylex.hee.packets.AbstractClientPacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class C__ extends AbstractClientPacket{
|
||||
public class __ extends AbstractClientPacket{
|
||||
|
||||
public C__(){}
|
||||
public __(){}
|
||||
|
||||
public C__(Object o){
|
||||
public __(Object o){
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,11 +3,11 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import chylex.hee.packets.AbstractServerPacket;
|
||||
|
||||
public class S__ extends AbstractServerPacket{
|
||||
public class __ extends AbstractServerPacket{
|
||||
|
||||
public S__(){}
|
||||
public __(){}
|
||||
|
||||
public S__(Object o){
|
||||
public __(Object o){
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public final class DimensionOverride{
|
||||
}
|
||||
|
||||
private static void overrideBiome(){
|
||||
Stopwatch.time("DimensionOverride - Biome");
|
||||
Field modifiersField = null;
|
||||
|
||||
try{
|
||||
@@ -53,10 +54,14 @@ public final class DimensionOverride{
|
||||
}catch(NoSuchFieldException | IllegalArgumentException | IllegalAccessException e){
|
||||
throw new RuntimeException("Could not override the End biome!",e);
|
||||
}
|
||||
|
||||
Stopwatch.finish("DimensionOverride - Biome");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void overrideWorldGen(){
|
||||
Stopwatch.time("DimensionOverride - WorldProvider");
|
||||
|
||||
try{
|
||||
Field f = DimensionManager.class.getDeclaredField("providers");
|
||||
f.setAccessible(true); // let it throw NPE if the field isn't found
|
||||
@@ -67,5 +72,7 @@ public final class DimensionOverride{
|
||||
}catch(NoSuchFieldException | IllegalArgumentException | IllegalAccessException e){
|
||||
throw new RuntimeException("Could not override the DimensionManager providers!",e);
|
||||
}
|
||||
|
||||
Stopwatch.finish("DimensionOverride - WorldProvider");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user