Jump to content

[1.15.2] ArrowRenderer incorrectly draws an arrow at a modified velocity


Recommended Posts

Posted (edited)

With small values [1; 1,5], the problem is invisible. If I indicate 2 or more, the arrow flies to the side, but at the same time, the target I aimed at takes damage. Arrows that do not hit the target lie next to it, and not on the side where the arrow flew. Searches are complicated by the fact that in class ArrowRenderer the obfuscated variables are not renamed.

video

 

repository

bow component responsible for arrow settings

bow

  Reveal hidden contents
  Reveal hidden contents
  Reveal hidden contents
Edited by Torq

If I helped you, don't forget like. I'm using a translator, sorry.

Posted (edited)

can anyone help me? The problem is still relevant. I don’t understand how this system works. Apparently, the entity flies correctly, and the renderer does not draw according to the coordinates of the entity, or it does not correctly orient the arrow in space.

If you set a high speed, the arrow still falls close to the player, the flight animation does not correspond to the direction of the shot and the flight range of the real arrow (where the arrow falls and remains on the ground).

Edited by Torq

If I helped you, don't forget like. I'm using a translator, sorry.

Posted (edited)

Do I understand correctly that there is no suitable event for rendering arrow? An event is not raised in the render() method of the ArrowRenderer class, and only the RenderNameplateEvent is created in the render() method of the EntityRenderer (super) class. I cannot change the event because it does not exist and I cannot rewrite ArrowRenderer, what can I try to do?

Edited by Torq

If I helped you, don't forget like. I'm using a translator, sorry.

Posted
  On 3/31/2020 at 5:39 AM, Torq said:

I cannot change the event because it does not exist and I cannot rewrite ArrowRenderer, what can I try to do?

Expand  

Create your own entity with it's own EntityRenderer.

  On 3/31/2020 at 5:39 AM, Torq said:

Do I understand correctly that there is no suitable event for rendering arrow?

Expand  

Yes you understand correctly. And there will not be one.

  On 3/28/2020 at 9:19 AM, Torq said:

can anyone help me? The problem is still relevant. I don’t understand how this system works. Apparently, the entity flies correctly, and the renderer does not draw according to the coordinates of the entity, or it does not correctly orient the arrow in space.

Expand  

Have you tried using the debugger to see the coordinates of the entity on both the logical server and logical client? It is likely a desync issue.

  • Like 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
  On 3/31/2020 at 6:16 AM, Animefan8888 said:

Create your own entity with it's own EntityRenderer.

Yes you understand correctly. And there will not be one.

Have you tried using the debugger to see the coordinates of the entity on both the logical server and logical client? It is likely a desync issue.

Expand  

Can you tell (or give a link) how to use the debugger? It will be very useful to me in the future. I tried to find something similar or use a logger, but this is a very bad idea. If you meant breakpoints and debug, I tried to set breakpoints and look at the values, but apparently either I have little experience working with them, or I'm doing something wrong. I could not see the values of the variables and the game did not stop, nothing happened.
I will try to do what you said, but it’s not yet clear how to connect entity and renderer, and how to fire renderer (is there an event?), I planned to study this when I finish bow, but apparently I have to do it now.

If I helped you, don't forget like. I'm using a translator, sorry.

Posted
  On 3/31/2020 at 6:41 AM, Torq said:

I will try to do what you said, but it’s not yet clear how to connect entity and renderer, and how to fire renderer (is there an event?), I planned to study this when I finish bow, but apparently I have to do it now.

Expand  

There is likely a little more than this it's been a while since I've messed with Entities.

 

Entities are registered like Items and Blocks.

You must also register their renderer with RenderingRegistry.registerEntityRenderingHandler.

  On 3/31/2020 at 6:41 AM, Torq said:

Can you tell (or give a link) how to use the debugger?

Expand  

It depends on the IDE you are using. In eclipse just set a breakpoint and run the game in debug mode. I don't know about IntelliJ Idea or any other IDE.

To run in Debug mode click the bug icon next to the Run button.
image.png.bdbd7394d562ef5a85e685c63d88218e.png

  • Like 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
  On 3/31/2020 at 6:54 AM, Animefan8888 said:

Вероятно, немного больше, чем это, прошло много времени с тех пор, как я связался с сущностями.

 

Объекты регистрируются как элементы и блоки.

Вы также должны зарегистрировать их средство визуализации с помощью RenderingRegistry.registerEntityRenderingHandler.

Это зависит от используемой вами IDE. В eclipse просто установите точку останова и запустите игру в режиме отладки. Я не знаю ни о IntelliJ Idea, ни о какой-либо другой IDE.

Для запуска в режиме отладки щелкните значок ошибки рядом с кнопкой «Выполнить».
image.png.bdbd7394d562ef5a85e685c63d88218e.png

Expand  

I use IntellijIDEA, I like it a little more, but I have VSCode and Eclipse in which the project starts normally. I already included debug in IntellijIDEA, I described the result above: I can’t see the values of the variables, breakpoints do not work, the game does not freeze, nothing happens (did what you described). Maybe I'm not doing it right. I'll try to do it in Eclipse.

If I helped you, don't forget like. I'm using a translator, sorry.

Posted (edited)
  On 3/31/2020 at 7:04 AM, Animefan8888 said:

The best I can do for that is point you here. I don't know how clear that is.

Expand  

I don’t know what the problem was, but now the game is frozen and everything works as it should)) I have experience debugging programs in Visual Studio, so I understand how this should happen.

Edited by Torq

If I helped you, don't forget like. I'm using a translator, sorry.

Posted
  On 3/31/2020 at 7:28 AM, Torq said:

but now the game is frozen

Expand  

That's what debug mode does. It pauses the execution of code.

  On 3/31/2020 at 7:28 AM, Torq said:

and everything works as it should

Expand  

So the bug is gone?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
  On 3/31/2020 at 7:30 AM, Animefan8888 said:

That's what debug mode does. It pauses the execution of code.

So the bug is gone?

Expand  

I know how debug works. Previously, debug did not work as it should, but now it has earned. The problem remains, but now I can see what happens.
Why is RenderNamePlateEvent responsible for rendering the arrow(it contains an arrow entity)? Is it not responsible for nicknames over the heads of players and the inscriptions of renamed objects placed in frames (and the like)?

Edited by Torq

If I helped you, don't forget like. I'm using a translator, sorry.

Posted
  On 3/31/2020 at 7:38 AM, Torq said:
  Reveal hidden contents

 

Expand  

That is not the ArrowRenderer. That is inside the EntityRenderer. The EntityRenderer renders the NamePlate of the Entity.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • 2 months later...

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

    • You are using Create 6 - some addons are not compatible with it Remove all addons and add these one by one littlecontraptions is mentioned - keep this one removed
    • Different problem now. https://paste.ee/p/iDo8lS35
    • I would like to have a BoP sapling drop from my block if it is also installed. I think I have done everything and I cannot pinpoint the problem, which is the error in the logs that appears when joining a world:   [Worker-Main-11/ERROR] [ne.mi.co.ForgeHooks/]: Couldn't parse element loot_tables:grasses:blocks/leaves_block com.google.gson.JsonSyntaxException: Expected name to be an item, was unknown string 'biomesoplenty:magic_sapling' My code:   LootItemConditions.CONDITIONS.register(modEventBus); public class LootItemConditions { public static final DeferredRegister<LootItemConditionType> CONDITIONS = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Grasses.MOD_ID); public static final RegistryObject<LootItemConditionType> IS_MOD_LOADED = CONDITIONS.register("is_mod_loaded", () -> new LootItemConditionType(new IsModLoaded.ConditionSerializer())); } public class IsModLoaded implements LootItemCondition { private final boolean exists; private final String modID; public IsModLoaded(String modID) { this.exists = ModList.get().isLoaded(modID); this.modID = modID; } @Override public LootItemConditionType getType() { return LootItemConditions.IS_MOD_LOADED.get(); } @Override public boolean test(LootContext context) { return this.exists; } public static LootItemCondition.Builder builder(String modid) { return () -> new IsModLoaded(modid); } public static class ConditionSerializer implements Serializer<IsModLoaded> { @Override public void serialize(JsonObject json, IsModLoaded instance, JsonSerializationContext ctx) { json.addProperty("modid", instance.modID); } @Override public IsModLoaded deserialize(JsonObject json, JsonDeserializationContext ctx) { return new IsModLoaded(GsonHelper.getAsString(json, "modid")); } } } protected LootTable.Builder createLeavesDropsWithModIDCheck(Block selfBlock, Item sapling, Property<?>[] properties, String modIDToCheck, float... chances) { CopyBlockState.Builder blockStateCopyBuilder = CopyBlockState.copyState(selfBlock); for(Property<?> property : properties) { blockStateCopyBuilder.copy(property); } return LootTable.lootTable() .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(selfBlock) .when(HAS_SHEARS_OR_SILK_TOUCH) .apply(blockStateCopyBuilder))) .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) .add(this.applyExplosionCondition(selfBlock, LootItem.lootTableItem(sapling)) .when(IsModLoaded.builder(modIDToCheck))) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, chances)) .when(HAS_NO_SHEARS_OR_SILK_TOUCH)) .withPool(LootPool.lootPool().name("sticks").setRolls(ConstantValue.exactly(1.0F)) .add(this.applyExplosionDecay(selfBlock, LootItem.lootTableItem(Items.STICK). apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F)))) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, NORMAL_LEAVES_STICK_CHANCES)) .when(HAS_NO_SHEARS_OR_SILK_TOUCH))); } I don't know. Am I making a mistake somewhere? Am I forgetting something? Should there be something else?
  • Topics

×
×
  • Create New...

Important Information

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