Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] Connected Textures


Xetapro12
 Share

Recommended Posts

Well, if your using a custom model it's a bit trickier.

If your not, in your getIcon method in your block class, check the surrounding blocks, and return the icon based on the results.

ehh? here is a picture of what i doing http://gyazo.com/07f22df1f164bc783c42bbd04b54d779

i want to make it like the Clear Glass form Tinker's Construct please help i really dont understand the getIcon thing here

NEWB! in java im sorry :/

Link to comment
Share on other sites

Tinkers construct is an open source mod, if you want to make your glass like it look at the code to see how they have done it and try to replicate it.

 

Do not straight up copy the code because it will get you nowhere.

 

I know man but im not thet good at coding yet :/ im still learning thing and the code from tinker's consturct is hard to understand for me :P

NEWB! in java im sorry :/

Link to comment
Share on other sites

ehh? here is a picture of what i doing http://gyazo.com/07f22df1f164bc783c42bbd04b54d779

i want to make it like the Clear Glass form Tinker's Construct please help i really dont understand the getIcon thing here

Then here is an easy way: Make textures for connected textures,

and override the method in the Block class:

  IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)

in there you get the nearby blocks, check them, and select correct texture for it.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

I would also like to give you a tip, don't take this the wrong way, but maybe you should learn Java a bit more and have a good understanding of it before you start modding minecraft. The reason why i say this is that modding minecraft is actually a tricky thing, in my own opinion, despite my 4-5 years of experience programming in Java, not even including the experience I have from programming in other languages before learning Java. So i strongly suggest that you, and others who might not be great at programming in Java, or are trying to learn how to program in Java by modding minecraft, to learn and fully understand Java and this is not directed at you, but others that may not know, the people on this forum do not take the time out of their day to teach you how to program in Java, they generally only assist in helping to solve your problem and answer questions about modding minecraft.

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

Link to comment
Share on other sites

The reason why i say this is that modding minecraft is actually a tricky thing, in my own opinion, despite my 4-5 years of experience programming in Java, not even including the experience I have from programming in other languages before learning Java.

 

I get thrills out of the challenge. <3

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

ehh? here is a picture of what i doing http://gyazo.com/07f22df1f164bc783c42bbd04b54d779

i want to make it like the Clear Glass form Tinker's Construct please help i really dont understand the getIcon thing here

Then here is an easy way: Make textures for connected textures,

and override the method in the Block class:

  IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)

in there you get the nearby blocks, check them, and select correct texture for it.

Also, to add, you can check nearby blocks using the function getBlock from World.

World is not a native part of block, but is passed into the getIcon method. So now you have it!

getBlock takes 3 parameters(those go in the parenthisis), the x y and z coordinates. You get the current block's coords passed into getIcon too, so just be like "world.getBlock(x, y+1, z)" to get the block above the current one.

Then check all the other blocks, and return the texture you want based off that.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

I would also like to give you a tip, don't take this the wrong way, but maybe you should learn Java a bit more and have a good understanding of it before you start modding minecraft. The reason why i say this is that modding minecraft is actually a tricky thing, in my own opinion, despite my 4-5 years of experience programming in Java, not even including the experience I have from programming in other languages before learning Java. So i strongly suggest that you, and others who might not be great at programming in Java, or are trying to learn how to program in Java by modding minecraft, to learn and fully understand Java and this is not directed at you, but others that may not know, the people on this forum do not take the time out of their day to teach you how to program in Java, they generally only assist in helping to solve your problem and answer questions about modding minecraft.

I know the basic of C# so i cna make programs but Java there is a bit hard for me still and i cna HTML good so java hard for me still:/

 

 

 

 

 

 

*just saying i have it hard to learn new things*

NEWB! in java im sorry :/

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.

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

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • thankyou for your input. I grab the GUI object on the GuiOpenEvent and the on the world tick event i keep checking it until the inventory loads. this successfully grabs the chest inventory from the client side. here is my final code. package com.example.examplemod; import java.util.ArrayList; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundContainerClosePacket; import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; import net.minecraft.world.InteractionHand; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.*; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.client.event.GuiContainerEvent; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fmlclient.registry.ClientRegistry; @Mod.EventBusSubscriber public class ForgeEventHandler { private static ArrayList<BlockPos> homeBase = new ArrayList<BlockPos>(); private static Boolean pressed = false; public static final KeyMapping keyBinding = new KeyMapping("pam SETUP", 79, "PAM"); private static Screen GUI = null; @SubscribeEvent public static void setup(FMLClientSetupEvent event) { ClientRegistry.registerKeyBinding(keyBinding); } @SubscribeEvent public static void updatePlayer(TickEvent.PlayerTickEvent event) { /*if(event.player.canEat(false)){ for(ItemStack inventoryStack : event.player.getInventory().items){ if (inventoryStack.isEdible()) { ForgeEventFactory.onItemUseStart(event.player, inventoryStack, 0); ItemStack result = inventoryStack.getItem().finishUsingItem(inventoryStack, event.player.getCommandSenderWorld(), event.player); ForgeEventFactory.onItemUseFinish(event.player, inventoryStack, 0, result); if (!event.player.canEat(false)) { break; } } } }*/ if (keyBinding.isDown() && !pressed) { pressed = true; homeBase.add(((BlockHitResult) Minecraft.getInstance().player.pick(20.0D, 0.0F, false)).getBlockPos()); System.out.println("set postion"); if (homeBase.size()>=2) { System.out.println("opening container"); openBlock(detectContainers(homeBase).get(0)); homeBase.clear(); } if (!keyBinding.isDown()) { pressed=false; } } } @SubscribeEvent public static void updateWorld(TickEvent.WorldTickEvent event) { if (GUI != null) { if (GUI instanceof AbstractContainerScreen) { AbstractContainerScreen container = ((AbstractContainerScreen)GUI); NonNullList<Slot> slots = container.getMenu().slots; for (int i=0; i<slots.size();i++) { ItemStack temp = slots.get(i).getItem(); System.out.print(temp.getDisplayName().getString()+" | "); } System.out.println(""); GUI = null; } } } @SubscribeEvent public static void openChest(GuiOpenEvent event) { GUI = event.getGui(); } private static ArrayList<Vec3> detectContainers(ArrayList<BlockPos> homebase) { ArrayList<Vec3> chests = new ArrayList<Vec3>(); int x = homebase.get(1).getX()-homebase.get(0).getX(); int y = homebase.get(1).getY()-homebase.get(0).getY(); int z = homebase.get(1).getZ()-homebase.get(0).getZ(); for (int i=homebase.get(0).getX();i!=homebase.get(1).getX();i+=Math.signum(x)) { for (int j=homebase.get(0).getY();j!=homebase.get(1).getY();j+=Math.signum(y)) { for (int k=homebase.get(0).getZ();k!=homebase.get(1).getZ();k+=Math.signum(z)) { BlockEntity temp = Minecraft.getInstance().level.getBlockEntity(new BlockPos(i,j,k)); if (temp instanceof RandomizableContainerBlockEntity && !(temp instanceof HopperBlockEntity)) { chests.add(new Vec3(i,j,k)); } } } } return chests; } @SuppressWarnings("resource") private static void openBlock(Vec3 blockPos){ /*BlockHitResult hit = new BlockHitResult(blockPos, Direction.DOWN, new BlockPos(blockPos), false);*/ BlockHitResult hit = (BlockHitResult) Minecraft.getInstance().player.pick(20.0D, 0.0F, false); Minecraft.getInstance().getConnection().send(new ServerboundUseItemOnPacket(InteractionHand.MAIN_HAND,hit)); } }  
    • Yea, you shouldn't be starting the Minecraft server. That starts a vanilla one. You need to start the forge jar and I think you need to use the bat file that gets generated instead of just opening the jar.
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.