Jump to content

Recommended Posts

Posted (edited)
Quote

@Mod("progressionmod")
@Mod.EventBusSubscriber(modid = ProgressionMod.MOD_ID, bus = Bus.MOD)
public class ProgressionMod
{

    ...

    private void doClientStuff(final FMLClientSetupEvent event) {

        ...

        TileEntityRenderer<ProCampfireTileEntity>  h = new ProCampfireTileEntityRenderer(TileEntityRendererDispatcher.instance);
        ClientRegistry.bindTileEntityRenderer(ModTileEntityTypes.CAMPFIRE, h);                                  

        // ^^^Clearly this doesnt work, but what exactly does it expect me to do here.

        // I guess im asking for an example of what a functioning  ClientRegistry.bindTileEntityRenderer() call would look like.

        //Also tried >>> TileEntityRendererDispatcher.instance.setSpecialRendererInternal(TileEntityType.CAMPFIRE, h );   
    }

    ...
}

 

 

Other stuff that might be relevant

Quote

public class ProCampfireTileEntity extends TileEntity implements IClearable, ITickableTileEntity {
       ...

       public ProCampfireTileEntity(final TileEntityType<?> tileEntityTypeIn) {
          super(tileEntityTypeIn);
       }
       public ProCampfireTileEntity() {
          this(ModTileEntityTypes.CAMPFIRE.get());       
       }

       ...
}

 

 

Quote

public class ProCampfireTileEntityRenderer extends TileEntityRenderer<ProCampfireTileEntity> {

    public ProCampfireTileEntityRenderer(TileEntityRendererDispatcher rendererDispatcherIn) {
        super(rendererDispatcherIn);
    }

    ...
}

 

 

Quote

public class ModTileEntityTypes {
    public static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.TILE_ENTITIES,ProgressionMod.MOD_ID);
    
    public static final RegistryObject<TileEntityType<ProCampfireTileEntity>> CAMPFIRE = TILE_ENTITY_TYPES.register("progressioncampfire",() -> TileEntityType.Builder.create(ProCampfireTileEntity::new, BlockInit.campfire).build(null));
}

 

Edited by greetthemoth
Posted
1 hour ago, diesieben07 said:

You are passing two wrong types here.

bindTileEntityRenderer expects a TileEntityType as it's first argument. You are giving it a RegistryObject<TileEntityType> instead. I suggest the get method.

The 2nd argument is a Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>>. You are giving it a TileEntityRenderer instead.

I am aware the types are off. I guess im asking how do i get the appropiate types given my data set. Like what even is a "Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>>" and how do i get the TileEntityType from the "RegistryObject<TileEntityType>" is it even possible?

Posted (edited)

i know about interfaces and how to use them(assuming they work the same way as c#). Do i have to add the interface to my Renderer class?  But yes im in the dark about lambda time. I guess i can try to figure it out from here.

Edited by greetthemoth
Posted (edited)

I think i got it! thaks for the help.

 

        ClientRegistry.bindTileEntityRenderer(ModTileEntityTypes.CAMPFIRE.get(),(bloop)->new ProCampfireTileEntityRenderer(bloop));

 

EDIT: hmm the game ran, but it doesnt seem to be working correctly, not sure if its a problem with my renderer script. or if im still registering wrong.
 

Edited by greetthemoth
Posted
1 hour ago, diesieben07 said:

Function is an interface like any other. Please learn basic Java if you do not know how to implement interfaces.

I suggest you also learn about lambda expressions, as they come in useful here.

NICE IT WORKS. the only problem no is that for some reason when i put meat on the campfire it only shows up if a reload. Ill try to figure it out.

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



×
×
  • Create New...

Important Information

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