mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-27 15:33:08 +00:00
Cloud amulets
This commit is contained in:
1 parent
682bd491f1
commit
b0fe481886
19 files changed
+292
-6
No files matched your search
@@ -87,8 +87,9 @@ public class MiscellaneousIcons {
|
||||
snowflakePendantGem,
|
||||
itemFinderGem,
|
||||
pyroclastGem,
|
||||
crimsonGem;
|
||||
|
||||
crimsonGem,
|
||||
cirrusGem,
|
||||
nimbusGem;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelBake(ModelBakeEvent evt) {
|
||||
@@ -167,6 +168,8 @@ public class MiscellaneousIcons {
|
||||
itemFinderGem = IconHelper.forName(evt.getMap(), "itemFinderGem", "items");
|
||||
pyroclastGem = IconHelper.forName(evt.getMap(), "lavaPendantGem", "items");
|
||||
crimsonGem = IconHelper.forName(evt.getMap(), "superLavaPendantGem", "items");
|
||||
cirrusGem = IconHelper.forName(evt.getMap(), "cloudPendantGem", "items");
|
||||
nimbusGem = IconHelper.forName(evt.getMap(), "superCloudPendantGem", "items");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -249,6 +249,8 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.icePendant);
|
||||
addItem(ModItems.lavaPendant);
|
||||
addItem(ModItems.superLavaPendant);
|
||||
addItem(ModItems.cloudPendant);
|
||||
addItem(ModItems.superCloudPendant);
|
||||
addItem(ModItems.invisibilityCloak);
|
||||
addItem(ModItems.holyCloak);
|
||||
addItem(ModItems.unholyCloak);
|
||||
|
||||
@@ -39,6 +39,7 @@ import vazkii.botania.common.item.equipment.bauble.ItemAuraRing;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemBalanceCloak;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemBaubleCosmetic;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemBloodPendant;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemCloudPendant;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemDivaCharm;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
@@ -59,6 +60,7 @@ 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.ItemSuperCloudPendant;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemSuperLavaPendant;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemSuperTravelBelt;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemSwapRing;
|
||||
@@ -271,6 +273,8 @@ public final class ModItems {
|
||||
public static Item baubleBox;
|
||||
public static Item dodgeRing;
|
||||
public static Item invisibilityCloak;
|
||||
public static Item cloudPendant;
|
||||
public static Item superCloudPendant;
|
||||
|
||||
public static void init() {
|
||||
lexicon = new ItemLexicon();
|
||||
@@ -421,7 +425,9 @@ public final class ModItems {
|
||||
baubleBox = new ItemBaubleBox();
|
||||
dodgeRing = new ItemDodgeRing();
|
||||
invisibilityCloak = new ItemInvisibilityCloak();
|
||||
|
||||
cloudPendant = new ItemCloudPendant();
|
||||
superCloudPendant = new ItemSuperCloudPendant();
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i));
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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 @ [22/10/2016, 17:31:04 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class CloudPendantShim extends ItemBauble {
|
||||
|
||||
public CloudPendantShim(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
super.onWornTick(stack, player);
|
||||
|
||||
clientWornTick(stack, player);
|
||||
}
|
||||
|
||||
public void clientWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public int getMaxAllowedJumps() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* 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 @ [22/10/2016, 16:52:36 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.BaublesApi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.item.IBaubleRender.Helper;
|
||||
import vazkii.botania.api.item.IBaubleRender.RenderType;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
import vazkii.botania.common.network.PacketJump;
|
||||
|
||||
public class ItemCloudPendant extends CloudPendantShim implements IBaubleRender {
|
||||
|
||||
private static int timesJumped;
|
||||
private static boolean jumpDown;
|
||||
|
||||
public ItemCloudPendant(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public ItemCloudPendant() {
|
||||
this(LibItemNames.CLOUD_PENDANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType(ItemStack arg0) {
|
||||
return BaubleType.AMULET;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void clientWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
if(player instanceof EntityPlayerSP && player == Minecraft.getMinecraft().thePlayer) {
|
||||
EntityPlayerSP playerSp = (EntityPlayerSP) player;
|
||||
UUID uuid = playerSp.getUniqueID();
|
||||
|
||||
if(playerSp.onGround)
|
||||
timesJumped = 0;
|
||||
else {
|
||||
if(playerSp.movementInput.jump) {
|
||||
if(!jumpDown && timesJumped < getMaxAllowedJumps()) {
|
||||
playerSp.jump();
|
||||
PacketHandler.sendToServer(new PacketJump());
|
||||
timesJumped++;
|
||||
}
|
||||
jumpDown = true;
|
||||
} else jumpDown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
|
||||
if(type == RenderType.BODY) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Helper.rotateIfSneaking(player);
|
||||
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null;
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(-0.36F, -0.3F, armor ? 0.2F : 0.15F);
|
||||
GlStateManager.rotate(-45F, 0F, 0F, 1F);
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
|
||||
TextureAtlasSprite gemIcon = MiscellaneousIcons.INSTANCE.cirrusGem;
|
||||
float f = gemIcon.getMinU();
|
||||
float f1 = gemIcon.getMaxU();
|
||||
float f2 = gemIcon.getMinV();
|
||||
float f3 = gemIcon.getMaxV();
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getIconWidth(), gemIcon.getIconHeight(), 1F / 32F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 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 @ [22/10/2016, 17:28:51 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.item.IBaubleRender.Helper;
|
||||
import vazkii.botania.api.item.IBaubleRender.RenderType;
|
||||
import vazkii.botania.client.core.handler.MiscellaneousIcons;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemSuperCloudPendant extends ItemCloudPendant {
|
||||
|
||||
public ItemSuperCloudPendant() {
|
||||
super(LibItemNames.SUPER_CLOUD_PENDANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAllowedJumps() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
|
||||
if(type == RenderType.BODY) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Helper.rotateIfSneaking(player);
|
||||
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) != null;
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(-0.36F, -0.3F, armor ? 0.2F : 0.15F);
|
||||
GlStateManager.rotate(-45F, 0F, 0F, 1F);
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
|
||||
TextureAtlasSprite gemIcon = MiscellaneousIcons.INSTANCE.nimbusGem;
|
||||
float f = gemIcon.getMinU();
|
||||
float f1 = gemIcon.getMaxU();
|
||||
float f2 = gemIcon.getMinV();
|
||||
float f3 = gemIcon.getMaxV();
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, gemIcon.getIconWidth(), gemIcon.getIconHeight(), 1F / 32F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,9 +46,9 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
|
||||
|
||||
public static final List<String> playersWithStepup = new ArrayList<>();
|
||||
|
||||
final float speed;
|
||||
final float jump;
|
||||
final float fallBuffer;
|
||||
public final float speed;
|
||||
public final float jump;
|
||||
public final float fallBuffer;
|
||||
|
||||
public ItemTravelBelt() {
|
||||
this(LibItemNames.TRAVEL_BELT, 0.035F, 0.2F, 2F);
|
||||
|
||||
@@ -162,6 +162,8 @@ public final class LibItemNames {
|
||||
public static final String BAUBLE_BOX = "baubleBox";
|
||||
public static final String DODGE_RING = "dodgeRing";
|
||||
public static final String INVISIBILITY_CLOAK = "invisibilityCloak";
|
||||
public static final String CLOUD_PENDANT = "cloudPendant";
|
||||
public static final String SUPER_CLOUD_PENDANT = "superCloudPendant";
|
||||
|
||||
public static final String[] LENS_NAMES = new String[] {
|
||||
"lensNormal",
|
||||
|
||||
@@ -20,6 +20,8 @@ public final class PacketHandler {
|
||||
HANDLER.registerMessage(PacketBotaniaEffect.Handler.class, PacketBotaniaEffect.class, id++, Side.CLIENT);
|
||||
HANDLER.registerMessage(PacketLeftClick.Handler.class, PacketLeftClick.class, id++, Side.SERVER);
|
||||
HANDLER.registerMessage(PacketDodge.Handler.class, PacketDodge.class, id++, Side.SERVER);
|
||||
HANDLER.registerMessage(PacketDodge.Handler.class, PacketDodge.class, id++, Side.SERVER);
|
||||
HANDLER.registerMessage(PacketJump.Handler.class, PacketJump.class, id++, Side.SERVER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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 @ [22/10/2016, 18:18:19 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.network;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.equipment.bauble.CloudPendantShim;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
|
||||
|
||||
public class PacketJump implements IMessage {
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {}
|
||||
|
||||
public static class Handler implements IMessageHandler<PacketJump, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketJump message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
player.mcServer.addScheduledTask(() -> {
|
||||
IInventory baublesInv = BaublesApi.getBaubles(player);
|
||||
ItemStack amuletStack = baublesInv.getStackInSlot(0);
|
||||
|
||||
if(amuletStack != null && amuletStack.getItem() instanceof CloudPendantShim) {
|
||||
player.addExhaustion(0.3F);
|
||||
player.fallDistance = 0;
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user