Jump to content

[1.8] Double jumping like they do on those server (ex: mineplex), and dmg help


Blakexx

Recommended Posts

So I have 2 things, one, I want to be able to add double jumping like on those servers for my mod, also, I have an ability that completely ignores armor and what mode you are in (meaning it kills people in creative). I could not find an entity.damge thing, here is the code for my ability

 

@Override

public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn,

EntityPlayer playerIn) {

playerIn.swingItem();

//System.out.println("swung");

for (int x = playerIn.getPosition().getX() - 3; x < playerIn.getPosition().getX() + 3; x++){

//System.out.println("inside x");

for (int y = playerIn.getPosition().getY() - 3; y < playerIn.getPosition().getY() + 3;y++){

for (int z = playerIn.getPosition().getZ() - 3; z < playerIn.getPosition().getZ() + 3; z++){

//System.out.println("Inside z");

for (Object o: worldIn.getLoadedEntityList()){

EntityLiving e;

//System.out.println("Inside entity check");

try {

e = (EntityLiving)o;

} catch (Exception ex){

continue;

}

if (e.equals(playerIn)) continue;

if (e.getPosition().getX() == x && e.getPosition().getY() == y && e.getPosition().getZ() == z){

e.performHurtAnimation();

e.setHealth(e.getHealth() - 8 );

Link to comment
Share on other sites

Sticks don't have their own class, so DamageTypes don't.  In fact, many damage types in Minecraft don't have a separate class.  However, the damage sources caused by entities are dynamic objects, created as needed based on the entity causing the damage and what (simple type) of damage it is.

 

You're free to create a new class if you want, it gives you a little extra flexibility such as being able to customize the death-by message,

func_151519_b

.  But the existing classes should be sufficient for your needs.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

also nvm again, made custom dmg source, but it does no dmg? Instead I get a long error in console.

It's hard to help you without seeing your latest code and the error. Post them on Gist or Pastebin and link them here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I understand what you are doing but that is not exactly what I am going for, basically I intend on using something to test if they are airborne (and yes I know there already is something for that), then let them fly for a short amount of time when they double tab space bar and then boost them where they are looking, but I hit a wall and deleted all my code like an idiot because where I was going was not going to work, I had a friend who worked with bukkit servers and that is how he said to do it, but he never explained how, so now I am stuck :P

Link to comment
Share on other sites

I understand what you are doing but that is not exactly what I am going for, basically I intend on using something to test if they are airborne (and yes I know there already is something for that), then let them fly for a short amount of time when they double tab space bar and then boost them where they are looking, but I hit a wall and deleted all my code like an idiot because where I was going was not going to work, I had a friend who worked with bukkit servers and that is how he said to do it, but he never explained how, so now I am stuck :P

Well you should have said that from the beginning, rather than just 'double-jump'.

 

What exactly do you mean by 'let them fly'? Like in Creative Mode, or only in a certain direction? Doesn't seem much like a double-jump if they can fly... What about this boost, does it trigger automatically after their fly-time is over, or is it another button press?

 

Anyway, the basic premise is exactly the same:

if (jump key pressed and entity already in air) { allow flying for short time; }

each tick:

if (fly time > 0) {decrement fly time; if (fly time is now zero) { boost in direction player is facing; }}

 

'Boosting' a player in a certain direction can be done simply by getting their look vector and then adding some multiple of that to their current motion values.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I made it by copying the properties of the soul one. How do I copy the block entity too? package net.Blue4X.Revive; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CampfireBlock; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import java.util.function.Supplier; import java.util.function.ToIntFunction; public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TheRevival.MODID); public static final RegistryObject<Block> BLOCK_CAMPFIRE = registerBlock( () -> new CampfireBlock(true, 4, BlockBehaviour.Properties.ofFullCopy(Blocks.SOUL_CAMPFIRE) .ignitedByLava() .noOcclusion() .lightLevel(litBlockEmission(15)) ) ); private static <T extends Block> RegistryObject<T> registerBlock(Supplier<T> block) { RegistryObject<T> toReturn = BLOCKS.register("block_campfire", block); registerBlockItem(toReturn); return toReturn; } private static <T extends Block> void registerBlockItem(RegistryObject<T> block) { ModItems.ITEMS.register("block_campfire", () -> new BlockItem(block.get(), new Item.Properties())); } public static void register(IEventBus EventBus) { BLOCKS.register(EventBus); } private static ToIntFunction<BlockState> litBlockEmission(int pLightValue) { return p_50763_ -> p_50763_.getValue(BlockStateProperties.LIT) ? pLightValue : 0; } } Minecraft 1.20.6 Forge 50.0.5
    • Help I turned on the xaeros minimap debug and the game crashed instantly and i cant seem to get into my server or even singleplayer as it crashes instantly, i tried to check from the minimap txt file and debug is set on false but still cant get in.  Heres the crash report: https://pastebin.com/HSWLC2tA Update: i can now get inside the world fine but when i try to open the minimap it crashes instantly. Heres the latest crash report as it seems different: https://pastebin.com/WqJnuEcR And i cant seem to figure out whats the problem
    • I Need help. I tried many things with a Developer from this server and we just dont know what to do. No one rn can find the error.  I Get kicked very often from a specific server with bc of this Exception. Does someone know the Reason? Pls help guys
    • Im currently trying to install forge to play some mods that are only avilable in 1.16.5, and since I would like it to work with OptiFine I downloaded the 36.1.0, installer, it didnt work, so I downloaded the recommended one, it still didint work, maybe the latest version? nop, will still not work, downloaded some more random versions that werent the ones I needed or recommended and it will still crash telling me "Something went wrong while installing: java.lang.NullPointerException" I keep trying and searching answers for this problem but they will just not work, I dont know what to do, and each answer is completely different, I dont understad why it doesnt work. I would really appreciate if somebody could give me an answer, if it works thanks, if it doesnt well at least you tried helping, thanks!   This is the installer.log in case you need it: JVM info: Oracle Corporation - 1.8.0_202 - 25.202-b08 java.net.preferIPv4Stack=true Current Time: 17/05/2024 07:44:51 Host: files.minecraftforge.net [172.67.161.211, 104.21.58.163] Host: maven.minecraftforge.net [104.21.58.163, 172.67.161.211] Host: libraries.minecraft.net [13.107.246.69, 13.107.213.69] Host: launchermeta.mojang.com [13.107.246.71, 13.107.213.71] Host: piston-meta.mojang.com [13.107.213.41, 13.107.246.41] Host: sessionserver.mojang.com [13.107.246.69, 13.107.213.69] Host: authserver.mojang.com [Unknown] java.lang.NullPointerException     at net.minecraftforge.installer.json.Util.readFully(Util.java:95)     at net.minecraftforge.installer.json.Util.loadInstallProfile(Util.java:30)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:178)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154)  
    • Hello, i have a problem with creating a modded server, i keep getting crashes and i don't understand what is the problem. I'm not an profesional at coding and i wanted to just play with few friends with some mods. I tried changing verions of forge server installer, like newest and the most recommended on forge server download page. i would be very thankfull if someone could help me.  I checked and whem im launching a game with the it works And im sorry for bad wording, enlgish isn't my first language.   This is the crash report.  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.