Merge pull request #279 from Flaxbeard/master

Add Rod of the Black Mesa
This commit is contained in:
Lizbeth Rika committed 2014-08-31 00:40:38 +01:00
commit 79a64df65f
17 files changed
+459 -6

No files matched your search

@@ -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;
+3 -1
View File
@@ -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,7 +39,7 @@ public class Botania {
@SidedProxy(serverSide = LibMisc.PROXY_COMMON, clientSide = LibMisc.PROXY_CLIENT)
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
thaumcraftLoaded = Loader.isModLoaded("Thaumcraft");
@@ -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);
@@ -39,7 +39,7 @@ public final class CommonTickHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onTick(ClientTickEvent event) {
public void onTick(ClientTickEvent event) {
if(event.phase == Phase.END) {
World world = Minecraft.getMinecraft().theWorld;
if(world != null) {
@@ -83,7 +83,7 @@ public class CommonProxy {
FMLCommonHandler.instance().bus().register(new CommonTickHandler());
}
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++)
@@ -0,0 +1,149 @@
/**
* 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.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();
}
}
}
@@ -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);
}
}
@@ -0,0 +1,254 @@
/**
* 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 @ [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.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 {
static final int COST = 1; //CHANGE THIS
public ItemGravityRod() {
setMaxStackSize(1);
setUnlocalizedName(LibItemNames.GRAVITY_ROD);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity par3Entity, 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);
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
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<Entity> entities = new ArrayList<Entity>();
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<Entity> entities = new ArrayList<Entity>();
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<Entity> entities = new ArrayList<Entity>();
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);
}
}
}
}
}
@@ -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));
@@ -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"));
@@ -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";
}
@@ -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",
@@ -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";
+7 -1
View File
@@ -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
@@ -1391,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.<br>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
botania.entry.bIntro=An Introduction to Baubles
Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

@@ -0,0 +1,19 @@
{
"animation": {
"frames": [
{
"index": 0,
"time": 2
}, {
"index": 1,
"time": 2
}, {
"index": 2,
"time": 2
}, {
"index": 1,
"time": 2
}
]
}
}