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

EntityEvent.Size Bug


MrScautHD
 Share

Recommended Posts

Hi i have a problem the EntityEvent.Size Event work not right

when i sit on a entity work it not any more i hope forge can fix this in the next version :)

 

Code:

        @SubscribeEvent
        public void renderPlayerPre(EntityEvent.Size size) {
            if (((event.getEntity().getRidingEntity()) instanceof RocketEntity.CustomEntity)) {
            size.setNewEyeHeight(1f);
            }
        }

Link to comment
Share on other sites

Define doesn't work please, also why you call your handler "renderPlayerPre" if you are listening to the EntityEvent.Size event? The code above shouldn't even compile, where did you define "event"? You probably meant to use "size" there. One last thing, the Size event is fired also in the constructor of the Entity, where it is unlikely a riding entity already exists..you can easily check that by logging something to the console inside the if statement and check if the message appears or not

Edited by Beethoven92

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

7 minutes ago, Beethoven92 said:

Define doesn't work please, also why you call your handler "renderPlayerPre" if you are listening to the EntityEvent.Size event? The code above shouldn't even compile, where did you define "event"? You probably meant to use "size" there. One last thing, the Size event is fired also in the constructor of the Entity, where it is unlikely a riding entity already exist..you can easily check that by logging something to the console inside the if statement and check if the message appears or not

i have check it already in the console when i leave the entity is it for 1 tick workingand then not any more (only when i check if the player ridding) you can try it self then see you it and without if player ridding a entity is it working. i hope you can help me :)

 

Link to comment
Share on other sites

5 minutes ago, diesieben07 said:

Stop using MCreator and learn basic Java.

i dont use MCreator lol, this workspace based only on a mcreator workspace but the code is from me and i self use Intellij, (is a old workspace, and i have already change the program)

pls help :/ (i dont a MCshit user)

Link to comment
Share on other sites

1 minute ago, diesieben07 said:

but the forge event is dead can you pls help me now or hate you me now because i use mcreator ( yea ok i use mcreator but i use many custom codding) and why i lying because when i say i use Mcreator then help you me not any more :/

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I am trying to create a custom anvil for my mod and the approach i am trying is to create a normal vanilla anvil with custom recipe container - i tried creating the block and passing a custom container to it but i do feel a bit stuck and confused on how to do this. Some explanation and guidence would be great! Thanks in advance. package com.vassdeniss.makoru.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.SimpleNamedContainerProvider; import net.minecraft.stats.Stats; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.IWorldPosCallable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; public class AngelAnvilBlock extends Block { private static final ITextComponent AngelAnvilContainer = new TranslationTextComponent("container.crafting"); public AngelAnvilBlock() { super(Block.Properties.create()); } @Override public ActionResultType onBlockActivated(BlockState p_225533_1_, World worldIn, BlockPos p_225533_3_, PlayerEntity player, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { if (worldIn.isRemote) { return ActionResultType.SUCCESS; } else { NetworkHooks.openGui(player, ); player.addStat(Stats.INTERACT_WITH_ANVIL); return ActionResultType.CONSUME; } } @Override public INamedContainerProvider getContainer(BlockState state, World world, BlockPos pos) { return new SimpleNamedContainerProvider((id, inventory, player) -> new AngelAnvilContainer(id, inventory, IWorldPosCallable.of(world, pos)), AngelAnvilContainer); } } package com.vassdeniss.makoru.blocks; import com.vassdeniss.makoru.util.RegistryHandler; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.RepairContainer; import net.minecraft.util.IWorldPosCallable; public class AngelAnvilContainer extends RepairContainer { private final IWorldPosCallable field_217070_e; public AngelAnvilContainer(int id, PlayerInventory playerInventory, IWorldPosCallable p_i50102_3_) { super(id, playerInventory, p_i50102_3_); this.field_217070_e = p_i50102_3_; } @Override public boolean canInteractWith(PlayerEntity player) { return isWithinUsableDistance(this.field_217070_e, player, RegistryHandler.ANGEL_ANVIL.get()); } }  
    • I'm making some tools and I'm using a Set of type Block to specify on what blocks the tools would work. This is all in my ItemInit class which I use to register items. See below. private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ANDESITE); This works fine with minecraft blocks. Problems occur when I want to use mod blocks like this: private static Set<Block> EFFECTIVE_ON = Sets.newHashSet(BlockInit.AMBER_BLOCK.get());   I get an error while loading the game, which is a NullPointerException.  Exception message: java.lang.NullPointerException: Registry Object not present: extinctioncraft:amber_block   It seems my block can't be found by this set despite the block working fine in the game itself.    I already tried the following without success: - Checked if the BlockInit is registered in the main class. ( BlockInit.BLOCKS.register(bus); ) - Checked if the block is registered in the BlockInit class. 
    • As the name implies I am trying to make a block with a "condition" value. I am doing this because I will be adding future features where a very strong type of block would be useful. I have started out with making a simple custom blockstate property (1-4) which determines the model (Polished, Un-polished, scuffed, cracked). However, I want those 4 states to then be determined by a larger number (more wiggle room with how much damage a certain event can do to this type of block). I was thinking 3000-5000, which I can then say "oh the block durability has to be at 200 to be cracked, but 750 for scuffed". I think the large health number think could be done with a tile entity I also want certain states to be maintained even after it has been picked up such as the larger number (maybe not the 1-4 since I think I would have to do something funky with datagen for my 90 items to have 360 item models), so perhaps NBT (which I have never done before). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I could probably figure this out on my own given a good bit of time, but dual-enrollment does not allow much time in a day. So, basically just looking either for a github repos that shows persistent data & some funky tile entities (if that is the best route for the block health thing), or suggestions.    
    • ObfuscationReflectionHelper methods always take SRG names, even in the development environment. In development, the SRG name is automatically remapped to the corresponding MCP name.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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