Readded the BOP world type with hovering text listing the progress of the mod

This commit is contained in:
Adubbz 2015-01-12 19:41:09 +11:00
parent 74c31f70b8
commit b5065d0d15
10 changed files with 133 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import java.util.Map;
import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.MixinEnvironment;
import biomesoplenty.common.asm.transformers.BOPAccessTransformer;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
@ -49,6 +50,6 @@ public class BOPLoadingPlugin implements IFMLLoadingPlugin
@Override
public String getAccessTransformerClass()
{
return null;
return BOPAccessTransformer.class.getName();
}
}

View File

@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.asm.transformers;
import java.io.IOException;
import net.minecraftforge.fml.common.asm.transformers.AccessTransformer;
public class BOPAccessTransformer extends AccessTransformer
{
public BOPAccessTransformer() throws IOException
{
super("biomesoplenty_at.cfg");
}
}

View File

@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.handler;
import java.util.ArrayList;
import java.util.List;
import biomesoplenty.common.init.ModBiomes;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiCreateWorld;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.world.WorldType;
import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class DrawScreenEventHandler
{
public static int blockCount = 0;
@SubscribeEvent
public void onDrawScreen(DrawScreenEvent.Post event)
{
GuiScreen screenGui = event.gui;
if (screenGui instanceof GuiCreateWorld)
{
GuiCreateWorld createWorldGui = (GuiCreateWorld)screenGui;
GuiButton mapTypeButton = createWorldGui.field_146320_D;
int worldTypeIndex = createWorldGui.field_146331_K;
if (mapTypeButton.isMouseOver() && WorldType.worldTypes[worldTypeIndex] == ModBiomes.worldTypeBOP)
{
List text = new ArrayList<String>();
text.add("Progress:");
text.add("Blocks: " + blockCount);
text.add("Items: 0");
text.add("Entities: 0");
text.add("Biomes: 0");
createWorldGui.drawHoveringText(text, event.mouseX, event.mouseY);
}
}
}
}

View File

@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.init;
import biomesoplenty.common.world.WorldTypeBOP;
public class ModBiomes
{
public static WorldTypeBOP worldTypeBOP;
public static void init()
{
worldTypeBOP = new WorldTypeBOP();
}
}

View File

@ -35,6 +35,7 @@ import biomesoplenty.common.block.BlockGem;
import biomesoplenty.common.block.BlockGemOre;
import biomesoplenty.common.block.BlockHive;
import biomesoplenty.common.handler.BlockModelRegisterEventHandler;
import biomesoplenty.common.handler.DrawScreenEventHandler;
import biomesoplenty.common.item.ItemBlockWithVariants;
import biomesoplenty.common.util.block.BlockStateUtils;
import biomesoplenty.core.BiomesOPlenty;
@ -77,6 +78,8 @@ public class ModBlocks
ModelBakery.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + stateName);
BiomesOPlenty.proxy.registerBlockForMeshing(block, block.getMetaFromState(state), stateName);
DrawScreenEventHandler.blockCount++;
}
}
else
@ -85,6 +88,8 @@ public class ModBlocks
ModelBakery.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + name);
BiomesOPlenty.proxy.registerBlockForMeshing(block, 0, name);
DrawScreenEventHandler.blockCount++;
}
if (block.hasHiddenProperties()) BlockModelRegisterEventHandler.addHiddenProperties(block, block.getHiddenProperties());

View File

@ -9,6 +9,7 @@
package biomesoplenty.common.init;
import biomesoplenty.common.handler.BlockModelRegisterEventHandler;
import biomesoplenty.common.handler.DrawScreenEventHandler;
import net.minecraftforge.common.MinecraftForge;
public class ModHandlers
@ -16,5 +17,6 @@ public class ModHandlers
public static void init()
{
MinecraftForge.EVENT_BUS.register(new BlockModelRegisterEventHandler());
MinecraftForge.EVENT_BUS.register(new DrawScreenEventHandler());
}
}

View File

@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.world;
import net.minecraft.world.WorldType;
public class WorldTypeBOP extends WorldType
{
public WorldTypeBOP()
{
super("BIOMESOP");
this.setNotificationData();
}
}

View File

@ -17,6 +17,7 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import biomesoplenty.common.init.ModBiomes;
import biomesoplenty.common.init.ModBlocks;
import biomesoplenty.common.init.ModConfiguration;
import biomesoplenty.common.init.ModHandlers;
@ -44,6 +45,7 @@ public class BiomesOPlenty
ModConfiguration.init(configDirectory);
ModItems.init();
ModBlocks.init();
ModBiomes.init();
ModHandlers.init();
}

View File

@ -1,3 +1,6 @@
generator.BIOMESOP=Biomes O' Plenty
generator.BIOMESOP.info=Notice: Biomes O' Plenty 1.8 is in a very early state
itemGroup.tabBiomesOPlenty=Biomes O' Plenty
tile.ash_block.name=Ash Block

View File

@ -0,0 +1,4 @@
public net.minecraft.client.gui.GuiScreen func_146283_a(Ljava/util/List;II)V #drawHoveringText
public net.minecraft.client.gui.GuiCreateWorld field_146320_D #field_146320_D
public net.minecraft.client.gui.GuiCreateWorld field_146331_K #field_146331_K
public net.minecraft.world.WorldType func_151358_j()Lnet/minecraft/world/WorldType; #setNotificationData