Everything posted by American2050
-
Play sound no associated to player location
Thanks both, gonna try. BTW I'm in 1.10 forgot to mention that. coolAlias I havent tested in Multiplayer yet, I do believe the way I'm creating the sound plays only on the client, and other players wont hear it, but I can't confirm that yet.
-
Play sound no associated to player location
I want to know if is it possible to play a sound, and keep it playing even if the player moves from the current location. Or in my case, when a player dies, if he click Respawn, the sound "stops playing" well, it actually still playing at the location where he died. world.playSound(null, pos, ModSounds.PLAYER_DEAD, SoundCategory.MASTER, 1.0F, 1.0F); I thought that using category Master was going to fix that, but it does not, I guess I have to trigger the sound on a different way?
-
java.lang.NoSuchMethodError "False positive"?
Yes it works now. If I remember correctly I think time ago something similar happened, also with this ToolMaterial thing.
-
java.lang.NoSuchMethodError "False positive"?
I was trying my mod on MultiMC and I got this error on console java.lang.NoSuchMethodError: net.minecraft.item.Item$ToolMaterial.getMaxUses() Then I go back to eclipse, try the mod and it launchs without errors, then I build it again, try it again on MultiMC and it does launch ok. What could be happening? The error came from this lines of code mainly: private static final ToolMaterial STICK = EnumHelper.addToolMaterial("STICK", 0, 353, 2.0F, 0.0F, 15); public static final Item fake_dongle = new FakeDongle(STICK, "fake_dongle"); And on FakeDongle public FakeDongle(ToolMaterial material, String name) { // super(material); this.maxStackSize = 1; this.setMaxDamage(material.getMaxUses()); this.setRegistryName(name); this.setUnlocalizedName(ModInfo.MODID.toLowerCase() + ":" + name); }
-
[1.10] onUpdate and onItemUse
Thanks you, I will do some experimentation This turned out to be more complicate of what I thought.
-
[1.10] onUpdate and onItemUse
It's a Warering Dongle (My version of a watering can, you may be familiar with those) When use (Right click) it waters the area in a 3x3x3 around the block you pointing at. The new feature I want to add is that when you press Control (Any key can be configured for it already) the can "Locks" (If the player is holding it) and I check with the onUpdate method if the can is locked, if so, it gets a glowing effect, like enchanted (It really it that) and it waters the 3x3x3 area around the block the player is looking at without the need of the player holding right click. All that works the way I described, problem is that the way I coded it, a 2nd watering dongle on inventory will return that the player isn't holding it, so it never locks.
-
[1.10] onUpdate and onItemUse
Ohhh ok, I have to work with NBTTagCompounds :'( let the headhaches begin, I'm so confused about those... I guess I will have to learn someday. As a general idea, what I should do is check if the player is holding my item when he presses the trigger key, and if it's true write to nbt something that says he is holding my item and then I check holding and that value I write in the NBT? That will ensure that another item of the same in inventory, but not holding by player will turn it off again right? Sorry if it gets confuse, I'm not even sure the steps I should go thru
-
[1.10] onUpdate and onItemUse
On the ItemStack? Not sure how to do that I did it on the item, and I see the problems already, it messes when the player has more than 1 of my item on inventory, even when the max stack size is 1, they conflict eachother. Having 1 item, it works perfectly, but when having 2 the problems start... Can you elaborate on how should I do it? Thanks a lot.
-
[SOLVED][1.8.9] How do you detect whether the player is looking up or down?
I see you want it for a 3x3 pick. This is what I did for my hammer in a mod I'm working on. Inside the "onBlockDestroyed" get the MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, (EntityPlayer) playerIn, flag); And then you can switch "movingobjectposition.sideHit"
-
[1.10] onUpdate and onItemUse
Can I delay the onUpdate using an if statement that works only when X is equal to 4, and update that value from 1 to 4 on each update?
-
[SOLVED][1.8.9] How do you detect whether the player is looking up or down?
I wouldn't use where the player is looking at, as you can be looking up and still hit a block from the sides. Get where he hit the block mined, that side is better to use.
-
[1.10] onUpdate and onItemUse
I have a question, about something I have noticed and not sure how this works. Is the method onUpdate called more times in comparison with the onItemUse? have an item that does one thing with the player right clicks it, and it also has a "lock" to do the same thing without needing to right click the item, and for that I'm using the onUpdate. However, when "locked" (meaning, its using the onUpdate to do it's things) it works much faster. Is this intended? And if so, how can I slow down the onUpdate so it matches the speed that it would have when onItemUse?
-
[1.10] Add drops to mob death event
Got you
-
[1.10] Add drops to mob death event
That's why I'm confuse, I did used the variable on my first post. Entity entity = event.getEntity(); World world = event.getEntity().getEntityWorld(); BlockPos pos = event.getEntity().getPosition(); I did used entity, world and pos. None of them are unused. If you mean that what I should have created is a Class class = event.getEntity().getClass(); That's something I did missed.
-
[1.10] Add drops to mob death event
Jesus fucking christ. The opposite of this. Now I'm just more confuse, I really don't understand what you pointing at, and what you think I'm doing wrong / should do different.
-
[1.10] Add drops to mob death event
Whut??? Entity entity = event.getEntity(); World world = entity .getEntityWorld(); I see that, would it really matter? What reference you talking about? Entity entity This is a reference. If you don't use it, you're wasting space in the JVM stack. By calling getEntity() over and over again, you're wasting execution speed on bytes that are irrelevant (because the result is already stored in a local variable). Try to pretend that getEntity() takes 2 days to execute. You don't mind your program taking a day or two to execute, but a week would be too long. How many times would you call getEntity() then? So the best practice would be: if(event.getEntity().getClass() == MobsReference.VANILLA_ZOMBIE) and... doDrop(event, event.getEntity().getEntityWorld(), itemDropX, ChancesControl.ZOMBIE_BY_HUMAN, ChancesControl.ZOMBIE_BY_OTHER, killedByPlayer); And not create "entity" and "world"?
-
[1.10] Add drops to mob death event
So I can reference the mobs with the names on the registry, even if I don't know the class they belong to. At least I think that's why it was done like that on the old 1.7.10 mod I told you.
-
[1.9.4] Crash on Item Registering
On preInit you have "items.initItems();" shouldn't that be "CCitems.initItems();"
-
[1.10] Add drops to mob death event
Ohhh ok, I shouldn't be using .equals() in this cases? Not sure why, but thanks you
-
[1.10] Add drops to mob death event
So I don't know how to use instanceof in this case... Been: MobsReference public static final Class VANILLA_ZOMBIE = (Class) EntityList.NAME_TO_CLASS.get("Zombie"); How would I go about getting the entity to see if it's an instanceof the entity on the die event later on? And why would it be better to use instanceof? I lose control as you said, and any mod that extends a Minecraft Zombie will also drop my items, using the equals gives me control to set a different drop for that mod mob.
-
[1.10] Add drops to mob death event
Whut??? Entity entity = event.getEntity(); World world = entity .getEntityWorld(); I see that, would it really matter? What reference you talking about?
-
[1.10] Add drops to mob death event
Oh god why? Please use entity instanceof EntityZombie - it will be more performant and also not exclude mod-mobs that are zombies. I did that so I can also reference Mobs from other mods in the near future. Is there a better way? That's what worked for me on a 1.7.10 Mod I "did" (Continued the updates) time ago. Example: If I use instanceof I wont be able to reference "KingSlime" A mob from the Aether mod, or "demonmobs.rahovart" a Boss Mob from Lycanites Mobs.
-
[1.10] Add drops to mob death event
I'm curious about how this works. I am "monitoring" when mobs dies, and I want to add drops to their list. This is what I'm doing, the "problem" is that I'm not sure, will this guarantee the drop 100% the time? Is there a way to pass a % chance of dropping the added item. PS: Would it be ok to spawn the item on the world, so I can add a chance % there? @SubscribeEvent public void onLivingDropsEvent(LivingDropsEvent event) { Entity entity = event.getEntity(); World world = event.getEntity().getEntityWorld(); BlockPos pos = event.getEntity().getPosition(); if(entity.getClass().equals(MobsReference.VANILLA_ZOMBIE)){ EntityItem itemDropX = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, ItemsReference.IRON_ORE.copy()); // world.spawnEntityInWorld(itemDropX); event.getDrops().add(itemDropX); } }
-
Achievement Event working correctly?
Yes, but this is the problem, for example, where you comment Not necessarily as the event will trigger on getting wood, even if the player didn't open the inventory yet. So "((EntityPlayer) event.getEntity()).hasAchievement(a))" will return false, as they don't have the achievement of getting wood, and he wont get the achievement right now, because he needs to open inventory first. That's what I don't know how to check.
-
Achievement Event working correctly?
It would make easier to determine when an achievement is "just been get" I thought of doing something like this: But this wont fix it, as it will return true, for example, every time I get wood, because it's right, I didn't got the achievement get wood, but I didn't open my inventory neither for example, so I guess there should be another way to check if the event is resulting on a "positive" achievement get. For the way the Event is described, I do think it would be good to pull a request for either a fix, or a new method, or maybe a new boolean on the method returning if the event actually fired an achievement got. PS: Where should I look for this on the meanwhile?
IPS spam blocked by CleanTalk.