Jump to content

[1.10.2] Block won't become a Tile Entity


kriNon

Recommended Posts

Hey,

I'm currently working on getting into modding minecraft and have recently begun working on making a TileEntity with a 1 slot inventory (no gui yet). The issue I am having is that the block I have made (BlockEnderTransmitter) will not become a Tile Entity. I have checked with multiple tutorials and compared my code to other opensource projects to try to find the issue but I don't know how I should begin troubleshooting the problem.

 

Any help would be much appreciated!

 

My project is uploaded to github here: https://github.com/kriNon/Endernet1.10.2/

The classes I am having difficulty with are kriNon.blocks.BlockEnderTransmitter and kriNon.tileentities.TileEntityEnderTransmitter.

Link to comment
Share on other sites

Hey,

I'm currently working on getting into modding minecraft and have recently begun working on making a TileEntity with a 1 slot inventory (no gui yet). The issue I am having is that the block I have made (BlockEnderTransmitter) will not become a Tile Entity. I have checked with multiple tutorials and compared my code to other opensource projects to try to find the issue but I don't know how I should begin troubleshooting the problem.

 

Any help would be much appreciated!

 

My project is uploaded to github here: https://github.com/kriNon/Endernet1.10.2/

The classes I am having difficulty with are kriNon.blocks.BlockEnderTransmitter and kriNon.tileentities.TileEntityEnderTransmitter.

How is this not throwing an error at you?

public TileEntity createNewTileEntity(World worldIn, int meta) {

It should be

public TileEntity createNewTileEntity(World worldIn, IBlockState state) {

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.

Link to comment
Share on other sites

If I try to do that it throws an error telling me to remove the @Override on line 32, when I do so I get an error (on line 23) that BlockEnderTransmitter must implement the inherited abstract method ITileEntityProvider.createNewTileEntity(World, int)

Link to comment
Share on other sites

If I try to do that it throws an error telling me to remove the @Override on line 32, when I do so I get an error (on line 23) that BlockEnderTransmitter must implement the inherited abstract method ITileEntityProvider.createNewTileEntity(World, int)

That is the problem, dont use ITileEntityProvider, just override the method signature I gave you.

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.

Link to comment
Share on other sites

Could you go into a little bit more detail? How exactly should I be going about doing this?

 

Don't extend

BlockContainer

or implement

ITileEntityProvider

.

 

Override

Block#hasTileEntity(IBlockState)

and

Block#createTileEntity

. Your IDE should be able to generate override methods for you.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I have tried what I think you're telling me to do here: https://gist.github.com/kriNon/dbac43d39511dc621608eb2d512f1894

I'm getting an error telling me "The method createNewTileEntity(World, IBlockState) of type BlockEnderTransmitter must override or implement a supertype method". When I try getting rid of the @Override it still doesn't work properly.

Link to comment
Share on other sites

I have tried what I think you're telling me to do here: https://gist.github.com/kriNon/dbac43d39511dc621608eb2d512f1894

I'm getting an error telling me "The method createNewTileEntity(World, IBlockState) of type BlockEnderTransmitter must override or implement a supertype method". When I try getting rid of the @Override it still doesn't work properly.

 

There's no method in

Block

called

createNewTileEntity

, so you can't override it. Delete this method and return a new instance of your

TileEntity

from the

Block#createTileEntity

override instead.

 

Overriding a method to do nothing but call the super method is completely pointless.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

So this should be what I should have? https://gist.github.com/kriNon/dbac43d39511dc621608eb2d512f1894

No errors are coming up with this and it seems right, however the block still doesn't seem to be a tile entity.

 

Thanks for all of the help by the way!

 

Those are the correct methods to override, yes.

 

What makes you think there isn't a

TileEntity

? Are your

hasTileEntity

and

createTileEntity

methods being called?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

If I try to do that it throws an error telling me to remove the @Override on line 32

 

An error telling you to remove an @Override annotation means that your method signature is wrong.

http://stackoverflow.com/questions/4341432/what-does-override-mean

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

I had fixed BlockEnderTransmitter still extending BlockContainer, I just hadn't pushed the changes to the github page.

 

Thanks a lot for the help with noticing my mistake with not creating instances of BlockEnderTransmitter.

 

Everything works perfectly now, thanks everyone for all of the help!

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.
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

    • I have a keybind where you spit like a llama. On singleplayer both the entity and particle spawn and it's sound is played (https://youtu.be/bpxnFDuWw_I). But on a server only the entity is spawned and nothing else (https://youtu.be/veVQ4zSqnIA), no particles nor sound. Upon starting the server I have noticed this error in the window (https://postimg.cc/K3KDCpMY), don't know if it's relevant. The server works fine but when I want to spit the following pops up in the serverlog '''Attempted to load class net/minecraft/client/player/LocalPlayer for invalid dist DEDICATED_SERVER''' (https://postimg.cc/LqTDP1Sm). I have prepared the following code of the Server-to-Client packet class which I have made to spawn mentioned particles and sounds. package mett.palemannie.tabakmod.networking.packets; import net.minecraft.client.Minecraft; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class SpuckEffektS2CPacket { public SpuckEffektS2CPacket(){ } public SpuckEffektS2CPacket(FriendlyByteBuf buf){ } public void toBytes(FriendlyByteBuf buf){ } public boolean handle(Supplier<NetworkEvent.Context> supplier){ NetworkEvent.Context context = supplier.get(); context.enqueueWork(()-> { Player player = Minecraft.getInstance().player; //Attempted to load class net/minecraft/client/player/LocalPlayer for invalid dist DEDICATED_SERVER Level level = Minecraft.getInstance().level; RandomSource rdm = RandomSource.create(); float r = rdm.nextInt(80, 120) / 100f; player.playSound(SoundEvents.LLAMA_SPIT, 1f, r); Vec3 MausPos = player.getEyePosition(); Vec3 SchauWinkel = player.getLookAngle(); level.addParticle(ParticleTypes.SPIT, true, MausPos.x, MausPos.y, MausPos.z, SchauWinkel.x/4, SchauWinkel.y/4, SchauWinkel.z/4); }); return true; } } Is there an alternative to Minecraft.getInstance().player;? dumb question. I have looked at other mods (MrCrayfish's Gun Mod, Ars Noveau, Apotheosis) on how they handle such server-to-client sound and particles but I haven't got any wiser.    
    • i keep getting error on minecraft when im trying to play modpack. When i go to logs folder i got this. 
    • Try an older build: https://www.curseforge.com/minecraft/mc-mods/sorceryfight/files/5358535
    • Add the crash-report or latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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