mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 04:32:23 +00:00
Added Mob Spawners and spawn egg tooltip to the creative tab.
This commit is contained in:
1 parent
f19853e631
commit
159ba0c017
5 files changed
+59
-1
No files matched your search
@@ -25,7 +25,8 @@ public final class TooltipHandler {
|
||||
if(event.itemStack.getItem() == Item.getItemFromBlock(Blocks.dirt) && event.itemStack.getItemDamage() == 1) {
|
||||
event.toolTip.add(StatCollector.translateToLocal("botaniamisc.coarseDirt0"));
|
||||
event.toolTip.add(StatCollector.translateToLocal("botaniamisc.coarseDirt1"));
|
||||
}
|
||||
} else if(event.itemStack.getItem() == Item.getItemFromBlock(Blocks.mob_spawner) && event.entityPlayer.capabilities.isCreativeMode)
|
||||
event.toolTip.add(StatCollector.translateToLocal("botaniamisc.spawnerTip"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,9 +11,14 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
@@ -36,6 +41,12 @@ public class BlockSpawnerClaw extends BlockModContainer implements ILexiconable
|
||||
setBlockBounds(f, 0F, f, 1F - f, f1, 1F - f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
list.add(new ItemStack(item));
|
||||
list.add(new ItemStack(Blocks.mob_spawner));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
//NO-OP
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jul 30, 2014, 12:37:24 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemMonsterPlacer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public final class SpawnerChangingHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
if(event.entityPlayer.capabilities.isCreativeMode && !event.world.isRemote && event.action == Action.RIGHT_CLICK_BLOCK && !event.entityPlayer.isSneaking()) {
|
||||
ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
|
||||
if(stack != null && stack.getItem() == Items.spawn_egg) {
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if(tile instanceof TileEntityMobSpawner) {
|
||||
TileEntityMobSpawner spawner = (TileEntityMobSpawner) tile;
|
||||
spawner.func_145881_a().setEntityName(EntityList.getStringFromID(stack.getItemDamage()));
|
||||
event.world.markBlockForUpdate(event.x, event.y, event.z);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import vazkii.botania.common.core.handler.InternalMethodHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.handler.PixieHandler;
|
||||
import vazkii.botania.common.core.handler.SheddingHandler;
|
||||
import vazkii.botania.common.core.handler.SpawnerChangingHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.core.version.CommandDownloadLatest;
|
||||
import vazkii.botania.common.crafting.ModCrafingRecipes;
|
||||
@@ -78,6 +79,7 @@ public class CommonProxy {
|
||||
MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance);
|
||||
MinecraftForge.EVENT_BUS.register(new PixieHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SheddingHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SpawnerChangingHandler());
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new CommonTickHandler());
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ botaniamisc.ratio=%s:1 Ratio
|
||||
botaniamisc.bottleTooltip=It has an acquired taste
|
||||
botaniamisc.coarseDirt0=Coarse Dirt, grass
|
||||
botaniamisc.coarseDirt1=won't grow on it
|
||||
botaniamisc.spawnerTip=Tip: Use a Spawn Egg to change the mob
|
||||
|
||||
# COLORS
|
||||
botania.color0=White
|
||||
|
||||
Reference in new issue
Block a user