1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion.git synced 2025-04-14 05:15:42 +02:00

Tweaked /heedebug test

This commit is contained in:
chylex 2014-11-06 20:44:40 +01:00
parent 3afde52195
commit d9fa641b94
3 changed files with 43 additions and 14 deletions
src/main/java/chylex/hee
system/commands
world

View File

@ -1,18 +1,19 @@
package chylex.hee.system.commands;
import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.DimensionManager;
import chylex.hee.HardcoreEnderExpansion;
import chylex.hee.entity.boss.EntityBossDragon;
import chylex.hee.entity.boss.dragon.attacks.special.DragonSpecialAttackBase;
import chylex.hee.packets.PacketPipeline;
import chylex.hee.system.logging.Log;
import chylex.hee.world.structure.island.ComponentIsland;
import chylex.hee.system.logging.Stopwatch;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
public class HeeDebugCommand extends HeeCommand{
public static float overrideWingSpeed = 1F;
@ -115,22 +116,27 @@ public class HeeDebugCommand extends HeeCommand{
info.setThunderTime(Integer.MAX_VALUE);
}
}
else if (args[0].equalsIgnoreCase("test") && args.length == 2){
else if (args[0].equalsIgnoreCase("test") && args.length == 2 && sender instanceof EntityPlayer){
try{
((Runnable)Class.forName("chylex.hee."+args[1]).getField("$debugTest").get(null)).run();
sendMessage(sender,"Test done.");
Stopwatch.time("HeeDebugCommand - test");
ClassPath path = ClassPath.from(PacketPipeline.class.getClassLoader());
for(ClassInfo clsInfo:path.getAllClasses()){
if (clsInfo.getSimpleName().equals(args[1]) && clsInfo.getPackageName().startsWith("chylex.hee")){
HeeTest test = (HeeTest)clsInfo.getClass().getField("$debugTest").get(null);
test.player = (EntityPlayer)sender;
test.world = test.player.worldObj;
test.run();
break;
}
}
Stopwatch.finish("HeeDebugCommand - test");
}catch(Throwable t){
sendMessage(sender,"Test not found.");
}
}
else if (args[0].equalsIgnoreCase(".tmp")){ // TODO remove
World world = Minecraft.getMinecraft().theWorld;
EntityPlayer plr = Minecraft.getMinecraft().thePlayer;
//new WorldGenBlob().generate(world,world.rand,(int)plr.posX+10,(int)plr.posY,(int)plr.posZ);
ComponentIsland island = new ComponentIsland(world.rand,(int)plr.posX-104,(int)plr.posZ-104);
island.addComponentParts(world,world.rand,new StructureBoundingBox(-999999,0,-999999,999999,128,999999));
}
else{
sendMessage(sender,"Unknown command.");
return;
@ -148,4 +154,11 @@ public class HeeDebugCommand extends HeeCommand{
return null;
}
public static abstract class HeeTest{
protected World world;
protected EntityPlayer player;
public abstract void run();
}
}

View File

@ -5,6 +5,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import org.apache.commons.lang3.tuple.Pair;
import chylex.hee.system.commands.HeeDebugCommand.HeeTest;
import chylex.hee.system.logging.Log;
import chylex.hee.system.weight.ObjectWeightPair;
import chylex.hee.system.weight.WeightedList;
@ -72,4 +73,11 @@ public class WorldGenBlob extends WorldGenerator{
gen.generate(world,rand,x,y,z);
return true;
}
public static final HeeTest $debugTest = new HeeTest(){
@Override
public void run(){
new WorldGenBlob().generate(world,world.rand,(int)player.posX+10,(int)player.posY,(int)player.posZ);
}
};
}

View File

@ -6,6 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import chylex.hee.block.BlockList;
import chylex.hee.system.commands.HeeDebugCommand.HeeTest;
import chylex.hee.system.logging.Stopwatch;
import chylex.hee.world.structure.ComponentScatteredFeatureCustom;
import chylex.hee.world.structure.island.biome.IslandBiomeBase;
@ -155,4 +156,11 @@ public class ComponentIsland extends ComponentScatteredFeatureCustom{
islandBottomY = nbt.getByte("bottomY");
structure.loadFromNBT(nbt.getCompoundTag("structure"));
}
public static final HeeTest $debugTest = new HeeTest(){
@Override
public void run(){
new ComponentIsland(world.rand,(int)player.posX-104,(int)player.posZ-104).addComponentParts(world,world.rand,new StructureBoundingBox(-999999,0,-999999,999999,128,999999));
}
};
}