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

A general "RenderEntityEvent"


FredTargaryen
 Share

Recommended Posts

Something I'm working on right now needs to be able to rotate minecarts on the z axis before they render,

so I wrote the whole thing thinking there would be some kind of RenderEntityEvent I could use.

 

I've found RenderPlayerEvent and RenderLivingEvent but I can't find anything that fires for just any entity.

My guess is it hasn't been implemented because it would fire a lot, which I sort of understand.

 

I'd really appreciate one of these in a future Forge version, or at least the reason why it hasn't been implemented... or if it actually has been implemented can someone please tell me how to use it?

 

I know one workaround involving overriding the handler in RenderingRegistry; as far as I can tell registering the new handler requires you to know the class of the entity to override, which is not great if you want to use Capabilities to work with mod entities as well.

 

Thanks for reading.

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.

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.

 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.