Work on Elytra upgrade.

Fixed Lava Crystals again
This commit is contained in:
WayofTime 2016-05-01 10:01:00 -04:00
parent 08de13b482
commit 41edd86602
4 changed files with 50 additions and 9 deletions

View file

@ -6,6 +6,7 @@ Version 2.0.0-35
- Started adding in the Alchemy Table... not really started.
- Changed it so that the Mending enchantment consumes the EXP before the Tome of Peritia does
- Added fall distance mitigation to the jump upgrade
- Fixed Lava Crystals... again.
------------------------------------------------------
Version 2.0.0-34

View file

@ -3,7 +3,6 @@ package WayofTime.bloodmagic.item;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.Item;
@ -15,6 +14,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
@ -31,7 +31,7 @@ public class ItemLavaCrystal extends ItemBindableBase implements IFuelHandler, I
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
NetworkHelper.getSoulNetwork(this.getOwnerName(itemStack)).syphon(25);
NetworkHelper.getSoulNetwork(this.getOwnerUUID(itemStack)).syphon(25);
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage());
copiedStack.stackSize = 1;
@ -61,6 +61,7 @@ public class ItemLavaCrystal extends ItemBindableBase implements IFuelHandler, I
// {
// return 200;
// }
// System.out.println(FMLCommonHandler.instance().getSide());
if (NetworkHelper.canSyphonFromContainer(fuel, 25))
{

View file

@ -1,11 +1,14 @@
package WayofTime.bloodmagic.item.armour;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelElytra;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.Entity;
@ -16,10 +19,12 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
@ -39,6 +44,9 @@ import com.google.common.collect.Multimap;
public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshProvider
{
private static Field _FLAGS = ReflectionHelper.findField(Entity.class, "FLAGS", "field_184240_ax");
private static DataParameter<Byte> FLAGS = null;
public static String[] names = { "helmet", "chest", "legs", "boots" };
public static final boolean useSpecialArmourCalculation = true;
@ -257,8 +265,42 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
{
super.onArmorTick(world, player, stack);
if (world.isRemote)
if (world.isRemote && this == ModItems.livingArmourChest)
{
if (player instanceof EntityPlayerSP) //Sanity check
{
EntityPlayerSP spPlayer = (EntityPlayerSP) player;
if (FLAGS == null)
{
ModelElytra d;
try
{
FLAGS = (DataParameter<Byte>) _FLAGS.get(null);
} catch (IllegalArgumentException e)
{
e.printStackTrace();
} catch (IllegalAccessException e)
{
e.printStackTrace();
}
}
if (FLAGS != null)
{
if (spPlayer.movementInput.jump && !spPlayer.onGround && spPlayer.motionY < 0.0D && !spPlayer.isElytraFlying() && !spPlayer.capabilities.isFlying)
{
byte b0 = player.getDataManager().get(FLAGS);
player.getDataManager().set(FLAGS, (byte) (b0 | 1 << 7));
} else if (spPlayer.isElytraFlying() && !spPlayer.movementInput.jump && !spPlayer.onGround)
{
byte b0 = player.getDataManager().get(FLAGS);
player.getDataManager().set(FLAGS, (byte) (b0 & ~(1 << 7)));
}
}
}
return;
}
@ -274,9 +316,6 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IMeshP
{
this.setIsEnabled(stack, true);
armour.onTick(world, player);
} else
{
this.setIsEnabled(stack, false);
}
setLivingArmour(stack, armour, false);

View file

@ -1,11 +1,11 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
public class LivingArmourUpgradeJump extends LivingArmourUpgrade
{