Planestrider's Sash

This commit is contained in:
Vasco Lavos committed 2015-11-24 23:46:57 +00:00
1 parent fa359c10fb
commit 11ec7a5b66
12 files changed
+123 -4

No files matched your search

@@ -104,6 +104,7 @@ public final class LibResources {
public static final String MODEL_BREWERY = PREFIX_MODEL + "brewery.png";
public static final String MODEL_TRAVEL_BELT = PREFIX_MODEL + "travelBelt.png";
public static final String MODEL_SUPER_TRAVEL_BELT = PREFIX_MODEL + "superTravelBelt.png";
public static final String MODEL_SPEED_UP_BELT = PREFIX_MODEL + "speedUpBelt.png";
public static final String MODEL_KNOCKBACK_BELT = PREFIX_MODEL + "knockbackBelt.png";
public static final String MODEL_HOLY_CLOAK = PREFIX_MODEL + "holyCloak.png";
public static final String MODEL_UNHOLY_CLOAK = PREFIX_MODEL + "unholyCloak.png";
@@ -239,6 +239,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.pixieRing);
addItem(ModItems.travelBelt);
addItem(ModItems.superTravelBelt);
addItem(ModItems.speedUpBelt);
addItem(ModItems.knockbackBelt);
addItem(ModItems.itemFinder);
addItem(ModItems.monocle);
@@ -306,6 +306,7 @@ public final class ModCraftingRecipes {
public static IRecipe recipeAvatar;
public static IRecipe recipeSextant;
public static List<IRecipe> recipesAltGrassSeeds;
public static IRecipe recipeSpeedUpBelt;
// Garden of Glass
public static IRecipe recipeRootToSapling;
@@ -2063,6 +2064,15 @@ public final class ModCraftingRecipes {
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.grassSeeds, 1, 8), new ItemStack(ModItems.grassSeeds), new ItemStack(Items.spider_eye));
recipesAltGrassSeeds = BotaniaAPI.getLatestAddedRecipes(6);
// Planestrider's Sash Recipe
GameRegistry.addRecipe(new ItemStack(ModItems.speedUpBelt),
" M ", "PBP", " S ",
'M', new ItemStack(Items.filled_map, 1, Short.MAX_VALUE),
'P', new ItemStack(ModItems.grassSeeds),
'B', new ItemStack(ModItems.travelBelt),
'S', new ItemStack(Items.sugar));
recipeSpeedUpBelt = BotaniaAPI.getLatestAddedRecipe();
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Storage Block/Nugget Recipes
@@ -55,6 +55,7 @@ import vazkii.botania.common.item.equipment.bauble.ItemMiningRing;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.item.equipment.bauble.ItemPixieRing;
import vazkii.botania.common.item.equipment.bauble.ItemReachRing;
import vazkii.botania.common.item.equipment.bauble.ItemSpeedUpBelt;
import vazkii.botania.common.item.equipment.bauble.ItemSuperLavaPendant;
import vazkii.botania.common.item.equipment.bauble.ItemSuperTravelBelt;
import vazkii.botania.common.item.equipment.bauble.ItemSwapRing;
@@ -266,6 +267,7 @@ public final class ModItems {
public static Item autocraftingHalo;
public static Item gaiaHead;
public static Item sextant;
public static Item speedUpBelt;
public static void init() {
lexicon = new ItemLexicon();
@@ -414,6 +416,7 @@ public final class ModItems {
autocraftingHalo = new ItemAutocraftingHalo();
gaiaHead = new ItemGaiaHead();
sextant = new ItemSextant();
speedUpBelt = new ItemSpeedUpBelt();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
@@ -0,0 +1,73 @@
/**
* This class was created by <Vazkii>. 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 the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [24/11/2015, 22:50:29 (GMT)]
*/
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lib.LibItemNames;
public class ItemSpeedUpBelt extends ItemTravelBelt {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_SPEED_UP_BELT);
private static final String TAG_SPEED = "speed";
private static final String TAG_OLD_X = "oldX";
private static final String TAG_OLD_Y = "oldY";
private static final String TAG_OLD_Z = "oldZ";
public ItemSpeedUpBelt() {
super(LibItemNames.SPEED_UP_BELT, 0F, 0.2F, 2F);
}
@Override
public ResourceLocation getRenderTexture() {
return texture;
}
@Override
public float getSpeed(ItemStack stack) {
return ItemNBTHelper.getFloat(stack, TAG_SPEED, 0F);
}
@Override
public void onMovedTick(ItemStack stack, EntityPlayer player) {
float speed = getSpeed(stack);
float newspeed = Math.min(0.25F, speed + 0.00035F);
ItemNBTHelper.setFloat(stack, TAG_SPEED, newspeed);
commitPositionAndCompare(stack, player);
}
@Override
public void onNotMovingTick(ItemStack stack, EntityPlayer player) {
if(!commitPositionAndCompare(stack, player))
ItemNBTHelper.setFloat(stack, TAG_SPEED, 0F);
}
public boolean commitPositionAndCompare(ItemStack stack, EntityPlayer player) {
if(player.worldObj.isRemote)
return true;
double oldX = ItemNBTHelper.getDouble(stack, TAG_OLD_X, 0);
double oldY = ItemNBTHelper.getDouble(stack, TAG_OLD_Y, 0);
double oldZ = ItemNBTHelper.getDouble(stack, TAG_OLD_Z, 0);
ItemNBTHelper.setDouble(stack, TAG_OLD_X, player.posX);
ItemNBTHelper.setDouble(stack, TAG_OLD_Y, player.posY);
ItemNBTHelper.setDouble(stack, TAG_OLD_Z, player.posZ);
return Math.abs(oldX - player.posX) > 0.001 || Math.abs(oldY - player.posY) > 0.001 || Math.abs(oldZ - player.posZ) > 0.001;
}
}
@@ -79,15 +79,21 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
ItemStack belt = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
if(playersWithStepup.contains(s)) {
if(shouldPlayerHaveStepup(player)) {
if((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F && !player.isInsideOfMaterial(Material.water))
player.moveFlying(0F, 1F, player.capabilities.isFlying ? ((ItemTravelBelt) belt.getItem()).speed : ((ItemTravelBelt) belt.getItem()).speed * 2);
ItemTravelBelt beltItem = (ItemTravelBelt) belt.getItem();
if((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F && !player.isInsideOfMaterial(Material.water)) {
float speed = beltItem.getSpeed(belt);
player.moveFlying(0F, 1F, player.capabilities.isFlying ? speed : speed);
beltItem.onMovedTick(belt, player);
if(player.ticksExisted % COST_INTERVAL == 0)
ManaItemHandler.requestManaExact(belt, player, COST, true);
} else beltItem.onNotMovingTick(belt, player);
if(player.isSneaking())
player.stepHeight = 0.50001F; // Not 0.5F because that is the default
else player.stepHeight = 1F;
if(player.ticksExisted % COST_INTERVAL == 0)
ManaItemHandler.requestManaExact(belt, player, COST, true);
} else {
player.stepHeight = 0.5F;
playersWithStepup.remove(s);
@@ -98,6 +104,18 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
}
}
}
public float getSpeed(ItemStack stack) {
return speed;
}
public void onMovedTick(ItemStack stack, EntityPlayer player) {
// NO-OP
}
public void onNotMovingTick(ItemStack stack, EntityPlayer player) {
// NO-OP
}
@SubscribeEvent
public void onPlayerJump(LivingJumpEvent event) {
@@ -250,6 +250,7 @@ public final class LexiconData {
public static LexiconEntry judgementCloaks;
public static LexiconEntry monocle;
public static LexiconEntry swapRing;
public static LexiconEntry speedUpBelt;
public static LexiconEntry alfhomancyIntro;
public static LexiconEntry elvenMessage;
@@ -951,6 +952,9 @@ public final class LexiconData {
swapRing = new BLexiconEntry(LibLexicon.BAUBLE_SWAP_RING, categoryBaubles);
swapRing.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeSwapRing));
speedUpBelt = new BLexiconEntry(LibLexicon.BAUBLE_SPEED_UP_BELT, categoryBaubles);
speedUpBelt.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeSpeedUpBelt));
// ALFHOMANCY ENTRIES
alfhomancyIntro = new BLexiconEntry(LibLexicon.ALF_INTRO, categoryAlfhomancy);
alfhomancyIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeAlfPortal), new PageCraftingRecipe("3", ModCraftingRecipes.recipeNaturaPylon), new PageMultiblock("4", ModMultiblocks.alfPortal),
@@ -159,6 +159,7 @@ public final class LibItemNames {
public static final String AUTOCRAFTING_HALO = "autocraftingHalo";
public static final String GAIA_HEAD = "gaiaHead";
public static final String SEXTANT = "sextant";
public static final String SPEED_UP_BELT = "speedUpBelt";
public static final String[] LENS_NAMES = new String[] {
"lensNormal",
@@ -221,6 +221,7 @@ public final class LibLexicon {
public static final String BAUBLE_JUDGEMENT_CLOAKS = "judgementCloaks";
public static final String BAUBLE_MONOCLE = "monocle";
public static final String BAUBLE_SWAP_RING = "swapRing";
public static final String BAUBLE_SPEED_UP_BELT = "speedUpBelt";
public static final String ALF_INTRO = "aIntro";
public static final String ALF_MESSAGE = "elfMessage";