Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] How do I extend the attack reach of a player?


Recommended Posts

I've asked around a bunch on the discords and have gotten a lot of mixed answers. So, I'm wondering what would be the best way to extend the attack reach of a player? I've tried extending the reach attribute, but it seems to only affect blocks.

Edited by Nozzomi
Link to post
Share on other sites

AFAIK there is no default way to increase the reach range for entity.

You will have to do your own recasting on the client side (basically simulate what vanilla Minecraft does).

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to post
Share on other sites
8 minutes ago, DavidM said:

AFAIK there is no default way to increase the reach range for entity.

You will have to do your own recasting on the client side (basically simulate what vanilla Minecraft does).

Ah, that's unfortunate. How would I go about doing that (honestly, ray casting in general)? When I'm looking at the vanilla code, a method that I'm finding for that gets its information from the CUseEntityPacket parameter.

Link to post
Share on other sites
On 3/21/2020 at 7:09 AM, Nozzomi said:

Ah, that's unfortunate. How would I go about doing that (honestly, ray casting in general)? When I'm looking at the vanilla code, a method that I'm finding for that gets its information from the CUseEntityPacket parameter.

Can you give us some of the answers uve got from the discord servers, I'm still trying to do that but without success.

Link to post
Share on other sites
  • 4 weeks later...
41 minutes ago, DragonITA said:

Why not use coremods?

Because it is not necessary in this case.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to post
Share on other sites

I think i have a better idea now: @Nozzomi, idk and not seed the vanilla method, but you can try to use a event (if the player for example use its hand) and if the RayTracing uses vectors, then add a scalar to this vector. If you dk what vectors are (and if the VanillaRaytracing uses and/or return a vector) then here is a page: https://www.mathsisfun.com/algebra/vectors-dot-product.html

New in Modding? == Still learning!

Link to post
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.

Guest
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.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Done..... https://github.com/DefDaemon/Daemons_Horror_Moon Thnx for the advise
    • First of all, do not use @OnlyIn. The Callable must be in a separate class.
    • Can you explain better? This is my class where i register the blocks and relative itemblocks: package com.ike.tenchest; import com.ike.tenchest.basechest.BaseChestItemStackRenderer; import com.ike.tenchest.colossalchest.ColossalChest; import com.ike.tenchest.colossalchest.ColossalChestPart; import com.ike.tenchest.drillchest.DrillChest; import com.ike.tenchest.invisiblechest.InvisibleChest; import com.ike.tenchest.lootchest.LootChest; import com.ike.tenchest.lootchest.LootChestTileEntity; import com.ike.tenchest.minichest.MiniChest; import com.ike.tenchest.monsterchest.MonsterChest; import com.ike.tenchest.pitfallchest.PitfallChest; import com.ike.tenchest.pocketdimensionchest.PocketDimensionChest; import com.ike.tenchest.pocketdimensionchest.PocketDimensionChestTileEntity; import com.ike.tenchest.smeltingchest.SmeltingChest; import com.ike.tenchest.smeltingchest.SmeltingChestTileEntity; import com.ike.tenchest.teleportchest.TeleportChest; import com.ike.tenchest.teleportchest.TeleportChestTileEntity; import com.ike.tenchest.trapchest.TrapChest; import net.minecraft.block.Block; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.tileentity.ChestTileEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.IModBusEvent; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import java.util.concurrent.Callable; import java.util.function.Function; import java.util.function.Supplier; /** * @author Ike * @version 1.0A **/ @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class Blocks implements IModBusEvent { public static final DeferredRegister<Block> BLOCKS; public static final DeferredRegister<Item> ITEMS; public static final RegistryObject<MiniChest> MINI_CHEST; public static final RegistryObject<SmeltingChest> SMELTING_CHEST; public static final RegistryObject<InvisibleChest> INVISIBLE_CHEST; public static final RegistryObject<TrapChest> TRAP_CHEST; public static final RegistryObject<PitfallChest> PITFALL_CHEST; public static final RegistryObject<DrillChest> DRILL_CHEST; public static final RegistryObject<TeleportChest> TELEPORT_CHEST; public static final RegistryObject<LootChest> LOOT_CHEST; public static final RegistryObject<MonsterChest> MONSTER_CHEST; public static final RegistryObject<PocketDimensionChest> POCKET_DIMENSION_CHEST; public static final RegistryObject<ColossalChest> COLOSSAL_CHEST; public static final RegistryObject<ColossalChestPart> COLOSSAL_CHEST_PART; static { BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TenChest.MODID); ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, TenChest.MODID); MINI_CHEST = register("mini_chest", MiniChest::new, Blocks::baseChestRenderer); SMELTING_CHEST = register("smelting_chest", SmeltingChest::new, Blocks::smeltingChestRenderer); INVISIBLE_CHEST = register("invisible_chest", InvisibleChest::new, Blocks::baseChestRenderer); TRAP_CHEST = register("trap_chest", TrapChest::new, Blocks::baseChestRenderer); PITFALL_CHEST = register("pitfall_chest", PitfallChest::new, Blocks::baseChestRenderer); DRILL_CHEST = register("drill_chest", DrillChest::new, Blocks::baseChestRenderer); TELEPORT_CHEST = register("teleport_chest", TeleportChest::new, Blocks::teleportChestRenderer); LOOT_CHEST = register("loot_chest", LootChest::new, Blocks::lootChestRenderer); MONSTER_CHEST = register("monster_chest", MonsterChest::new, Blocks::baseChestRenderer); POCKET_DIMENSION_CHEST = register("pocket_dimension_chest", PocketDimensionChest::new, Blocks::pocketDimensionChestRenderer); COLOSSAL_CHEST_PART = register("colossal_chest_part", ColossalChestPart::new); COLOSSAL_CHEST = register("colossal_chest", ColossalChest::new, Blocks::baseChestRenderer); } @OnlyIn(Dist.CLIENT) private static Callable<ItemStackTileEntityRenderer> baseChestRenderer() { return () -> new BaseChestItemStackRenderer(ChestTileEntity::new); } @OnlyIn(Dist.CLIENT) private static Callable<ItemStackTileEntityRenderer> smeltingChestRenderer() { return () -> new BaseChestItemStackRenderer(SmeltingChestTileEntity::new); } @OnlyIn(Dist.CLIENT) private static Callable<ItemStackTileEntityRenderer> teleportChestRenderer() { return () -> new BaseChestItemStackRenderer(TeleportChestTileEntity::new); } @OnlyIn(Dist.CLIENT) private static Callable<ItemStackTileEntityRenderer> lootChestRenderer() { return () -> new BaseChestItemStackRenderer(LootChestTileEntity::new); } @OnlyIn(Dist.CLIENT) private static Callable<ItemStackTileEntityRenderer> pocketDimensionChestRenderer() { return () -> new BaseChestItemStackRenderer(PocketDimensionChestTileEntity::new); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Supplier<Callable<ItemStackTileEntityRenderer>> renderMethod) { return register(name, sup, (block) -> item(block, renderMethod)); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup) { return register(name, sup, (block) -> item(block)); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator) { RegistryObject<T> ret = registerNoItem(name, sup); ITEMS.register(name, (Supplier) itemCreator.apply(ret)); return ret; } private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<? extends T> sup) { return BLOCKS.register(name, sup); } private static Supplier<BlockItem> item(RegistryObject<? extends Block> block, Supplier<Callable<ItemStackTileEntityRenderer>> renderMethod) { return () -> { BlockItem blockItem = new BlockItem(block.get(), (new Item.Properties().tab(TenChest.MOD_GROUP).setISTER(renderMethod))); return blockItem; }; } private static Supplier<BlockItem> item(RegistryObject<? extends Block> block) { return () -> new BlockItem(block.get(), (new Item.Properties()));//.tab(TenChest.MOD_GROUP))); } } How can i separate the process between server and client?
    • The setISTER method takes a Supplier<Callable>. The Callable should be implemented in a separate class to prevent loading it on the server.
    • Ok, i removed it. But i use Item.Property.setISTER() for render the Block on the inventory, and the ItemStackTileEntityRenderer is only on Dist.CLIENT How can i make it work also on the server side?
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.