mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-14 01:14:18 +00:00
slimeBoots and slimeSling (#93)
* slimeBoots and slimeSling * changed items directories and some code * slime sling now with durability (100) * boots now reduce bounce instead of increasing it * added vanilla recipes * fix slimeSling and Slime Boots * removed debug logs * Reduced bounce distance to 20 blocks (up or away) * small fixes * structural recovery as was * add 100 durability to slime sling and slime boots * bs
This commit is contained in:
1 parent
9120091823
commit
f7c6a9ecaf
6 files changed
+95
-114
No files matched your search
@@ -17,7 +17,13 @@ import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.NetworkCheckHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
@@ -160,9 +166,6 @@ public class TConstruct {
|
||||
pulsar.registerPulse(new TinkerUBC());
|
||||
pulsar.registerPulse(new TinkerGears());
|
||||
pulsar.registerPulse(new TinkerRfTools());
|
||||
/*
|
||||
* pulsar.registerPulse(new TinkerPrayers()); pulsar.registerPulse(new TinkerCropify());
|
||||
*/
|
||||
|
||||
TConstructRegistry.materialTab = new TConstructCreativeTab("TConstructMaterials");
|
||||
TConstructRegistry.toolTab = new TConstructCreativeTab("TConstructTools");
|
||||
@@ -176,10 +179,7 @@ public class TConstruct {
|
||||
basinCasting = new LiquidCasting();
|
||||
chiselDetailing = new Detailing();
|
||||
|
||||
// GameRegistry.registerFuelHandler(content);
|
||||
|
||||
playerTracker = new TPlayerHandler();
|
||||
// GameRegistry.registerPlayerTracker(playerTracker);
|
||||
FMLCommonHandler.instance().bus().register(playerTracker);
|
||||
MinecraftForge.EVENT_BUS.register(playerTracker);
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(TConstruct.instance, proxy);
|
||||
|
||||
@@ -3,29 +3,51 @@ package tconstruct.armor;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import cpw.mods.fml.common.*;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.registry.*;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import mantle.pulsar.pulse.*;
|
||||
import mantle.pulsar.pulse.Handler;
|
||||
import mantle.pulsar.pulse.Pulse;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.blocks.DryingRack;
|
||||
import tconstruct.armor.items.*;
|
||||
import tconstruct.armor.items.ArmorBasic;
|
||||
import tconstruct.armor.items.DiamondApple;
|
||||
import tconstruct.armor.items.HeartCanister;
|
||||
import tconstruct.armor.items.Jerky;
|
||||
import tconstruct.armor.items.Knapsack;
|
||||
import tconstruct.armor.items.TravelBelt;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.armor.items.TravelGlove;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.library.crafting.*;
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.modifiers.accessory.GloveSpeed;
|
||||
import tconstruct.modifiers.armor.*;
|
||||
import tconstruct.modifiers.armor.AModBoolean;
|
||||
import tconstruct.modifiers.armor.AModInteger;
|
||||
import tconstruct.modifiers.armor.AModLeadBoots;
|
||||
import tconstruct.modifiers.armor.ActiveTinkerArmor;
|
||||
import tconstruct.modifiers.armor.TravelModDoubleJump;
|
||||
import tconstruct.modifiers.armor.TravelModRepair;
|
||||
import tconstruct.modifiers.tools.ModAttack;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
@@ -39,8 +61,6 @@ public class TinkerArmor {
|
||||
|
||||
public static Item diamondApple;
|
||||
public static Item jerky;
|
||||
// public static Item stonePattern;
|
||||
// public static Item netherPattern;
|
||||
public static Block dryingRack;
|
||||
// Wearables
|
||||
/*
|
||||
@@ -84,18 +104,9 @@ public class TinkerArmor {
|
||||
GameRegistry.registerItem(TinkerArmor.jerky, "jerky");
|
||||
|
||||
// Wearables
|
||||
// heavyHelmet = new TArmorBase(PHConstruct.heavyHelmet,
|
||||
// 0).setUnlocalizedName("tconstruct.HeavyHelmet");
|
||||
TinkerArmor.heartCanister = new HeartCanister().setUnlocalizedName("tconstruct.canister");
|
||||
// heavyBoots = new TArmorBase(PHConstruct.heavyBoots,
|
||||
// 3).setUnlocalizedName("tconstruct.HeavyBoots");
|
||||
// glove = new
|
||||
// Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
|
||||
TinkerArmor.knapsack = new Knapsack().setUnlocalizedName("tconstruct.storage");
|
||||
// GameRegistry.registerItem(TRepo.heavyHelmet, "heavyHelmet");
|
||||
GameRegistry.registerItem(TinkerArmor.heartCanister, "heartCanister");
|
||||
// GameRegistry.registerItem(TRepo.heavyBoots, "heavyBoots");
|
||||
// GameRegistry.registerItem(TRepo.glove, "glove");
|
||||
GameRegistry.registerItem(TinkerArmor.knapsack, "knapsack");
|
||||
|
||||
LiquidCasting basinCasting = TConstruct.getBasinCasting();
|
||||
@@ -124,6 +135,7 @@ public class TinkerArmor {
|
||||
travelBoots = (TravelGear) new TravelGear(ArmorPart.Feet).setUnlocalizedName("tconstruct.travelboots");
|
||||
travelGlove = (AccessoryCore) new TravelGlove().setUnlocalizedName("tconstruct.travelgloves");
|
||||
travelBelt = (AccessoryCore) new TravelBelt().setUnlocalizedName("tconstruct.travelbelt");
|
||||
|
||||
GameRegistry.registerItem(travelGoggles, "travelGoggles");
|
||||
GameRegistry.registerItem(travelVest, "travelVest");
|
||||
GameRegistry.registerItem(travelWings, "travelWings");
|
||||
@@ -163,9 +175,6 @@ public class TinkerArmor {
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
// GameRegistry.addRecipe(new ShapedOreRecipe(new
|
||||
// ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#',
|
||||
// "ingotNaturalAluminum"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 0),
|
||||
@@ -201,8 +210,6 @@ public class TinkerArmor {
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 2),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 3),
|
||||
new ItemStack(Items.golden_apple, 1, 1));
|
||||
// GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new
|
||||
// ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
@@ -234,7 +241,6 @@ public class TinkerArmor {
|
||||
|
||||
// Temporary recipes
|
||||
ItemStack leather = new ItemStack(Items.leather);
|
||||
ItemStack glass = new ItemStack(Blocks.glass);
|
||||
ItemStack string = new ItemStack(Items.string);
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
@@ -304,8 +310,6 @@ public class TinkerArmor {
|
||||
DryingRackRecipes.addDryingRecipe(Items.beef, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 0));
|
||||
DryingRackRecipes.addDryingRecipe(Items.chicken, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 1));
|
||||
DryingRackRecipes.addDryingRecipe(Items.porkchop, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 2));
|
||||
// DryingRackRecipes.addDryingRecipe(Item.muttonRaw, 20 * 60 * 5, new
|
||||
// ItemStack(TRepo.jerky, 1, 3));
|
||||
DryingRackRecipes.addDryingRecipe(Items.fish, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 4));
|
||||
DryingRackRecipes.addDryingRecipe(Items.rotten_flesh, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 5));
|
||||
DryingRackRecipes.addDryingRecipe(
|
||||
@@ -317,8 +321,6 @@ public class TinkerArmor {
|
||||
20 * 60 * 5,
|
||||
new ItemStack(TinkerArmor.jerky, 1, 7));
|
||||
|
||||
// DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.jerky, 1, 5),
|
||||
// 20 * 60 * 10, Item.leather);
|
||||
}
|
||||
|
||||
private void registerModifiers() {
|
||||
@@ -427,8 +429,6 @@ public class TinkerArmor {
|
||||
// Glove
|
||||
ModifyBuilder.registerModifier(
|
||||
new GloveSpeed(1, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
|
||||
// ModifyBuilder.registerModifier(new GloveClimb(new ItemStack[] { new ItemStack(Items.slime_ball), new
|
||||
// ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25) }));
|
||||
modAttackGlove = new ModAttack(
|
||||
"Quartz",
|
||||
2,
|
||||
@@ -437,6 +437,5 @@ public class TinkerArmor {
|
||||
50,
|
||||
50,
|
||||
"Accessory");
|
||||
// ModifyBuilder.registerModifier(modAttackGlove);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -20,8 +21,8 @@ import mantle.pulsar.pulse.Pulse;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.gadgets.item.ItemSlimeBoots;
|
||||
import tconstruct.gadgets.item.ItemSlimeSling;
|
||||
import tconstruct.library.SlimeBounceHandler;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
@Pulse(id = "Tinkers' Gadgets", description = "All the fun toys.", forced = true)
|
||||
public class TinkerGadgets {
|
||||
@@ -35,31 +36,37 @@ public class TinkerGadgets {
|
||||
|
||||
@Handler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
log.info("Pre Init");
|
||||
SlimeBounceHandler.init();
|
||||
slimeSling = registerItem(new ItemSlimeSling(), "slimesling");
|
||||
slimeBoots = registerItem(new ItemSlimeBoots(), "slime_boots");
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
log.info("Init");
|
||||
String ore = "blockSlime";
|
||||
if (!Loader.isModLoaded("dreamcraft")) {
|
||||
ItemStack slimeBlockGreen = new ItemStack(TinkerWorld.slimeGel, 1, 1);
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(slimeBoots), " ", "s s", "b b", 's', "slimeball", 'b', ore));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(slimeSling),
|
||||
"fbf",
|
||||
"s s",
|
||||
" s ",
|
||||
'f',
|
||||
Items.string,
|
||||
's',
|
||||
"slimeball",
|
||||
'b',
|
||||
ore));
|
||||
GameRegistry.addShapedRecipe(
|
||||
new ItemStack(slimeBoots),
|
||||
" ",
|
||||
"s s",
|
||||
"b b",
|
||||
's',
|
||||
Items.slime_ball,
|
||||
'b',
|
||||
slimeBlockGreen);
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(slimeSling),
|
||||
"fbf",
|
||||
"s s",
|
||||
" s ",
|
||||
'f',
|
||||
Items.string,
|
||||
's',
|
||||
Items.slime_ball,
|
||||
'b',
|
||||
slimeBlockGreen));
|
||||
}
|
||||
TConstructRegistry.gadgetsTab.init(new ItemStack(slimeBoots));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
super(SLIME_MATERIAL, 0, 3);
|
||||
this.setCreativeTab(TConstructRegistry.gadgetsTab);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(100);
|
||||
SLIME_MATERIAL.customCraftingMaterial = Items.slime_ball;
|
||||
armorPart = ArmorPart.Feet;
|
||||
textureFolder = "armor";
|
||||
@@ -57,7 +56,7 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
return armorType1 == 3;
|
||||
}
|
||||
|
||||
// equipping with rightclick
|
||||
// equipping with right click
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
|
||||
int slot = 1; // 0 = current item, 1 = feet
|
||||
@@ -67,7 +66,6 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
} else {
|
||||
itemstack = itemstack.copy();
|
||||
playerIn.setCurrentItemOrArmor(1, itemStackIn.copy());
|
||||
// playerIn.setCurrentItemOrArmor(0, itemstack);
|
||||
playerIn.entityDropItem(itemstack, 0);
|
||||
}
|
||||
itemStackIn.stackSize--;
|
||||
@@ -79,21 +77,17 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
// RUBBERY BOUNCY BOUNCERY WOOOOO
|
||||
public void onFall(LivingFallEvent event) {
|
||||
final EntityLivingBase living = event.entityLiving;
|
||||
// TinkerGadgets.log.info("Fall event.");
|
||||
// using fall distance as the event distance could be reduced by jump boost
|
||||
if (living == null || living.fallDistance <= 2f) {
|
||||
// TinkerGadgets.log.info("Invalid event.");
|
||||
return;
|
||||
}
|
||||
// can the entity bounce?
|
||||
if (!SlimeBounceHandler.hasSlimeBoots(living)) {
|
||||
// TinkerGadgets.log.info("No Boots.");
|
||||
return;
|
||||
}
|
||||
|
||||
// reduced fall damage when crouching
|
||||
if (living.isSneaking()) {
|
||||
// TinkerGadgets.log.info("Sneaking");
|
||||
event.distance = 1;
|
||||
return;
|
||||
}
|
||||
@@ -102,10 +96,8 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
event.setCanceled(true);
|
||||
// skip further client processing on players
|
||||
if (living.worldObj.isRemote) {
|
||||
// TinkerGadgets.log.info("Client Fall Handler.");
|
||||
living.playSound("mob.slime.small", 1f, 1f);
|
||||
SlimeBounceHandler.addBounceHandler(living);
|
||||
// TConstruct.packetPipeline.sendToServer(new BouncedPacket(living));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,17 +105,16 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
// velocity during the event, so we need to reverse engineer it
|
||||
Vec3 motion = SlimeBounceHandler.getMotion(living);
|
||||
if (living instanceof EntityPlayerMP) {
|
||||
// velocity is lost on server players, but we dont have to defer the bounce
|
||||
// velocity is lost on server players, but we don't have to defer the bounce
|
||||
double gravity = 0.2353455252;
|
||||
double time = Math.sqrt(living.fallDistance / gravity);
|
||||
double velocity = gravity * time;
|
||||
double velocity = gravity * time / 2;
|
||||
living.motionX = motion.xCoord / 0.95f;
|
||||
living.motionY = velocity;
|
||||
living.motionZ = motion.zCoord / 0.95f;
|
||||
living.velocityChanged = true;
|
||||
// preserve momentum
|
||||
SlimeBounceHandler.addBounceHandler(living);
|
||||
// TinkerGadgets.log.info("Player");
|
||||
} else {
|
||||
// for non-players, need to defer the bounce
|
||||
// only slow down half as much when bouncing
|
||||
@@ -131,9 +122,7 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
living.motionY = motion.yCoord * -0.9;
|
||||
living.motionZ = motion.zCoord / 0.95f;
|
||||
SlimeBounceHandler.addBounceHandler(living, SlimeBounceHandler.getMotion(living).yCoord);
|
||||
// TinkerGadgets.log.info("Not Player");
|
||||
}
|
||||
// TinkerGadgets.log.info("Server Fall Handler.");
|
||||
// update airborn status
|
||||
living.isAirBorne = true;
|
||||
living.onGround = false;
|
||||
@@ -143,7 +132,7 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,11 +172,13 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage,
|
||||
int slot) {
|
||||
return new ArmorProperties(0, armor.getItemDamage() / 100, 100);
|
||||
return new ArmorProperties(0, 0.1D, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {}
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {
|
||||
armor.damageItem(1, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -232,6 +223,11 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new FancyEntityItem(world, location, itemstack);
|
||||
|
||||
@@ -69,16 +69,6 @@ public class ItemSlimeSling extends Item {
|
||||
return;
|
||||
}
|
||||
|
||||
// copy chargeup code from bow \o/
|
||||
int i = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
float f = i / 20.0F;
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
f *= 4f;
|
||||
|
||||
if (f > 6f) {
|
||||
f = 6f;
|
||||
}
|
||||
|
||||
// check if player was targeting a block
|
||||
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
@@ -86,7 +76,11 @@ public class ItemSlimeSling extends Item {
|
||||
// we fling the inverted player look vector
|
||||
Vec3 vec = player.getLookVec().normalize();
|
||||
|
||||
player.addVelocity(vec.xCoord * -f, vec.yCoord * -f / 3f, vec.zCoord * -f);
|
||||
double itemUseDuration = (this.getMaxItemUseDuration(stack) - timeLeft);
|
||||
double power = Math.min(itemUseDuration / 20D, 1.8D);
|
||||
double height = Math.max(vec.yCoord * power * 2, -2D);
|
||||
|
||||
player.addVelocity(vec.xCoord * -power, -height, vec.zCoord * -power);
|
||||
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP) player;
|
||||
@@ -95,10 +89,20 @@ public class ItemSlimeSling extends Item {
|
||||
}
|
||||
player.playSound(TinkerGadgets.resource("slimesling"), 1f, 1f);
|
||||
SlimeBounceHandler.addBounceHandler(player);
|
||||
// TinkerCommons.potionSlimeBounce.apply(player);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import tconstruct.gadgets.TinkerGadgets;
|
||||
import tconstruct.gadgets.item.ItemSlimeBoots;
|
||||
|
||||
/** Logic for entities bouncing */
|
||||
@@ -36,16 +35,6 @@ public class SlimeBounceHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private SlimeBounceHandler() {
|
||||
TinkerGadgets.log.info("Created instance of Bounce Handler.");
|
||||
}
|
||||
|
||||
/** Registers event handlers */
|
||||
public static void init() {
|
||||
TinkerGadgets.log.info("Registering Bounce Handler.");
|
||||
registerEvent(new SlimeBounceHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Preserves entity air momentum
|
||||
*
|
||||
@@ -71,9 +60,7 @@ public class SlimeBounceHandler {
|
||||
if (hasSlimeBoots(entity)) {
|
||||
if (info == null) {
|
||||
BOUNCING_ENTITIES.put(entity, new BounceInfo(entity, bounce));
|
||||
TinkerGadgets.log.info("Created new BounceInfo for " + entity.getCommandSenderName());
|
||||
} else if (bounce != 0) {
|
||||
TinkerGadgets.log.info("Updating Bounce data?");
|
||||
// updated bounce if needed
|
||||
info.bounce = bounce;
|
||||
// add one to the tick as there is a 1 tick delay between falling and ticking
|
||||
@@ -98,33 +85,27 @@ public class SlimeBounceHandler {
|
||||
if (entity != null) {
|
||||
BounceInfo info = BOUNCING_ENTITIES.get(entity);
|
||||
|
||||
// TinkerGadgets.log.info("Bounce Data valid? "+(info != null));
|
||||
// if we have info for this entity, time to work
|
||||
if (info != null) {
|
||||
// TinkerGadgets.log.info("Found Bounce Data in tick handler.");
|
||||
// if flying, nothing to do
|
||||
if (entity.isDead || entity.noClip) {
|
||||
// TinkerGadgets.log.info("Removing Bounce Data.");
|
||||
BOUNCING_ENTITIES.remove(entity);
|
||||
return;
|
||||
}
|
||||
if (!hasSlimeBoots(entity)) {
|
||||
// TinkerGadgets.log.info("Removing Bounce Data. No Boots.");
|
||||
BOUNCING_ENTITIES.remove(entity);
|
||||
return;
|
||||
}
|
||||
|
||||
// if its the bounce tick, time to bounce. This is to circumvent the logic that
|
||||
// if it's the bounce tick, time to bounce. This is to circumvent the logic that
|
||||
// resets y motion after landing
|
||||
if (entity.ticksExisted == info.bounceTick) {
|
||||
TinkerGadgets.log.info("Bounce Tick?");
|
||||
entity.motionY = info.bounce;
|
||||
info.bounceTick = 0;
|
||||
}
|
||||
|
||||
boolean isInAir = !entity.onGround && !entity.isInWater() && !entity.isOnLadder();
|
||||
|
||||
// TinkerGadgets.log.info("In Air? "+isInAir);
|
||||
// preserve motion
|
||||
if (isInAir && info.lastMagSq > 0) {
|
||||
// figure out how much motion has reduced
|
||||
@@ -157,23 +138,18 @@ public class SlimeBounceHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TinkerGadgets.log.info("Did things? 1");
|
||||
|
||||
// timing the effect out
|
||||
if (info.wasInAir && !isInAir) {
|
||||
if (info.endHandler == 0) {
|
||||
info.endHandler = entity.ticksExisted + 5;
|
||||
} else if (entity.ticksExisted > info.endHandler) {
|
||||
// TinkerGadgets.log.info("Removing Bounce Data for "+entity.getCommandSenderName());
|
||||
BOUNCING_ENTITIES.remove(entity);
|
||||
}
|
||||
} else {
|
||||
info.endHandler = 0;
|
||||
info.wasInAir = true;
|
||||
}
|
||||
// TinkerGadgets.log.info("Did things? 2");
|
||||
} else {
|
||||
// TinkerGadgets.log.info("Bad Bounce Data.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +163,6 @@ public class SlimeBounceHandler {
|
||||
for (int i = 1; i < 5; i++) {
|
||||
ItemStack aBoots = entity.getEquipmentInSlot(i);
|
||||
if (aBoots != null && aBoots.getItem() instanceof ItemSlimeBoots) {
|
||||
// TinkerGadgets.log.info("Found boots in slot "+i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user