From 00738a9c3e188065628e8903043b5e38953544ec Mon Sep 17 00:00:00 2001 From: Flaxbeard Date: Sat, 30 Aug 2014 16:43:36 -0500 Subject: [PATCH 1/3] Rod of the Black Mesa --- .../client/core/proxy/ClientProxy.java | 10 +- MODSRC/vazkii/botania/common/Botania.java | 5 + .../common/core/BotaniaCreativeTab.java | 1 + .../core/handler/CommonTickHandler.java | 12 + .../common/core/proxy/CommonProxy.java | 7 + .../common/entity/EntityThrownItem.java | 149 +++++++++++ .../botania/common/entity/ModEntities.java | 4 + .../botania/common/item/ItemGravityRod.java | 246 ++++++++++++++++++ .../vazkii/botania/common/item/ModItems.java | 4 +- .../botania/common/lib/LibEntityNames.java | 1 + .../botania/common/lib/LibItemNames.java | 1 + .../network/BotaniaClientPacketHandler.java | 48 ++++ .../network/BotaniaServerPacketHandler.java | 49 ++++ resources/assets/botania/lang/en_US.lang | 3 +- .../botania/textures/items/gravityRod.png | Bin 0 -> 455 bytes .../textures/items/gravityRod.png.mcmeta | 19 ++ 16 files changed, 556 insertions(+), 3 deletions(-) create mode 100644 MODSRC/vazkii/botania/common/entity/EntityThrownItem.java create mode 100644 MODSRC/vazkii/botania/common/item/ItemGravityRod.java create mode 100644 MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java create mode 100644 MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java create mode 100644 resources/assets/botania/textures/items/gravityRod.png create mode 100644 resources/assets/botania/textures/items/gravityRod.png.mcmeta diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index c3048ee4d..40b505f0c 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -28,8 +28,8 @@ import vazkii.botania.client.core.handler.BotaniaPlayerController; import vazkii.botania.client.core.handler.BoundTileRenderer; import vazkii.botania.client.core.handler.ClientTickHandler; import vazkii.botania.client.core.handler.HUDHandler; -import vazkii.botania.client.core.handler.TiaraWingRenderHandler; import vazkii.botania.client.core.handler.LightningHandler; +import vazkii.botania.client.core.handler.TiaraWingRenderHandler; import vazkii.botania.client.core.handler.TooltipHandler; import vazkii.botania.client.core.helper.ShaderHelper; import vazkii.botania.client.fx.FXSparkle; @@ -64,6 +64,7 @@ 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; @@ -85,6 +86,7 @@ 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; @@ -111,6 +113,12 @@ public class ClientProxy extends CommonProxy { initRenderers(); } + + @Override + public void registerPacketHandler() { + Botania.channel.register(new BotaniaClientPacketHandler()); + } + private void initRenderers() { LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId(); diff --git a/MODSRC/vazkii/botania/common/Botania.java b/MODSRC/vazkii/botania/common/Botania.java index ea1807ce1..78d1c7a81 100644 --- a/MODSRC/vazkii/botania/common/Botania.java +++ b/MODSRC/vazkii/botania/common/Botania.java @@ -26,6 +26,8 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; +import cpw.mods.fml.common.network.FMLEventChannel; +import cpw.mods.fml.common.network.NetworkRegistry; @Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, dependencies = LibMisc.DEPENDENCIES, guiFactory = LibMisc.GUI_FACTORY) public class Botania { @@ -37,6 +39,8 @@ 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) { @@ -47,6 +51,7 @@ public class Botania { @EventHandler public void init(FMLInitializationEvent event) { + channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(LibMisc.MOD_ID); proxy.init(event); } diff --git a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java index 4b93dad51..720a980c6 100644 --- a/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java +++ b/MODSRC/vazkii/botania/common/core/BotaniaCreativeTab.java @@ -81,6 +81,7 @@ public final class BotaniaCreativeTab extends CreativeTabs { addItem(ModItems.tornadoRod); addItem(ModItems.fireRod); addItem(ModItems.diviningRod); + addItem(ModItems.gravityRod); addItem(ModItems.virus); addItem(ModItems.slingshot); addItem(ModItems.vineBall); diff --git a/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java b/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java index de32f6ecb..156096467 100644 --- a/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java @@ -17,7 +17,14 @@ 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; @@ -40,6 +47,11 @@ 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); + } if(event.phase == Phase.END) { World world = Minecraft.getMinecraft().theWorld; if(world != null) { diff --git a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java index 839d1b8ca..da47fc2d3 100644 --- a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java @@ -41,6 +41,7 @@ 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; @@ -82,6 +83,12 @@ 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) { diff --git a/MODSRC/vazkii/botania/common/entity/EntityThrownItem.java b/MODSRC/vazkii/botania/common/entity/EntityThrownItem.java new file mode 100644 index 000000000..8a44e26ce --- /dev/null +++ b/MODSRC/vazkii/botania/common/entity/EntityThrownItem.java @@ -0,0 +1,149 @@ +/** + * This class was created by . 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.entity; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import vazkii.botania.common.core.helper.Vector3; + +public class EntityThrownItem extends EntityItem { + + public EntityThrownItem(World par1World) { + super(par1World); + } + + public EntityThrownItem(World p_i1710_1_, double p_i1710_2_, + double p_i1710_4_, double p_i1710_6_, EntityItem item) { + super(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_, item.getEntityItem()); + + this.delayBeforeCanPickup = item.delayBeforeCanPickup; + this.motionX = item.motionX; + this.motionY = item.motionY; + this.motionZ = item.motionZ; + } + + @Override + public boolean isEntityInvulnerable() { + return true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); + + + if (!this.worldObj.isRemote) + { + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX*2, this.motionY*2, this.motionZ*2).expand(2.0D, 2.0D, 2.0D)); + double d0 = 0.0D; + + for (int j = 0; j < list.size(); ++j) + { + Entity entity1 = (Entity)list.get(j); + + if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || this.delayBeforeCanPickup == 0)) + { + float f = 1.0F; + AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); + + if (movingobjectposition1 != null) + { + double d1 = vec3.distanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + } + + if (movingobjectposition != null) + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal) + { + this.setInPortal(); + } + else + { + if (movingobjectposition.entityHit != null) { + movingobjectposition.entityHit.attackEntityFrom(DamageSource.magic, 2.0F); + if (!this.worldObj.isRemote) { + Entity item = this.getEntityItem().getItem().createEntity(worldObj, this, this.getEntityItem()); + if (item == null) { + item = new EntityItem(worldObj, this.posX, this.posY, this.posZ, this.getEntityItem()); + worldObj.spawnEntityInWorld(item); + item.motionX = this.motionX*0.25F; + item.motionY = this.motionY*0.25F; + item.motionZ = this.motionZ*0.25F; + + } + else + { + item.motionX = this.motionX*0.25F; + item.motionY = this.motionY*0.25F; + item.motionZ = this.motionZ*0.25F; + } + } + this.setDead(); + + } + } + } + + Vector3 vec3m = new Vector3(this.motionX, this.motionY, this.motionZ); + if (vec3m.mag() < 1.0F) { + if (!this.worldObj.isRemote) { + System.out.println("3slo"); + Entity item = this.getEntityItem().getItem().createEntity(worldObj, this, this.getEntityItem()); + if (item == null) { + item = new EntityItem(worldObj, this.posX, this.posY, this.posZ, this.getEntityItem()); + worldObj.spawnEntityInWorld(item); + item.motionX = this.motionX; + item.motionY = this.motionY; + item.motionZ = this.motionZ; + + } + else + { + item.motionX = this.motionX; + item.motionY = this.motionY; + item.motionZ = this.motionZ; + } + } + this.setDead(); + } + } +} diff --git a/MODSRC/vazkii/botania/common/entity/ModEntities.java b/MODSRC/vazkii/botania/common/entity/ModEntities.java index 132fb7ec6..97b863e64 100644 --- a/MODSRC/vazkii/botania/common/entity/ModEntities.java +++ b/MODSRC/vazkii/botania/common/entity/ModEntities.java @@ -14,6 +14,8 @@ package vazkii.botania.common.entity; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibEntityNames; import cpw.mods.fml.common.registry.EntityRegistry; +import flaxbeard.steamcraft.Steamcraft; +import flaxbeard.steamcraft.entity.EntityFloatingItem; public final class ModEntities { @@ -27,6 +29,8 @@ public final class ModEntities { EntityRegistry.registerModEntity(EntityDoppleganger.class, LibEntityNames.DOPPLEGANGER, id++, Botania.instance, 128, 3, true); EntityRegistry.registerModEntity(EntityMagicLandmine.class, LibEntityNames.MAGIC_LANDMINE, id++, Botania.instance, 128, 40, false); EntityRegistry.registerModEntity(EntitySpark.class, LibEntityNames.SPARK, id++, Botania.instance, 64, 10, false); + EntityRegistry.registerModEntity(EntityThrownItem.class, LibEntityNames.THROWN_ITEM, id++, Botania.instance, 64, 20, true); + } } diff --git a/MODSRC/vazkii/botania/common/item/ItemGravityRod.java b/MODSRC/vazkii/botania/common/item/ItemGravityRod.java new file mode 100644 index 000000000..8919d8c07 --- /dev/null +++ b/MODSRC/vazkii/botania/common/item/ItemGravityRod.java @@ -0,0 +1,246 @@ +/** + * This class was created by . 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 @ [Aug 25, 2014, 2:57:16 PM (GMT)] + */ +package vazkii.botania.common.item; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +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.EntityThrownItem; +import vazkii.botania.common.lib.LibItemNames; + +public class ItemGravityRod extends ItemMod implements IManaUsingItem { + + static final int COST = 1; //CHANGE THIS + + public ItemGravityRod() { + setMaxStackSize(1); + setUnlocalizedName(LibItemNames.GRAVITY_ROD); + } + + @Override + public void onUpdate(ItemStack stack, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); + } + if (!stack.stackTagCompound.hasKey("ticksTillExpire")) { + stack.stackTagCompound.setInteger("ticksTillExpire", 0); + } + if (!stack.stackTagCompound.hasKey("ticksCooldown")) { + stack.stackTagCompound.setInteger("ticksCooldown", 0); + } + int ticksTillExpire = stack.stackTagCompound.getInteger("ticksTillExpire"); + int ticksCooldown = stack.stackTagCompound.getInteger("ticksCooldown"); + + if (ticksTillExpire == 0) { + stack.stackTagCompound.setInteger("target", -1); + stack.stackTagCompound.setDouble("dist", -1); + } + + if (ticksCooldown > 0) { + ticksCooldown--; + } + ticksTillExpire--; + stack.stackTagCompound.setInteger("ticksTillExpire", ticksTillExpire); + stack.stackTagCompound.setInteger("ticksCooldown", ticksCooldown); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if (!stack.hasTagCompound()) { + stack.setTagCompound(new NBTTagCompound()); + } + if (!stack.stackTagCompound.hasKey("ticksTillExpire")) { + stack.stackTagCompound.setInteger("ticksTillExpire", 0); + } + if (!stack.stackTagCompound.hasKey("target")) { + stack.stackTagCompound.setInteger("target", -1); + } + if (!stack.stackTagCompound.hasKey("ticksCooldown")) { + stack.stackTagCompound.setInteger("ticksCooldown", 0); + } + if (!stack.stackTagCompound.hasKey("dist")) { + stack.stackTagCompound.setDouble("dist", -1); + } + int targetID = stack.stackTagCompound.getInteger("target"); + int ticksCooldown = stack.stackTagCompound.getInteger("ticksCooldown"); + double length = stack.stackTagCompound.getDouble("dist"); + //length = 15; + if (ticksCooldown == 0) { + Entity item = null; + if (targetID != -1 && player.worldObj.getEntityByID(targetID) != null) { + Entity taritem = player.worldObj.getEntityByID(targetID); + + boolean found = false; + Vector3 target = Vector3.fromEntityCenter(player); + List entities = new ArrayList(); + int distance = 1; + while (entities.size() == 0 && distance < 25) { + + final double range = 3F; + target.add(new Vector3(player.getLookVec()).multiply(distance)); + + target.y += 0.5; + entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(target.x - range, target.y - range, target.z - range, target.x + range, target.y + range, target.z + range)); + distance++; + if (entities.contains(taritem)) { + found = true; + } + } + + if (found) { + item = player.worldObj.getEntityByID(targetID); + } + + } + + if (item == null) + { + Vector3 target = Vector3.fromEntityCenter(player); + List entities = new ArrayList(); + int distance = 1; + while (entities.size() == 0 && distance < 25) { + + final double range = 3F; + target.add(new Vector3(player.getLookVec()).multiply(distance)); + + target.y += 0.5; + entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(target.x - range, target.y - range, target.z - range, target.x + range, target.y + range, target.z + range)); + distance++; + } + + if (entities.size() > 0) { + item = entities.get(0); +// Vector3 target2 = new Vector3(item.posX, item.posY, item.posZ); +// target2.subtract(Vector3.fromEntityCenter(player)); +// length = target2.mag(); +// length = Math.max(5, length); + length = 5.5D; + if (item instanceof EntityItem) { + length = 2.0D; + } + } + } + if (ManaItemHandler.requestManaExact(stack, player, COST, true) && item != null) { + if (item instanceof EntityItem) { + ((EntityItem)item).delayBeforeCanPickup = 5; + } + if (item instanceof EntityLivingBase) { + EntityLivingBase targetEntity = ((EntityLivingBase)item); + targetEntity.fallDistance = 0.0F; + if (targetEntity.getActivePotionEffect(Potion.moveSlowdown) == null) { + targetEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2, 3, true)); + } + } + Vector3 target3 = Vector3.fromEntityCenter(player); + target3.add(new Vector3(player.getLookVec()).multiply(length)); + target3.y += 0.5; + if (item instanceof EntityItem) { + target3.y += 0.25; + } + + setEntityMotionFromVector(item, target3, 0.3333F); + + stack.stackTagCompound.setInteger("target", item.getEntityId()); + stack.stackTagCompound.setDouble("dist", length); + } + + if (item != null) { + stack.stackTagCompound.setInteger("ticksTillExpire", 5); + } + } + return stack; + } + + public static void setEntityMotionFromVector(Entity entity, Vector3 originalPosVector, float modifier) { + Vector3 entityVector = Vector3.fromEntityCenter(entity); + Vector3 finalVector = originalPosVector.copy().subtract(entityVector); + + if (finalVector.mag() > 1) + finalVector.normalize(); + + entity.motionX = finalVector.x * modifier; + entity.motionY = finalVector.y * modifier; + entity.motionZ = finalVector.z * modifier; + } + + @Override + public boolean usesMana(ItemStack stack) { + return true; + } + + public static void leftClick(EntityPlayer player) { + ItemStack stack = player.getHeldItem(); + if (stack != null && stack.getItem() == ModItems.gravityRod) { + int targetID = stack.stackTagCompound.getInteger("target"); + double length = stack.stackTagCompound.getDouble("dist"); + Entity item = null; + if (targetID != -1 && player.worldObj.getEntityByID(targetID) != null) { + Entity taritem = player.worldObj.getEntityByID(targetID); + + boolean found = false; + Vector3 target = Vector3.fromEntityCenter(player); + List entities = new ArrayList(); + int distance = 1; + while (entities.size() == 0 && distance < 25) { + + final double range = 3F; + target.add(new Vector3(player.getLookVec()).multiply(distance)); + + target.y += 0.5; + entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(target.x - range, target.y - range, target.z - range, target.x + range, target.y + range, target.z + range)); + distance++; + if (entities.contains(taritem)) { + found = true; + } + } + + if (found) { + item = player.worldObj.getEntityByID(targetID); + stack.stackTagCompound.setInteger("target", -1); + stack.stackTagCompound.setDouble("dist", -1); + Vector3 moveVector = new Vector3(player.getLookVec().normalize()); + if (item instanceof EntityItem) { + ((EntityItem)item).delayBeforeCanPickup = 20; + item.motionX = moveVector.x * 1.5F; + item.motionY = moveVector.y * 1.0F; + item.motionZ = moveVector.z * 1.5F; + if (!player.worldObj.isRemote) { + EntityThrownItem thrown = new EntityThrownItem(item.worldObj, item.posX, item.posY, item.posZ, (EntityItem) item); + item.worldObj.spawnEntityInWorld(thrown); + } + item.setDead(); + } + else + { + item.motionX = moveVector.x * 3.0F; + item.motionY = moveVector.y * 1.5F; + item.motionZ = moveVector.z * 3.0F; + } + stack.stackTagCompound.setInteger("ticksCooldown", 10); + } + } + } + } +} \ No newline at end of file diff --git a/MODSRC/vazkii/botania/common/item/ModItems.java b/MODSRC/vazkii/botania/common/item/ModItems.java index fd471d4b2..e28774118 100644 --- a/MODSRC/vazkii/botania/common/item/ModItems.java +++ b/MODSRC/vazkii/botania/common/item/ModItems.java @@ -152,6 +152,7 @@ public final class ModItems { public static Item spark; public static Item sparkUpgrade; public static Item diviningRod; + public static Item gravityRod; public static void init() { lexicon = new ItemLexicon(); @@ -239,7 +240,8 @@ public final class ModItems { spark = new ItemSpark(); sparkUpgrade = new ItemSparkUpgrade(); diviningRod = new ItemDiviningRod(); - + gravityRod = new ItemGravityRod(); + OreDictionary.registerOre(LibOreDict.LEXICON, lexicon); for(int i = 0; i < 16; i++) { OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i)); diff --git a/MODSRC/vazkii/botania/common/lib/LibEntityNames.java b/MODSRC/vazkii/botania/common/lib/LibEntityNames.java index 262fc1f15..e2c5e9252 100644 --- a/MODSRC/vazkii/botania/common/lib/LibEntityNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibEntityNames.java @@ -23,5 +23,6 @@ public final class LibEntityNames { public static final String DOPPLEGANGER = LibResources.PREFIX_MOD + "doppleganger"; public static final String MAGIC_LANDMINE = LibResources.PREFIX_MOD + "magicLandmine"; public static final String SPARK = LibResources.PREFIX_MOD + "spark"; + public static final String THROWN_ITEM = LibResources.PREFIX_MOD + "thrownItem"; } diff --git a/MODSRC/vazkii/botania/common/lib/LibItemNames.java b/MODSRC/vazkii/botania/common/lib/LibItemNames.java index 547474a30..f76b8849c 100644 --- a/MODSRC/vazkii/botania/common/lib/LibItemNames.java +++ b/MODSRC/vazkii/botania/common/lib/LibItemNames.java @@ -98,6 +98,7 @@ public final class LibItemNames { public static final String SPARK = "spark"; public static final String SPARK_UPGRADE = "sparkUpgrade"; public static final String DIVINING_ROD = "diviningRod"; + public static final String GRAVITY_ROD = "gravityRod"; public static final String[] LENS_NAMES = new String[] { "lensNormal", diff --git a/MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java b/MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java new file mode 100644 index 000000000..233a7e4e1 --- /dev/null +++ b/MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java @@ -0,0 +1,48 @@ +/** + * This class was created by . 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(); + } + } + +} diff --git a/MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java b/MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java new file mode 100644 index 000000000..81c98201d --- /dev/null +++ b/MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java @@ -0,0 +1,49 @@ +/** + * This class was created by . 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; + } + } +} diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 4f556ac51..4a635abe2 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -1,4 +1,4 @@ -# MISC +# MISC itemGroup.Botania=Botania botaniamisc.nextPage=Next Page botaniamisc.prevPage=Previous Page @@ -704,6 +704,7 @@ item.botania:sparkUpgrade1.name=Spark Augment: Dominant item.botania:sparkUpgrade2.name=Spark Augment: Recessive item.botania:sparkUpgrade3.name=Spark Augment: Isolated item.botania:diviningRod.name=Rod of Divining +item.botania:gravityRod.name=Rod of the Black Mesa # GUI TEXT botania.gui.lexicon.header=Lexica Botania, %s Edition Table of Contents diff --git a/resources/assets/botania/textures/items/gravityRod.png b/resources/assets/botania/textures/items/gravityRod.png new file mode 100644 index 0000000000000000000000000000000000000000..9e2be85f0ac9ad5f0fb8232227cfe4789a527284 GIT binary patch literal 455 zcmeAS@N?(olHy`uVBq!ia0vp^0zhoQ!3HEH;(vt$DVB6cUq=Rpjs4tz5?O(K&H|6f zVg?4jLmRYB9d_VpRaVpxkz&-9B|Ij?v2x|RWeP8w^@Huh$6q;nq?cRho7agkcbqv; z6Xj;8*3lS~*Z=F`%O&#h=^2&l_^JbY)Od8yuRrqrc=HE?m#wcKe#_ebJE`6{MlNTq z+CSqr`8m8b0brMWebc=CX0=h>B?rAPCV}_a)wT&A+oHr+#l@8)uOq_Dd1XCKVnUuzSRtP_2-g%&JdaNyfPC&LK}d$~kz o*{$fmf55!q{@dpI9sFI7xF4HQ)jp00i_>zopr0EMTw;{X5v literal 0 HcmV?d00001 diff --git a/resources/assets/botania/textures/items/gravityRod.png.mcmeta b/resources/assets/botania/textures/items/gravityRod.png.mcmeta new file mode 100644 index 000000000..221cdbf40 --- /dev/null +++ b/resources/assets/botania/textures/items/gravityRod.png.mcmeta @@ -0,0 +1,19 @@ +{ + "animation": { + "frames": [ + { + "index": 0, + "time": 2 + }, { + "index": 1, + "time": 2 + }, { + "index": 2, + "time": 2 + }, { + "index": 1, + "time": 2 + } + ] + } +} \ No newline at end of file From 5c9d2dc067f29f3b3003b98bf548767a6bfc241e Mon Sep 17 00:00:00 2001 From: Flaxbeard Date: Sat, 30 Aug 2014 18:36:34 -0500 Subject: [PATCH 2/3] No more networking, +recipe and lexicon entry --- .../client/core/proxy/ClientProxy.java | 8 --- MODSRC/vazkii/botania/common/Botania.java | 3 -- .../core/handler/CommonTickHandler.java | 14 +----- .../common/core/proxy/CommonProxy.java | 7 --- .../common/crafting/ModCrafingRecipes.java | 9 ++++ .../botania/common/item/ItemGravityRod.java | 10 +++- .../botania/common/lexicon/LexiconData.java | 4 ++ .../vazkii/botania/common/lib/LibLexicon.java | 1 + .../network/BotaniaClientPacketHandler.java | 48 ------------------ .../network/BotaniaServerPacketHandler.java | 49 ------------------- resources/assets/botania/lang/en_US.lang | 5 ++ 11 files changed, 29 insertions(+), 129 deletions(-) delete mode 100644 MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java delete mode 100644 MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java diff --git a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java index 40b505f0c..92e19ae7f 100644 --- a/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/MODSRC/vazkii/botania/client/core/proxy/ClientProxy.java @@ -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(); diff --git a/MODSRC/vazkii/botania/common/Botania.java b/MODSRC/vazkii/botania/common/Botania.java index 78d1c7a81..b99414024 100644 --- a/MODSRC/vazkii/botania/common/Botania.java +++ b/MODSRC/vazkii/botania/common/Botania.java @@ -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); } diff --git a/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java b/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java index 156096467..e086071b3 100644 --- a/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java +++ b/MODSRC/vazkii/botania/common/core/handler/CommonTickHandler.java @@ -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) { diff --git a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java index da47fc2d3..73755b5f8 100644 --- a/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java +++ b/MODSRC/vazkii/botania/common/core/proxy/CommonProxy.java @@ -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(); diff --git a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java index 62513c24e..48fdf6dce 100644 --- a/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java +++ b/MODSRC/vazkii/botania/common/crafting/ModCrafingRecipes.java @@ -193,6 +193,7 @@ public final class ModCrafingRecipes { public static IRecipe recipeDiviningRod; public static List 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++) diff --git a/MODSRC/vazkii/botania/common/item/ItemGravityRod.java b/MODSRC/vazkii/botania/common/item/ItemGravityRod.java index 8919d8c07..71ca8fc39 100644 --- a/MODSRC/vazkii/botania/common/item/ItemGravityRod.java +++ b/MODSRC/vazkii/botania/common/item/ItemGravityRod.java @@ -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 diff --git a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java index 9ea9b2658..07b4ba77f 100644 --- a/MODSRC/vazkii/botania/common/lexicon/LexiconData.java +++ b/MODSRC/vazkii/botania/common/lexicon/LexiconData.java @@ -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")); diff --git a/MODSRC/vazkii/botania/common/lib/LibLexicon.java b/MODSRC/vazkii/botania/common/lib/LibLexicon.java index 4e493d55a..c259ade21 100644 --- a/MODSRC/vazkii/botania/common/lib/LibLexicon.java +++ b/MODSRC/vazkii/botania/common/lib/LibLexicon.java @@ -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"; diff --git a/MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java b/MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java deleted file mode 100644 index 233a7e4e1..000000000 --- a/MODSRC/vazkii/botania/common/network/BotaniaClientPacketHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This class was created by . 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(); - } - } - -} diff --git a/MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java b/MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java deleted file mode 100644 index 81c98201d..000000000 --- a/MODSRC/vazkii/botania/common/network/BotaniaServerPacketHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This class was created by . 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; - } - } -} diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 4a635abe2..f43ac84b4 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -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.
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 From ba90f2148c59e174a3d617d739e389cb694ffdce Mon Sep 17 00:00:00 2001 From: Flaxbeard Date: Sat, 30 Aug 2014 18:39:38 -0500 Subject: [PATCH 3/3] More documentation changes --- resources/assets/botania/lang/en_US.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index f43ac84b4..f3d85fe95 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -1394,8 +1394,8 @@ 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 +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. This power does not come free, of course. It requires significant amounts of &4Mana&0 from the user's inventory. +botania.page.gravityRod1=Why the flax? # - BAUBLES # -- AN INTRODUCTION TO BAUBLES