Started by
gustavowizard123
on
Topic category: Help with Minecraft modding (Java Edition)
so i notice when you use the procedure 'replace item in main hand', there is a animation and a sound (the item kinda go down and back up), i open the procedure code here, is there a way to turn OFF that animation?
Entity entity = (Entity) dependencies.get("entity");
double x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x");
double y = dependencies.get("y") instanceof Integer ? (int) dependencies.get("y") : (double) dependencies.get("y");
double z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z");
IWorld world = (IWorld) dependencies.get("world");
if (((world.getEntitiesWithinAABB(CreeperEntity.class,
new AxisAlignedBB(x - 20 / 2, y - 20 / 2, z - 20 / 2, x + 20 / 2, y + 20 / 2, z + 20 / 2), null).stream()
.sorted(Comparator.comparing(_ent -> _ent.getDistanceSq(x, y, z))).findFirst().orElse(null)) != null)) {
if (entity instanceof LivingEntity) {
ItemStack _setstack = new ItemStack(LifeDetectorONItem.block, (int) (1));
_setstack.setCount((int) 1);
((LivingEntity) entity).setHeldItem(Hand.MAIN_HAND, _setstack);
if (entity instanceof ServerPlayerEntity)
((ServerPlayerEntity) entity).inventory.markDirty();
}
if (((entity.getPersistentData().getDouble("lifedetectortick")) < 21)) {
entity.getPersistentData().putDouble("lifedetectortick", ((entity.getPersistentData().getDouble("lifedetectortick")) + 1));
} else {
entity.getPersistentData().putDouble("lifedetectortick", 0);
}
if (((entity.getPersistentData().getDouble("lifedetectortick")) == 10)) {
world.playSound(world.getWorld().isRemote ? Minecraft.getInstance().player : (PlayerEntity) null, new BlockPos(x, y, z),
(net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("wizardtech:beep_detect")),
SoundCategory.NEUTRAL, (float) 1, (float) 1);
}
} else {
entity.getPersistentData().putDouble("lifedetectortick", 0);
}
thanks in advance
I don't entirely know everything there is to know about coding, but if I had to guess, I suggest maybe cutting this bit out and see if it works. Back up your project first so that if it doesn't work, you can have it return to normal
new AxisAlignedBB(x - 20 / 2, y - 20 / 2, z - 20 / 2, x + 20 / 2, y + 20 / 2, z + 20 / 2), null).stream()
hum yeah i tried but give errors, i also tried to remove the hole section too
hmmmmmmm. I'll take a bit of a closer look at this, cuz I too am trying to stop the animation. But for some reason I keep losing where an items code section is . lol
lol
aight let me know here if you know something, i was noticing its indeed related with the procedure 'Replace item in Hand'
this can affect guns, lightsabers, and even this life detector i did (witch switch itens when detect the mob), they all use the 'Replace in Main Hand' procedure
Yep. It might take a bit as I have some school I need to do, but I will get back to ya when I do.
Ok i think I got it. So look at this bit of code
if (((entity.getPersistentData().getDouble("lifedetectortick")) < 21)) { entity.getPersistentData().putDouble("lifedetectortick",
((entity.getPersistentData().getDouble("lifedetectortick")) + 1)); } else { entity.getPersistentData().putDouble("lifedetectortick", 0); }
if (((entity.getPersistentData().getDouble("lifedetectortick")) == 10)) { world.playSound(world.getWorld().isRemote ?
Minecraft.getInstance().player : (PlayerEntity) null, new BlockPos(x, y, z),
look at the new BlockPos part. If you cut this part out, it should work. i could run a test for you. I just need to know what procedure it was under and what player hand its for.
i wonder if this could be related to the item usage animation with long-ranged weapons like u said. If so, then it will make getting my minigun finished cuz i don't like the animation while its in my hand.
lol i just notice the code changed after i got the new 2020.4 that part over there you are pointing just dont exist anymore, check it out:
oh btw that part here:
new AxisAlignedBB(x - 20 / 2, y - 20 / 2, z - 20 / 2, x + 20 / 2, y + 20 / 2, z + 20 / 2), null).stream()
that is the range of my life detector lol, it detect mobs 20 squares away (monsters), i was trying to mess around here :D
Ah lol. Darn. Sorry it didn't help. Does it still not work??
yeah i still dont know how to 'fix' that lol but thanks anyway :D, it happens when the item in main hand is replaced or when ranged weapons shot.
I'm trying to make a minigun and I can't get a good view to see how it looks cuz of that. -_-. if you figure it out, plz let me know. :P
you mean the translating when you are on first person view? are you using blockbench for your minigun model?