Jump to content

Custom Campfire [Solved]


PuppyWuppy

Recommended Posts

So I just created a custom purple campfire. I have a few problems

I've registered the block (Code attached to the bottom).

But for some reason it doesn't act like a campfire at all.

 

The problems are that there is:

no smoke

no recipes working (the items stay raw)

the inputted items don't render on the block
the campfire doesn't re-light (with flint and steel) after it is put out

 

public static final RegistryObject<Block> PURPLE_CAMPFIRE = BLOCKS.register("purple_campfire", () -> new CampfireBlock(false, 3, AbstractBlock.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN)
			.hardnessAndResistance(2.0F)
			.sound(SoundType.WOOD)
			.setLightLevel(getLightValueLit(10))
			.notSolid()));
	
private static ToIntFunction<BlockState> getLightValueLit(int lightValue) {
	return (block) -> {
		return block.get(BlockStateProperties.LIT) ? lightValue : 0;
	};
}
	

 

Link to comment
Share on other sites

Ok, let's do a breakdown of lazy coding.

3 hours ago, PuppyWuppy said:

no smoke

You need a tile entity for that.

3 hours ago, PuppyWuppy said:

no recipes working (the items stay raw)

You need a tile entity for that.

3 hours ago, PuppyWuppy said:

the inputted items don't render on the block

You need a tile entity renderer for that.

3 hours ago, PuppyWuppy said:

the campfire doesn't re-light (with flint and steel) after it is put out

You need to put your block in the block tags for campfires.

 

Just because you decide to copy one part of a block doesn't necessarily mean it will work. At least check and make sure the block isn't referencing anything else before doing so.

  • Thanks 1
Link to comment
Share on other sites

11 hours ago, ChampionAsh5357 said:

Ok, let's do a breakdown of lazy coding.

You need a tile entity for that.

You need a tile entity for that.

You need a tile entity renderer for that.

You need to put your block in the block tags for campfires.

 

Just because you decide to copy one part of a block doesn't necessarily mean it will work. At least check and make sure the block isn't referencing anything else before doing so.

Okay, so I've added the Tile entity and the tile entity renderer here:

TileEntityInit:

public static final DeferredRegister<TileEntityType<?>> TILE_ENTITY = DeferredRegister
			.create(ForgeRegistries.TILE_ENTITIES, Reference.MOD_ID);

	public static final RegistryObject<TileEntityType<CampfireTileEntity>> CAMPFIRE = TILE_ENTITY.register("purple_campfire",
			() -> TileEntityType.Builder.create(CampfireTileEntity::new, BlockList.PURPLE_CAMPFIRE.get()).build(null));

 

ClientProxy / FMLClientSetupEvent

ClientRegistry.bindTileEntityRenderer(TileEntityInit.CAMPFIRE.get(), CampfireTileEntityRenderer::new);

 

I've registered the TILE_ENTITY DeferredRegister to the event bus so it works (I have other Tile Entities now so that is registered correctly).

 

Still no change

Link to comment
Share on other sites

Your block still needs to say "Hey! I have a tile entity!" and instantiate it.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

15 minutes ago, Draco18s said:

Your block still needs to say "Hey! I have a tile entity!" and instantiate it.

Right, well before you said that I copied the classes from the normal campfire - CampfireBlock, CampfireTileEntity, CampfireTileEntityRenderer, but changed them to my own names, and also changed any instance of CampfireBlock, CampfireTileEntity, CampfireTileEntityRenderer to my own, instead of the vanilla ones, hoping that this would work, as then the block would be a separate thing.

 

The smoke works now, but nothing else does 😂

Not sure what I'm doing now.

 

Not sure I should have done that lol, what do you mean by that?

Link to comment
Share on other sites

Just now, PuppyWuppy said:

Not sure I should have done that lol, what do you mean by that?

Look at:

 - hasTileEntity

 - getTileEntity

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

4 hours ago, PuppyWuppy said:

CampfireTileEntity::new

So your tile entity can never exist then? This has a set tile entity type that is unchangeable. You need to make your own class or at least extend and super correctly.

55 minutes ago, PuppyWuppy said:

Where would these be?

In the block class.

Edited by ChampionAsh5357
Link to comment
Share on other sites

1 hour ago, ChampionAsh5357 said:

So your tile entity can never exist then? This has a set tile entity type that is unchangeable. You need to make your own class or at least extend and super correctly.

Which is why I made my own classes instead of using the vanilla ones (only using the recipe and particle), but that didn't work

 

Quote

In the block class.

Okay, I can see hasTileEntity, but getTileEntity doesn't seem to be there

Edited by PuppyWuppy
Link to comment
Share on other sites

Quote
On 8/13/2020 at 12:16 AM, PuppyWuppy said:

the campfire doesn't re-light (with flint and steel) after it is put out

You need to put your block in the block tags for campfires.

ChampionAsh already gave you the answer for that

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

49 minutes ago, ChampionAsh5357 said:

Did you even register/attach the TER to the respective TE in the client setup?

I think so:
I have this line inside of my ClienProxy class (inside the FMLClientSetupEvent) which gets called on the EventBus

 

ClientRegistry.bindTileEntityRenderer(TileEntityList.CAMPFIRE.get(), PurpleCampfireTileEntityRenderer::new);

 

Link to comment
Share on other sites

7 minutes ago, ChampionAsh5357 said:

Then I would like to see the tile entity class and the renderer class.

TileEntity (Copied from the vanilla Campfire (Changed references of campfire to my own)):

https://pastebin.com/n7eQTjUa
 

TileEntityRenderer (Again copied from the vanilla Campfire (Changed references of campfire to my own)):

https://pastebin.com/9xLm4TjG

 

And the Block just in case you need it (Again changed and updated references):

https://pastebin.com/vk7AXrZK

Link to comment
Share on other sites

  • PuppyWuppy changed the title to Custom Campfire [Solved]

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.