Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.6.4] Get block icon based on TE
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
andreidim

[1.6.4] Get block icon based on TE

By andreidim, January 9, 2014 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 9, 2014

Hello everyone.

I need to change the individual icons per side of my block, but, it seems like the getBlockTexture function gets called once when the world loads, how could I get the icon based on something from the tile entity?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2405

Draco18s

Draco18s    2405

  • Reality Controller
  • Draco18s
  • Members
  • 2405
  • 15930 posts
Posted January 9, 2014

public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side)

 

It's called any time the block receives an update.

  • Quote

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.

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

That's what I was missing, a block update, tanks :)

  • Quote

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

I just got arround to testing that, it seems like it's not using the server tile entity, how could I get and use that?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7596

diesieben07

diesieben07    7596

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7596
  • 55098 posts
Posted January 10, 2014

I just got arround to testing that, it seems like it's not using the server tile entity, how could I get and use that?

You can't. The server and client can run on different machines, there is no way you can access the server tile entity. If you need the data from there to render properly, you need to sync it with packets.
  • Quote

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

I found a way, I'm using the world provider, that gives you the server world :P

  • Quote

Share this post


Link to post
Share on other sites

Akjosch    4

Akjosch

Akjosch    4

  • Tree Puncher
  • Akjosch
  • Members
  • 4
  • 17 posts
Posted January 10, 2014

I found a way, I'm using the world provider, that gives you the server world :P

 

This will very likely not work with a dedicated server (... but feel free to test it out and report your findings).

  • Quote

ItemBlock is not a Block

ItemStack is not an Item

Damage value is not metadata

 

Stop confusing them.

Share this post


Link to post
Share on other sites

Draco18s    2405

Draco18s

Draco18s    2405

  • Reality Controller
  • Draco18s
  • Members
  • 2405
  • 15930 posts
Posted January 10, 2014
I found a way, I'm using the world provider, that gives you the server world :P

This will very likely not work with a dedicated server (... but feel free to test it out and report your findings).

 

It won't

 

I just got arround to testing that, it seems like it's not using the server tile entity, how could I get and use that?

 

You need to synch your TEs.

 

        public Packet getDescriptionPacket() {
                NBTTagCompound nbtTag = new NBTTagCompound();
                this.writeToNBT(nbtTag);
                return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
        }

        public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) {
                readFromNBT(packet.data);
        }

  • Quote

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.

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

Doing that actually broke my block completely :(

How could I easily update my block? I think that might be a problem, the way I'm updating it doesn't work, it works properly only on a block update

 

And I found another way that might work, using the MinecraftServer.getServer() stuff

 

P.S.:I need to re-render it after I do something to the tile entity

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7596

diesieben07

diesieben07    7596

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7596
  • 55098 posts
Posted January 10, 2014

You can not in any way access the Server from the client if the server is a different machine. How on earth should that work?

You need to sync like Draco said.

  • Quote

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

As I said in my previous post, when I tried to sync them they broke completely... the texture never updates properly, only when I right click on it.

 

I might have found a bug or something... I am doing the world.markBlockForRenderUpdate on the server, the description is telling me that if you put it on the server it doesn't do anything, well, actually, it updates my block properly??? How is that even possible?

  • Quote

Share this post


Link to post
Share on other sites

larsgerrits    514

larsgerrits

larsgerrits    514

  • Reality Controller
  • larsgerrits
  • Members
  • 514
  • 3462 posts
Posted January 10, 2014

You need to do:

world.markBlockForUpdate(x, y, z)

instead of:

world.markBlockForRenderUpdate(x, y, z)

  • Quote

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

Well, markBlockForUpdate is not working, markBlockForRenderUpdate is... Minecraft is like f*** logic

  • Quote

Share this post


Link to post
Share on other sites

andreidim    0

andreidim

andreidim    0

  • Tree Puncher
  • andreidim
  • Forge Modder
  • 0
  • 33 posts
Posted January 10, 2014

I just found out a new thing, Do stuff on the client and server and sync your TEs..Why does no tutorial tell you to sync your tile entities and do stuff on the client and server side?

  • Quote

Share this post


Link to post
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.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • mightymoy
      Cant craft items in modded server

      By mightymoy · Posted 9 minutes ago

      How can I show the servers debug log is it in the log folder and be named debug log? Sorry I'm new to this so I'm not sure how to do that   
    • DaemonUmbra
      Minecraft crashes while launching - failed to find service port for display

      By DaemonUmbra · Posted 11 minutes ago

      More research was done on this issue, this was the result:  
    • DaemonUmbra
      Cant craft items in modded server

      By DaemonUmbra · Posted 13 minutes ago

      This could possibly be the result of recipes failing to be loaded, please provide the server's debug.log
    • Gubipe
      What is the method to left click?

      By Gubipe · Posted 1 hour ago

      Sorry this might sound  dumb, I am new to working with minecraft mods. I was wondering if you could tell me the code location
    • Klarks
      [1.16.4] what difference between custom slots and EquipmentSlotType

      By Klarks · Posted 2 hours ago

      Why i need cal super.getCapability? Is new EntityArmorInvWrapper(entity) doing same thing? LivingEntity. it returns handlers which are LazyOptional<IItemHandlerModifiable>[] and they contains same things what i have already created private final net.minecraftforge.common.util.LazyOptional<?>[] handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this); public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) { if (this.isAlive() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { if (facing == null) return handlers[2].cast(); else if (facing.getAxis().isVertical()) return handlers[0].cast(); else if (facing.getAxis().isHorizontal()) return handlers[1].cast(); } return super.getCapability(capability, facing);   EntityEquipmentInvWrapper public static LazyOptional<IItemHandlerModifiable>[] create(LivingEntity entity) { @SuppressWarnings("unchecked") LazyOptional<IItemHandlerModifiable>[] ret = new LazyOptional[3]; ret[0] = LazyOptional.of(() -> new EntityHandsInvWrapper(entity)); ret[1] = LazyOptional.of(() -> new EntityArmorInvWrapper(entity)); ret[2] = LazyOptional.of(() -> new CombinedInvWrapper(ret[0].orElse(null), ret[1].orElse(null))); return ret; }
  • Topics

    • mightymoy
      2
      Cant craft items in modded server

      By mightymoy
      Started 3 hours ago

    • schmiddi_0
      17
      Minecraft crashes while launching - failed to find service port for display

      By schmiddi_0
      Started December 14, 2020

    • Gubipe
      4
      What is the method to left click?

      By Gubipe
      Started 7 hours ago

    • Klarks
      24
      [1.16.4] what difference between custom slots and EquipmentSlotType

      By Klarks
      Started 23 hours ago

    • Silivek
      1
      Mod won't load when in dev environment

      By Silivek
      Started 12 hours ago

  • Who's Online (See full list)

    • mightymoy
    • zOnlyKroks
    • skeppyfan
    • Luis_ST
    • DaemonUmbra
    • Klarks
    • BastouP
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.6.4] Get block icon based on TE
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community