No more networking, +recipe and lexicon entry

This commit is contained in:
Flaxbeard committed 2014-08-30 18:36:34 -05:00
1 parent 00738a9c3e
commit 5c9d2dc067
11 files changed
+29 -129

No files matched your search

@@ -64,7 +64,6 @@ import vazkii.botania.client.render.tile.RenderTileSpawnerClaw;
import vazkii.botania.client.render.tile.RenderTileSpreader;
import vazkii.botania.client.render.tile.RenderTileStarfield;
import vazkii.botania.client.render.tile.RenderTileTinyPotato;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileAlfPortal;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileEnchanter;
@@ -86,7 +85,6 @@ import vazkii.botania.common.entity.EntitySpark;
import vazkii.botania.common.entity.EntityVineBall;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibObfuscation;
import vazkii.botania.common.network.BotaniaClientPacketHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -113,12 +111,6 @@ public class ClientProxy extends CommonProxy {
initRenderers();
}
@Override
public void registerPacketHandler() {
Botania.channel.register(new BotaniaClientPacketHandler());
}
private void initRenderers() {
LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId();
@@ -40,8 +40,6 @@ public class Botania {
@SidedProxy(serverSide = LibMisc.PROXY_COMMON, clientSide = LibMisc.PROXY_CLIENT)
public static CommonProxy proxy;
public static FMLEventChannel channel;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
thaumcraftLoaded = Loader.isModLoaded("Thaumcraft");
@@ -51,7 +49,6 @@ public class Botania {
@EventHandler
public void init(FMLInitializationEvent event) {
channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(LibMisc.MOD_ID);
proxy.init(event);
}
@@ -17,14 +17,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import org.lwjgl.input.Mouse;
import vazkii.botania.common.item.ItemGravityRod;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.network.BotaniaClientPacketHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
@@ -46,12 +39,7 @@ public final class CommonTickHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onTick(ClientTickEvent event) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (Mouse.isButtonDown(0) && player != null && player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gravityRod) {
BotaniaClientPacketHandler.sendClickPacket(player);
ItemGravityRod.leftClick(player);
}
public void onTick(ClientTickEvent event) {
if(event.phase == Phase.END) {
World world = Minecraft.getMinecraft().theWorld;
if(world != null) {
@@ -41,7 +41,6 @@ import vazkii.botania.common.crafting.ModRuneRecipes;
import vazkii.botania.common.entity.ModEntities;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.network.BotaniaServerPacketHandler;
import vazkii.botania.common.network.GuiHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -83,14 +82,8 @@ public class CommonProxy {
MinecraftForge.EVENT_BUS.register(new SpawnerChangingHandler());
FMLCommonHandler.instance().bus().register(new CommonTickHandler());
registerPacketHandler();
}
public void registerPacketHandler() {
Botania.channel.register(new BotaniaServerPacketHandler());
}
public void postInit(FMLPostInitializationEvent event) {
ModBlocks.addDispenserBehaviours();
ConfigHandler.loadPostInit();
@@ -193,6 +193,7 @@ public final class ModCrafingRecipes {
public static IRecipe recipeDiviningRod;
public static List<IRecipe> recipesWings;
public static IRecipe recipeRFGenerator;
public static IRecipe recipeGravityRod;
public static void init() {
// Lexicon Recipe
@@ -1203,6 +1204,14 @@ public final class ModCrafingRecipes {
'D', LibOreDict.MANA_DIAMOND);
recipeDiviningRod = BotaniaAPI.getLatestAddedRecipe();
// Rod of the Black Mesa Recipe
addOreDictRecipe(new ItemStack(ModItems.gravityRod),
" TD", " TW", "T ",
'T', LibOreDict.LIVINGWOOD_TWIG,
'W', new ItemStack(Items.wheat),
'D', LibOreDict.DRAGONSTONE);
recipeGravityRod = BotaniaAPI.getLatestAddedRecipe();
// Wing Recipes
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.flightTiara, 1, 1), new ItemStack(ModItems.flightTiara), new ItemStack(Items.quartz));
for(int i = 0; i < 6; i++)
@@ -27,7 +27,9 @@ import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.entity.EntityThrownItem;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.lib.LibItemNames;
public class ItemGravityRod extends ItemMod implements IManaUsingItem {
@@ -40,7 +42,7 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
}
@Override
public void onUpdate(ItemStack stack, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
public void onUpdate(ItemStack stack, World world, Entity par3Entity, int p_77663_4_, boolean p_77663_5_) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
@@ -64,6 +66,12 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
ticksTillExpire--;
stack.stackTagCompound.setInteger("ticksTillExpire", ticksTillExpire);
stack.stackTagCompound.setInteger("ticksCooldown", ticksCooldown);
EntityPlayer player = (EntityPlayer) par3Entity;
PotionEffect haste = player.getActivePotionEffect(Potion.digSpeed);
float check = haste == null ? 0.16666667F : haste.getAmplifier() == 1 ? 0.5F : 0.4F;
if(player.getCurrentEquippedItem() == stack && player.swingProgress == check && !world.isRemote) {
this.leftClick(player);
}
}
@Override
@@ -148,6 +148,7 @@ public final class LexiconData {
public static LexiconEntry enderHand;
public static LexiconEntry glassPick;
public static LexiconEntry diviningRod;
public static LexiconEntry gravityRod;
public static LexiconEntry baublesIntro;
public static LexiconEntry tinyPlanet;
@@ -518,6 +519,9 @@ public final class LexiconData {
diviningRod = new BLexiconEntry(LibLexicon.TOOL_DIVINING_ROD, categoryTools);
diviningRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDiviningRod));
gravityRod = new BLexiconEntry(LibLexicon.TOOL_GRAVITY_ROD, categoryTools);
gravityRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeGravityRod));
// BAUBLES ENTRIES
baublesIntro = new BLexiconEntry(LibLexicon.BAUBLE_INTRO, categoryBaubles);
baublesIntro.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_BAUBLES), new PageText("2"));
@@ -123,6 +123,7 @@ public final class LibLexicon {
public static final String TOOL_ENDER_HAND = "enderHand";
public static final String TOOL_GLASS_PICK = "glassPick";
public static final String TOOL_DIVINING_ROD = "diviningRod";
public static final String TOOL_GRAVITY_ROD = "gravityRod";
public static final String BAUBLE_INTRO = "bIntro";
public static final String BAUBLE_TINY_PLANET = "tinyPlanet";
@@ -1,48 +0,0 @@
/**
* This class was created by <Flaxbeard>. 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 @ [? (GMT)]
*/
package vazkii.botania.common.network;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibMisc;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
public class BotaniaClientPacketHandler extends BotaniaServerPacketHandler {
public static void sendClickPacket(EntityPlayer player) {
// System.out.println("GE1T");
ByteBuf buf = Unpooled.buffer();
ByteBufOutputStream out = new ByteBufOutputStream(buf);
try
{
out.writeInt(player.worldObj.provider.dimensionId);
out.writeInt(player.getEntityId());
}
catch (IOException e) {}
FMLProxyPacket packet = new FMLProxyPacket(buf,LibMisc.MOD_ID);
Botania.channel.sendToServer(packet);
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -1,49 +0,0 @@
/**
* This class was created by <Flaxbeard>. 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 @ [? (GMT)]
*/
package vazkii.botania.common.network;
import io.netty.buffer.ByteBufInputStream;
import java.io.IOException;
import vazkii.botania.common.item.ItemGravityRod;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
public class BotaniaServerPacketHandler {
@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent event) {
// System.out.println("GET");
ByteBufInputStream bbis = new ByteBufInputStream(event.packet.payload());
int dimension;
try
{
dimension = bbis.readInt();
World world = DimensionManager.getWorld(dimension);
int playerID = bbis.readInt();
EntityPlayer player = (EntityPlayer) world.getEntityByID(playerID);
ItemGravityRod.leftClick(player);
bbis.close();
}
catch (IOException e)
{
e.printStackTrace();
return;
}
}
}
+5
View File
@@ -1392,6 +1392,11 @@ botania.entry.diviningRod=Rod of Divining
botania.page.diviningRod0=As its name implies, the &1Rod of Divining&0 has the ability to divine in a decently large radius around the user to find any ores. These will shine for a little bit, allowing their location.<br>This process, obviously, requires a decent amount of &4Mana&0 from the user's inventory.
botania.page.diviningRod1=inb4 ee3
# -- ROD OF THE BLACK MESA
botania.entry.gravityRod=Rod of the Black Mesa
botania.page.gravityRod0=The &1Rod of the Black Mesa&0 is a powerful relic, legend says that the first of these devices was found atop a dark mesa, along with a crowbar. To use this device, the user may right click and hold on a monster or item to pick it up. Releasing right click will drop the selected entity, while left click will fire it in a powerful burst.
botania.page.gravityRod1=bun
# - BAUBLES
# -- AN INTRODUCTION TO BAUBLES
botania.entry.bIntro=An Introduction to Baubles