
MistPhizzle
Members-
Posts
24 -
Joined
-
Last visited
Everything posted by MistPhizzle
-
Hello, I was looking for a list of sounds and could not find one. I need a list of the strings IE "random.fizz". Anyone know where I could find one in the classes, or an online list?
-
Bump?
-
So, working with particles. (Not having much luck). How would I go about spawning the smoke particle in a moving sphere around a player. I'm an absolute noob when it comes to particles and can't find a tutorial for what I'm looking for.
-
Hello, so I have this structure. On this structure are two chests at two different locations. I can get the coordinates of where the chest spawns, but I need to add items to these chests as they spawn empty. How do I go about adding items to chests assuming I know the coordinates of them?
-
Structure Generation Help (Y Coordinate)
MistPhizzle replied to MistPhizzle's topic in Modder Support
That works, but now they are spawning a little too often for my taste ( every few blocks or so). How could I limit the amount per chunk? Code now looks like: private void generateSurface(World world, Random random, int i, int j) { int firstBlockXCoord = i + random.nextInt(16); // int firstBlockYCoord = random.nextInt(256); int firstBlockZCoord = j + random.nextInt(16); new AirTempleStructure().generate(world, random, firstBlockXCoord, world.getTopSolidOrLiquidBlock(firstBlockXCoord, firstBlockZCoord) - 1, firstBlockZCoord); } -
The Structure Itself: http://pastie.org/8306221 The Generation Class: http://pastie.org/8306224 Yes, the generator is registered. The blocks generate and all, my problem here is with the Y value. I have been testing generation in a super flat world (as it is pure grass / dirt) and find that the blocks are generating anywhere between levels 1-4, whereas I would like them to be above ground at all times. How do I get this to happen? I assume some changes need to be done with the Y value, I've tinkered with it here and there, and am still not getting the product I'd like. Thanks in advance.
-
I was using this schematic converter: http://www.minecraftforum.net/user/1460699-mithion/ That one was made for v1.3.2 and does not support any 1.6.2 blocks. Does anyone know of a newer one that works?
-
NBT Tag Help (Fetching it Client / Server Side)
MistPhizzle replied to MistPhizzle's topic in Modder Support
Thanks, +1! Once I figured out packets it was pretty straight forward. -
Alright, so I'm working on my mod and trying to launch a player in a certain direction. That works. However, I am only doing it when a player clicks and if they have an ability "selected". This simply checks if an ability is bound to their current slot. It is a bit complex, but I'll supply the necessary code. My problem: I want to check if the player has an Ability Bound. If they do, it runs a certain block of code. Here is the code that I want to run: @ForgeSubscribe public void onUpdate(LivingUpdateEvent e) { if (e.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) e.entity; if (BendingPlayerTracker.benders.get(player.username) == Element.Chi) { if (BendingMethods.knowsMove(player, Ability.HighJump) && BendingMethods.isAbilitySelected(player, Ability.HighJump)) { if (player.swingProgress == 0.8333333F) { while (BendingMethods.isAbilitySelected(player, Ability.HighJump)) { double motionX = 1.0 * (double) (-MathHelper.sin(player.rotationYaw/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI)); double motionZ = 1.0 * (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI)); double motionY = 1.0 * (double) (-MathHelper.sin((player.rotationPitch)/ 180.0F * (float) Math.PI) ); player.motionX = motionX; player.motionZ = motionZ; player.motionY = motionY; } } } } } } Everything in that chunk works except for BendingMethods.isAbilitySelected. It returns true 50% of the time, and false the other 50%. I added debug messages to get this. The Abilities and the slots they are on are stored server side. Here is the code for that: public static boolean isAbilitySelected(EntityPlayer player, Ability ability) { NBTTagCompound nbt = player.getEntityData().getCompoundTag(player.PERSISTED_NBT_TAG); int slot = player.inventory.currentItem + 1; if (nbt.getString("BendingSlot" + slot) != null && nbt.getString("BendingSlot" + slot).equals(ability.toString())) { return true; } return false; } The ability selected returns true if it is run on server side I believe. When I run a command, it returns true, etc. Anyway, I think the reason it is returning true 50% of the time is because it checks if it is client side and server side (with server side returning true and client side false). Now, the player motion is client side. How do I get these to work nicely together. I can assure you that the slot is bound correctly, as I've used it plenty of times before. My problem only comes up when I'm trying to use the player.motion methods. Huge thanks in advance.
-
I was looking at the player.worldObj.spawnParticle, and that seemed to do the trick. I'm more interested in knowing how to make particle effects last for some period of time (repeating (I assume with a for loop) and how to make them swirl around the player. (Possibly using a radius)
-
I am looking to play a particle effect around the player. How would I go about doing this. I would need a way to customize the type of particle (I am not looking into adding any new particles), the radius around the player it goes, and how long it goes. I was unable to find a tutorial on this stuff. Thanks in advance for any help.
-
Hello all, so I am trying to get the hot bar slot selected by a player. I noticed there was an NBT Tag for this, but it is always returning 0. Note: I am trying to get the slot number of the slot that the user currently has their hotbar on. Not the item in the slot. (Should return a number 0- My code: Thanks in advance.
-
Check the block a player lands on when they take fall damage
MistPhizzle replied to MistPhizzle's topic in Modder Support
It's working! Thanks, +1 -
Hello, how would I go about checking the block a player lands on when a player takes fall damage. I have the code for the event: @ForgeSubscribe public void onHurtEvent(LivingHurtEvent e) { if (e.entity instanceof EntityPlayer) { DamageSource source = e.source; EntityPlayer player = (EntityPlayer) e.entity; if (!player.worldObj.isRemote) { if (source == DamageSource.fall) { // Unsure of what to do here to check the block the player landed on. The idea is, if a player lands on a certain block, I want the damage to be set to 0. I know how to set the damage and all of that fun stuff.
-
Using PersistedNBTTag, now it isn't returning anything on my hasElement Method. Updated Code:
-
Yet another NBT issue. This time I'm running on the Server. Anywho, I have a custom NBT Tag for a player's element (That they choose after signing in), it works great and all. Once the player dies, the custom NBT tag is cleared. The Methods that set the NBT Tag initially: The Command Class (The one that calls the setElement method, the only one) Here's my Player Tracker: And lastly, the Element class: I think that's all the code that needs to be shown here, I can show more if needed. Thanks in advance.
-
The PlayerTracker Check @Override public void onPlayerLogin(EntityPlayer player) { if (BendingMethods.hasPlayed(player)) { player.addChatMessage("You've played before."); } else { player.addChatMessage("You have not played before."); player.getEntityData().setBoolean("BendingData.PlayedBefore", true); } } And the hasPlayed Method: public static boolean hasPlayed(EntityPlayer player) { if (player.getEntityData().hasKey("BendingData.PlayedBefore")) { return true; } else { return false; } } This is doing the same thing. Player1 signs on, it sends them the message that they have not played before, then sets the boolean to true. I log out, all is good. I sign in with a different username, say, Player2, and it tells Player2 that they have already played.
-
My hasElement Method looks like so: public static boolean hasElement(EntityPlayer player) { if (player.getEntityData().hasKey("Element")) { return true; } return false; } Is there any way to check if a player has ever played this world before? Was looking in the Forge Javadocs for something along the lines of player.hasPlayedBefore or whatever. (Bukkit has one and I'm much more used to Bukkit). If I can find a method to check if the player is new, then a "dummy" element could be set.
-
Hello everyone. I'm trying to set an NBT Tag for just one player. It works, but it also proceeds to set the same tag and value for each player that signs on afterward in this world. The setElement method: public static void setElement(EntityPlayer player, String element) { String Element = null; NBTTagCompound nbt = player.getEntityData(); if (Arrays.asList(BendingCommand.airbendingAliases).contains(element)) Element = "air"; if (Arrays.asList(BendingCommand.waterbendingAliases).contains(element)) Element = "water"; if (Arrays.asList(BendingCommand.earthbendingAliases).contains(element)) Element = "earth"; if (Arrays.asList(BendingCommand.firebendingAliases).contains(element)) Element = "fire"; if (Arrays.asList(BendingCommand.chiblockingAliases).contains(element)) Element = "chi"; nbt.setString("Element", Element); } The method is only called via the command, which can be found here: package com.etriacraft.bending; import java.util.Arrays; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChatMessageComponent; public class BendingCommand extends CommandBase { //Command Aliases public static String[] chooseAliases = {"choose", "ch", "c"}; public final static String[] airbendingAliases = { "air", "a", "airbender", "airbending", "airbend" }; public final static String[] earthbendingAliases = { "earth", "e", "earthbender", "earthbending", "earthbend" }; public final static String[] firebendingAliases = { "fire", "f", "firebender", "firebending", "firebend" }; public final static String[] waterbendingAliases = { "water", "w", "waterbender", "waterbending", "waterbend" }; public final static String[] chiblockingAliases = { "chi", "c", "chiblock", "chiblocker", "chiblocking" }; @Override public String getCommandName() { return "bending"; } @Override public String getCommandUsage(ICommandSender icommandsender) { // TODO Auto-generated method stub return null; } @Override public void processCommand(ICommandSender icommandsender, String[] args) { if (!(icommandsender instanceof EntityPlayer)) { return; } EntityPlayer player = (EntityPlayer) icommandsender; if (args.length == 0) { player.addChatMessage("§4/bending choose [element] §f- Picks an element."); player.addChatMessage("§4/bending who [Player] §f- Show a player's element."); return; } if (Arrays.asList(chooseAliases).contains(args[0])) { if (args.length != 2) { player.addChatMessage("§eProper Usage: /bending choose [Air|Water|Earth|Fire|Chi]"); return; } if (BendingMethods.hasElement(player)) { player.addChatMessage("§eYou already have an element."); return; } if (Arrays.asList(airbendingAliases).contains(args[1])) { BendingMethods.setElement(player, "air"); player.addChatMessage("§eYou are now an §7airbender."); BendingPlayerTracker.benders.put(player.username, "air"); return; } if (Arrays.asList(waterbendingAliases).contains(args[1])) { BendingMethods.setElement(player, "water"); player.addChatMessage("§eYou are now a §bwaterbender."); BendingPlayerTracker.benders.put(player.username, "water"); return; } if (Arrays.asList(earthbendingAliases).contains(args[1])) { BendingMethods.setElement(player, "earth"); player.addChatMessage("§eYou are now an §aearthbender."); BendingPlayerTracker.benders.put(player.username, "earth"); return; } if (Arrays.asList(firebendingAliases).contains(args[1])) { BendingMethods.setElement(player, "fire"); player.addChatMessage("§eYou are now a §cfirebender."); BendingPlayerTracker.benders.put(player.username, "fire"); return; } if (Arrays.asList(chiblockingAliases).contains(args[1])) { BendingMethods.setElement(player, "chi"); player.addChatMessage("§eYou are now a §6chiblocker."); BendingPlayerTracker.benders.put(player.username, "chi"); } else { player.addChatMessage("§eProper Usage: /bending choose Air|Water|Earth|Fire|Chi"); return; } } } } Anyway, this is using the latest Recommended version. The method works and it sets the element as it should. HOWEVER, every player that signs on after that player into that world will have that same element. Thanks in advance for any help.