Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey there, im working on an electrizity network for my mod and now im struggling with connecting the blocks so they can pass over the energy to each other. what i did is i created a TileEntity_Electric and in there a field called connected. This is the TileEntity_Electric that should receive the energy. Now im trying to set this field with an item. In the item i have a public static TileEntity_Electric that i set like this in onItemRightClick (Called on both sites so i don't need packetHandling):

 

 

@Override

public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {

BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();

if(world.getTileEntity(pos) instanceof TileEntity_Electric){

TileEntity_Electric toConnectTile = (TileEntity_Electric) world.getTileEntity(pos);

if(lastTile!=null&&lastTile!=toConnectTile){

lastTile.connectTo(toConnectTile);

lastTile=toConnectTile;

}

else{

player.addChatMessage(new ChatComponentText("Now in "+EnumChatFormatting.GREEN+"Connection Mode"+EnumChatFormatting.RESET+"To stop connecting, hold SHIFT+RIGHTCLICK! "));

lastTile = toConnectTile;

}

 

}else

{

if(world.getBlockState(pos).getBlock() instanceof BlockAir){

player.addChatMessage(new ChatComponentText("Stopped "+EnumChatFormatting.RED+"Connection Mode"));

lastTile=null;

}

 

}

return stack;

}

 

 

 

I have a GameOverlay in which i can see if a TileEntity_Electric is connected and the tileentity that it is connected with. But somehow - these connected tiles are sometimes tileentities that are have been in the world earlier and sometimes the block that i clicked the first time. What am i doing wrong? Do i have to use another method or put the field somewhere else - please help :(

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.