Jump to content

Recommended Posts

Posted

Hi, I wanted to create a block from a .obj file and put it into Minecraft. I tried searching up on the internet about this, and I found some results, but they were for 1.8, 1.8.9, etc, and not for 1.12.2. If I use the code for 1.8, 1.8.9, etc, eclipse would give off a bunch of weird errors. I would like to have a detailed step - to - step explanation on how to do this.

Thanks!

  • 2 weeks later...
Posted

This is what I tried:

 

Gold Mammoth OBJ Model Loader File:

1.PNG.608a903f094212a36fe9d15cd32831b0.PNG

 

TileEntityRenderer Class:

2.PNG.6db510809015d1d6c5cb518f64ffcb4c.PNG

 

I made sure my class names, imports, were all correct, however, I wasn't able to load the model due to the significant amount of errors.

 

 

 

 

Posted (edited)
  Quote

I made sure my class names, imports, were all correct

Expand  

They are not correct, otherwise there will not be the red wiggly lines under it.

These are syntax errors. These are irrelevant to your model.

Use your IDE to find out what are wrong and how to fix them (hover your cursor over the errors).

 

Moreover, you should be using GlStateManager instead of GL11.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted (edited)

Not true, then why is the return TileEntityKingMammoth giving off an error and this part

"        super(Material.SNOW);
        setBlockTextureName(Reference.MOD_ID + ":" + name);
        setBlockBounds(0.25F, 0, 0.25F, 0.75F, 0.5F, 0.75F);
        setBlockName(name);
        GameRegistry.registerBlock(this, name);"

giving off an error. (Everything else i get)

Additionally, some of the methods are giving off errors even though they are correct. For example, I had to remove a couple @Override annotations to get rid of some erorrs.

Edited by PulseBeat_02
Posted (edited)

Here is the new code after editing some:

 

                                                                                                            

 

Gold_Mammoth Class:

 

1.PNG.3b62c4b4290287987345f6bcf22c1b65.PNG

 

 

RenderTileEntityKingMammoth Class:

 

2.PNG.eac6d0e8167943c6693a406bfb6123d6.PNG

 

 

TileEntityKingMammoth Class:

 

3.PNG.2efe2240fe2b721eca10e1381bcf7271.PNG

 

 

Client Proxy Class:

 

4.PNG.0845eeed724030389f0a3348a21a8e48.PNG

Edited by PulseBeat_02
Posted (edited)

1. Please, check your syntax. I spotted at least 3 syntax errors from a quick glance.

2. When your IDE gives you an error, you should read the error and fix the error properly instead of simply removing @Override. The Override annotation is giving an error because the method being overridden does not exists. Removing the @Override will fix the compile-time error, but meanwhile will make the method useless.

3. Things change. The method and field names in 1.8 do not necessarily exist in 1.12.2. An example would be TileEntity#worldObj (1.8), which is changed to TileEntity#world in 1.12.2. Again, use your IDE.

4. Stop registering your items inside the constructor. Initialize and register them in the appropriate event.

 

My suggestion would be:

1. Review Java. You need to get the basic syntaxes right.

2. Names change between versions. You should use your IDE to figure out the names for methods and fields in 1.12.2.

3. 

  On 2/21/2019 at 12:37 AM, DavidM said:

(hover your cursor over the errors)

Expand  

Sentences like "Line xxx is giving an error" is not specific. You need to read the error, which is trying to tell you what is wrong.

Edited by DavidM
typo
  • Thanks 1

Some tips:

  Reveal hidden contents

 

Posted
  On 2/9/2019 at 3:10 AM, PulseBeat_02 said:

I would like to have a detailed step - to - step explanation

Expand  

1. Review Java.

2. Check out online documentations to familiarize yourself with the new naming (optional).

3. Fix your errors by reading the errors. They should tell you exactly what you should do, like "XXX is not a method in the parent class" means the method XXX does not exists anymore, and thus you should not be trying to override it.

 

Or even better... Check out other people's example code! Yay!

Linked below is an excellent tutorial on modding in 1.12.2: https://github.com/TheGreyGhost/MinecraftByExample/tree/master/

  • Thanks 1

Some tips:

  Reveal hidden contents

 

Posted

Yes. Delete them and find the 1.12.2 equivalents by using the IDE or online documentations.

Some tips:

  Reveal hidden contents

 

Posted

Uh oh, there is something weird going on for me. world.isRemote is giving off an error even though the boolean is used correctly in an if statement, and it is saying that it can not be resolved. Is this normal?

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

    • Managed to solve the issue myself. Solved by a fresh modpack instance.
    • Hello, so straight to the problem. Today i wanted to startup Enigmatica as usual and it just wont startup. Last night everything worked fine, i didnt even turn off my pc. Crash log: https://mclo.gs/GJ6Kcy1
    • Rubidium and Embeddium are versions of the same mod, you can only have one. I believe Embeddium is the one that's actively maintained.
    • Hello, New to modding, but have a solid CS foundation. I've created multiple custom BlockEntities that all have the same issue, which is that the inventory only updates on right click (overriding the useItemOn method). I've seen multiple posts on here outlining a similar issue to mine, but I've already implemented the solution of: overriding the correct methods in the BlockEntity class and calling setChanged(). I've tried every different place for setChanged() to no success. I'm wondering if I'm missing something else or if there was some change to sending data to the client in 1.21.5? Or will I have to use a custom packet sender? Here is the code for one of my BlockEntity classes with a single inventory slot: public class MyCustomBlockEntity extends BlockEntity { public final ItemStackHandler inventory = new ItemStackHandler(1) { @Override protected int getStackLimit(int slot, @NotNull ItemStack stack) { return 1; } @Override protected void onContentsChanged(int slot) { setChanged(); if (!level.isClientSide()) { level.setBlockAndUpdate(getBlockPos(), getBlockState()); } } }; public MyCustomBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.MY_CUSTOM_BE.get(), pPos, pBlockState); } public void clearContents() { inventory.setStackInSlot(0, ItemStack.EMPTY); } public void dropItem() { SimpleContainer inv = new SimpleContainer(inventory.getSlots()); inv.setItem(0, inventory.getStackInSlot(0)); Containers.dropContents(this.level, this.worldPosition, inv); } @Override public void setRemoved() { dropItem(); super.setRemoved(); } @Override protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.saveAdditional(pTag, pRegistries); pTag.put("inventory", inventory.serializeNBT(pRegistries)); } @Override protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.loadAdditional(pTag, pRegistries); inventory.deserializeNBT(pRegistries, pTag.getCompound("inventory").get()); } @Override public Packet<ClientGamePacketListener> getUpdatePacket() { return ClientboundBlockEntityDataPacket.create(this); } @Override public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) { return saveWithoutMetadata(pRegistries); } } Mostly encountering the issue when calling the clearContents() method anywhere outside of useItemOn() in the Block class. I've also tried overriding both the handleUpdateTag() and onDataPacket() methods, calling their super along with loadAdditional(), but neither changed the outcome. Thanks in advance for any replies.
    • Hi all! I’m working on a Jurassic Park-themed mod for Minecraft 1.20.1, aiming to include dinosaurs, fossils, DNA extraction, and cool machines. This is a free project, mainly passion-driven, and I’ll give full credit to everyone involved. this is the perfect opportunity for beginners of modeling and coding. This project will give you experience and a creative freedom If you love dinosaurs and Minecraft modding, hit me up! Thanks! Add Me ogfrost. <--- Discord
  • 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.