Moved the progress stats to a command rather than hover text
This commit is contained in:
parent
1479ee8a61
commit
2ef892aa30
6 changed files with 74 additions and 60 deletions
|
@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.ChatComponentTranslation;
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
@ -30,6 +31,11 @@ import com.google.common.collect.Lists;
|
||||||
|
|
||||||
public class BOPCommand extends CommandBase
|
public class BOPCommand extends CommandBase
|
||||||
{
|
{
|
||||||
|
public static int blockCount = 0;
|
||||||
|
public static int itemCount = 0;
|
||||||
|
public static int entityCount = 0;
|
||||||
|
public static int biomeCount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandName()
|
public String getCommandName()
|
||||||
{
|
{
|
||||||
|
@ -61,15 +67,19 @@ public class BOPCommand extends CommandBase
|
||||||
{
|
{
|
||||||
throw new WrongUsageException("commands.biomesoplenty.usage");
|
throw new WrongUsageException("commands.biomesoplenty.usage");
|
||||||
}
|
}
|
||||||
else if ("biomename".equals(args[0]))
|
else if (args[0].equals("biomename"))
|
||||||
{
|
{
|
||||||
getBiomeName(sender, args);
|
getBiomeName(sender, args);
|
||||||
}
|
}
|
||||||
else if ("tpbiome".equals(args[0]))
|
else if (args[0].equals("tpbiome"))
|
||||||
{
|
{
|
||||||
teleportFoundBiome(sender, args);
|
teleportFoundBiome(sender, args);
|
||||||
}
|
}
|
||||||
else if ("stripchunk".equals(args[0]))
|
else if (args[0].equals("stats"))
|
||||||
|
{
|
||||||
|
printStats(sender, args);
|
||||||
|
}
|
||||||
|
else if (args[0].equals("stripchunk"))
|
||||||
{
|
{
|
||||||
stripChunk(sender, args);
|
stripChunk(sender, args);
|
||||||
}
|
}
|
||||||
|
@ -116,6 +126,30 @@ public class BOPCommand extends CommandBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void printStats(ICommandSender sender, String[] args) throws CommandException
|
||||||
|
{
|
||||||
|
ChatComponentTranslation text = new ChatComponentTranslation("commands.biomesoplenty.stats.blocks", blockCount);
|
||||||
|
|
||||||
|
text.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||||
|
sender.addChatMessage(text);
|
||||||
|
|
||||||
|
text = new ChatComponentTranslation("commands.biomesoplenty.stats.blocks", blockCount);
|
||||||
|
text.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||||
|
sender.addChatMessage(text);
|
||||||
|
|
||||||
|
text = new ChatComponentTranslation("commands.biomesoplenty.stats.items", itemCount);
|
||||||
|
text.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||||
|
sender.addChatMessage(text);
|
||||||
|
|
||||||
|
text = new ChatComponentTranslation("commands.biomesoplenty.stats.entities", entityCount);
|
||||||
|
text.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||||
|
sender.addChatMessage(text);
|
||||||
|
|
||||||
|
text = new ChatComponentTranslation("commands.biomesoplenty.stats.biomes", biomeCount);
|
||||||
|
text.getChatStyle().setColor(EnumChatFormatting.GREEN);
|
||||||
|
sender.addChatMessage(text);
|
||||||
|
}
|
||||||
|
|
||||||
private void stripChunk(ICommandSender sender, String[] args) throws CommandException
|
private void stripChunk(ICommandSender sender, String[] args) throws CommandException
|
||||||
{
|
{
|
||||||
if (args.length < 5)
|
if (args.length < 5)
|
||||||
|
@ -191,7 +225,7 @@ public class BOPCommand extends CommandBase
|
||||||
{
|
{
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
return getListOfStringsMatchingLastWord(args, "biomename", "tpbiome", "stripchunk");
|
return getListOfStringsMatchingLastWord(args, "biomename", "tpbiome", "stats", "stripchunk");
|
||||||
}
|
}
|
||||||
else if (args.length == 3)
|
else if (args.length == 3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,14 +8,8 @@
|
||||||
|
|
||||||
package biomesoplenty.common.handler;
|
package biomesoplenty.common.handler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.gui.GuiCreateWorld;
|
import net.minecraft.client.gui.GuiCreateWorld;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.world.WorldType;
|
|
||||||
import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent;
|
|
||||||
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -25,10 +19,6 @@ import biomesoplenty.common.init.ModBiomes;
|
||||||
|
|
||||||
public class GuiEventHandler
|
public class GuiEventHandler
|
||||||
{
|
{
|
||||||
public static int blockCount = 0;
|
|
||||||
public static int itemCount = 0;
|
|
||||||
public static int biomeCount = 0;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPreInitCreateWorld(InitGuiEvent.Pre event)
|
public void onPreInitCreateWorld(InitGuiEvent.Pre event)
|
||||||
|
@ -42,31 +32,4 @@ public class GuiEventHandler
|
||||||
createWorldGui.selectedIndex = ModBiomes.worldTypeBOP.getWorldTypeID();
|
createWorldGui.selectedIndex = ModBiomes.worldTypeBOP.getWorldTypeID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onDrawScreen(DrawScreenEvent.Post event)
|
|
||||||
{
|
|
||||||
GuiScreen screenGui = event.gui;
|
|
||||||
|
|
||||||
if (screenGui instanceof GuiCreateWorld)
|
|
||||||
{
|
|
||||||
GuiCreateWorld createWorldGui = (GuiCreateWorld)screenGui;
|
|
||||||
GuiButton mapTypeButton = createWorldGui.btnMapType;
|
|
||||||
int worldTypeIndex = createWorldGui.selectedIndex;
|
|
||||||
|
|
||||||
if (mapTypeButton.isMouseOver() && WorldType.worldTypes[worldTypeIndex] == ModBiomes.worldTypeBOP)
|
|
||||||
{
|
|
||||||
List text = new ArrayList<String>();
|
|
||||||
|
|
||||||
text.add("Progress:");
|
|
||||||
text.add("Blocks: " + blockCount);
|
|
||||||
text.add("Items: " + itemCount);
|
|
||||||
text.add("Entities: 0");
|
|
||||||
text.add("Biomes: " + biomeCount);
|
|
||||||
|
|
||||||
createWorldGui.drawHoveringText(text, event.mouseX, event.mouseY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,19 +13,19 @@ import static biomesoplenty.api.biome.BOPBiomes.alps;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.google.gson.JsonSyntaxException;
|
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
import biomesoplenty.common.biome.ExtendedBiomeRegistry;
|
|
||||||
import biomesoplenty.common.biome.overworld.BiomeGenAlps;
|
import biomesoplenty.common.biome.overworld.BiomeGenAlps;
|
||||||
import biomesoplenty.common.handler.GuiEventHandler;
|
import biomesoplenty.common.command.BOPCommand;
|
||||||
import biomesoplenty.common.util.config.JsonBiome;
|
import biomesoplenty.common.util.config.JsonBiome;
|
||||||
import biomesoplenty.common.world.WorldTypeBOP;
|
import biomesoplenty.common.world.WorldTypeBOP;
|
||||||
import biomesoplenty.core.BiomesOPlenty;
|
import biomesoplenty.core.BiomesOPlenty;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
public class ModBiomes
|
public class ModBiomes
|
||||||
{
|
{
|
||||||
public static WorldTypeBOP worldTypeBOP;
|
public static WorldTypeBOP worldTypeBOP;
|
||||||
|
@ -92,7 +92,7 @@ public class ModBiomes
|
||||||
private static Optional<BiomeGenBase> registerBiome(BiomeGenBase biome, String id)
|
private static Optional<BiomeGenBase> registerBiome(BiomeGenBase biome, String id)
|
||||||
{
|
{
|
||||||
biome.biomeID = getNextFreeBiomeId();
|
biome.biomeID = getNextFreeBiomeId();
|
||||||
GuiEventHandler.biomeCount++;
|
BOPCommand.biomeCount++;
|
||||||
|
|
||||||
return loadOrCreateConfig(biome, id);
|
return loadOrCreateConfig(biome, id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ import biomesoplenty.common.block.BlockHoney;
|
||||||
import biomesoplenty.common.block.BlockMud;
|
import biomesoplenty.common.block.BlockMud;
|
||||||
import biomesoplenty.common.block.BlockStoneFormations;
|
import biomesoplenty.common.block.BlockStoneFormations;
|
||||||
import biomesoplenty.common.block.BlockTurnip;
|
import biomesoplenty.common.block.BlockTurnip;
|
||||||
import biomesoplenty.common.handler.GuiEventHandler;
|
import biomesoplenty.common.command.BOPCommand;
|
||||||
import biomesoplenty.common.util.block.BlockStateUtils;
|
import biomesoplenty.common.util.block.BlockStateUtils;
|
||||||
import biomesoplenty.common.util.inventory.CreativeTabBOP;
|
import biomesoplenty.common.util.inventory.CreativeTabBOP;
|
||||||
import biomesoplenty.core.BiomesOPlenty;
|
import biomesoplenty.core.BiomesOPlenty;
|
||||||
|
@ -275,7 +275,7 @@ public class ModBlocks
|
||||||
ModelLoader.setCustomModelResourceLocation(item, stateMeta, new ModelResourceLocation(BiomesOPlenty.MOD_ID + ":" + stateName, "inventory"));
|
ModelLoader.setCustomModelResourceLocation(item, stateMeta, new ModelResourceLocation(BiomesOPlenty.MOD_ID + ":" + stateName, "inventory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiEventHandler.blockCount++;
|
BOPCommand.blockCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block registerBlock(Block block, String blockName)
|
public static Block registerBlock(Block block, String blockName)
|
||||||
|
|
|
@ -8,19 +8,24 @@
|
||||||
|
|
||||||
package biomesoplenty.common.init;
|
package biomesoplenty.common.init;
|
||||||
|
|
||||||
import static biomesoplenty.api.item.BOPItems.*;
|
import static biomesoplenty.api.item.BOPItems.ash;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.berries;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.crystal_shard;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.filled_honeycomb;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.fleshchunk;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.gem;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.honeycomb;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.mudball;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.peach;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.pear;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.persimmon;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.turnip;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.turnip_seeds;
|
||||||
|
import static biomesoplenty.api.item.BOPItems.wading_boots;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import biomesoplenty.api.block.BOPBlocks;
|
|
||||||
import biomesoplenty.api.item.BOPItemHelper;
|
|
||||||
import biomesoplenty.common.handler.GuiEventHandler;
|
|
||||||
import biomesoplenty.common.item.ItemGem;
|
|
||||||
import biomesoplenty.common.item.ItemMudball;
|
|
||||||
import biomesoplenty.common.item.ItemWadingBoots;
|
|
||||||
import biomesoplenty.common.util.inventory.CreativeTabBOP;
|
|
||||||
import biomesoplenty.core.BiomesOPlenty;
|
|
||||||
import net.minecraft.client.resources.model.ModelBakery;
|
import net.minecraft.client.resources.model.ModelBakery;
|
||||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -33,6 +38,14 @@ import net.minecraftforge.common.util.EnumHelper;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
|
import biomesoplenty.api.item.BOPItemHelper;
|
||||||
|
import biomesoplenty.common.command.BOPCommand;
|
||||||
|
import biomesoplenty.common.item.ItemGem;
|
||||||
|
import biomesoplenty.common.item.ItemMudball;
|
||||||
|
import biomesoplenty.common.item.ItemWadingBoots;
|
||||||
|
import biomesoplenty.common.util.inventory.CreativeTabBOP;
|
||||||
|
import biomesoplenty.core.BiomesOPlenty;
|
||||||
|
|
||||||
public class ModItems
|
public class ModItems
|
||||||
{
|
{
|
||||||
|
@ -63,7 +76,7 @@ public class ModItems
|
||||||
{
|
{
|
||||||
item.setUnlocalizedName(name).setCreativeTab(CreativeTabBOP.instance);
|
item.setUnlocalizedName(name).setCreativeTab(CreativeTabBOP.instance);
|
||||||
GameRegistry.registerItem(item,name);
|
GameRegistry.registerItem(item,name);
|
||||||
GuiEventHandler.itemCount++;
|
BOPCommand.itemCount++;
|
||||||
|
|
||||||
// register sub types if there are any
|
// register sub types if there are any
|
||||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||||
|
|
|
@ -4,6 +4,10 @@ commands.biomesoplenty.biomename.success=Biome ID %s is associated with %s
|
||||||
commands.biomesoplenty.tpbiome.usage=/biomesoplenty tpbiome [biomeId]
|
commands.biomesoplenty.tpbiome.usage=/biomesoplenty tpbiome [biomeId]
|
||||||
commands.biomesoplenty.tpbiome.success=Teleported %s to biome %s at (%s, %s, %s)
|
commands.biomesoplenty.tpbiome.success=Teleported %s to biome %s at (%s, %s, %s)
|
||||||
commands.biomesoplenty.tpbiome.error=Couldn't find biome %s!
|
commands.biomesoplenty.tpbiome.error=Couldn't find biome %s!
|
||||||
|
commands.biomesoplenty.stats.blocks=Blocks: %s
|
||||||
|
commands.biomesoplenty.stats.items=Items: %s
|
||||||
|
commands.biomesoplenty.stats.entities=Entities: %s
|
||||||
|
commands.biomesoplenty.stats.biomes=Biomes: %s
|
||||||
commands.biomesoplenty.stripchunk.usage=/biomesoplenty stripchunk [radius] <include|exclude> [block] [metadata]
|
commands.biomesoplenty.stripchunk.usage=/biomesoplenty stripchunk [radius] <include|exclude> [block] [metadata]
|
||||||
|
|
||||||
generator.BIOMESOP=Biomes O' Plenty
|
generator.BIOMESOP=Biomes O' Plenty
|
||||||
|
|
Loading…
Reference in a new issue