-
Posts
334 -
Joined
-
Last visited
Everything posted by hugo_the_dwarf
-
ah I see this is your error: item.damageItem(item.getItemDamage() + 1, entity); just use item.damageItem(1, entity); why is that killing it so fast well break something once 0 + 0 + 1 break another 1 + 1 + 1 3 + 3 + 1 7 + 7 +1 15 + 15 + 1 so on and so forth the first number is the damage of the item already, the second is you grabbing the damage, then adding 1. It basically breaks faster the more you use it. so just need item.damageItem(1, entity);
-
I just finished my college classes, so In know the feels. Github is down apparently I'll check it later to see if it's up.
-
good to know, I know the basics of java and a *few* advanced stuff, so I normally check for !null just to be safe. I know with my code I just kinda started 1.7.2 moved some classes over from 1.6.4 updated what needed updating, and I think somewhere inbetween I forgot to set something up.
-
en_US.lang Wont Work When Mod Is Exported
hugo_the_dwarf replied to Setlock's topic in Modder Support
is it in your assets.modId.lang folder/package? -
en_US.lang Wont Work When Mod Is Exported
hugo_the_dwarf replied to Setlock's topic in Modder Support
what do you mean by not right? what does the file look like? -
Alright I think I messed something up really bad, I can right click the block, I get a message saying it was activated, then nothing. So I'll just post my mod here: https://github.com/Hugo-the-Dwarf/Rise-of-Tristram/tree/master/src/main/java/ee/rot I officially have no idea what i'm doing. It worked fine in 1.6.4, I'm probably not registering or loading something right somewhere and I'm missing it completely.
-
did you push your changes? so I can check the github at the code again?
-
Hey I just edited my above example, have you tried using the "damageItem(int,EntitiyLivingBase)" method? I tossed that in the edited code above.
-
so this: @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getBlockTileEntity(x, y, z); switch(ID) { case 0: if(entity != null && entity instanceof TileEntityRepairBox) { return new ContainerRepairBox(player.inventory, (TileEntityRepairBox) entity); } else if (entity != null && entity instanceof TileEntitySpawnerBlock) { return new ContainerSpawnerBlock(player.inventory, (TileEntitySpawnerBlock) entity); } else if (entity != null && entity instanceof TileEntityItemGen) { return new ContainerItemGen(player.inventory, (TileEntityItemGen) entity); } else { return null; } default: return null; } } I'd just have it go: @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } and then of course just use packets inside the GUI (like I was planning) and that will be fine? Or did I get that all wrong?
-
Now I'm not super new to this topic as I have followed a few tutorials on the workings of this, but they rely on GUIs that are connected to containers (inventories) I want my to be connected to a tileEntity (or ref to it) so I can send a packet to it after I set everything up with buttons in the GUI, and I'm just having a bit of difficulty trying to translate how to call it without a container. I'll post the code that I currently use. Line of code in the Main class that defines the GUIHandler: NetworkRegistry.INSTANCE.registerGuiHandler(this, new CommonProxy()); I have no doubt this doesn't need to change at all. But posting it to show I have it. (also it's in the FMLInitializationEvent which most would call the Load or Init event of a mod) CommonProxy code (the parts that the handle the GUI) Seems a bit weird I'm not sure who's tutorial I was looking at to make this, I know it had only one, but I tossed some more else if's in there and it worked pretty fine for those inventory entities. Block method that calls the instance of opening the GUI Going out on the limb here and assuming this won't need to be changed at all, posting just to show that I have it Gui Class Now I was a bit curious and seen it extends GuiContainer, and that extends GuiScreen. So would I be able to just make it extend GuiScreen and make my own custom one or would it doing so mean I have to incorporate a ton of methods to work correctly? Ok so there is a container class for the GUI but that works fine, that is not the problem. What I want to know is how can I create just a simple GUI that doesn't need a container because it's for player interaction only (nothing to do with inventory items, just a player, and a tileEntity) and openning it. I hope I made some sort of sense I tend to have trouble explaining.
-
for (int ix = -1; ix < 2; ix++) { for (int iy = -1; iy < 2; iy++) { for (int iz = -1; iz < 2; iz++) { Block canIBreak = world.getBlock(ix, iy, iz); if (canIBreak.equals(Blocks.cobblestone) || canIBreak.equals(Blocks.stone) || canIBreak.equals(Blocks.stonebrick) || canIBreak.equals(Blocks.sandstone)) { world.func_147480_a(x+ix, y+iy, z+iz, true); item.damageItem(1,player); } } } } inside you have your item.setItemDamage(item.getItemDamage() + 27); in the triple forloop just make it add 1 not 27. that way it only procs when it works, might want to move it into the if statement too (if breaks something, damage myself, if not move on) and the reason why it can break the unbreakable or untargeted is because you get your boolean then you just go to town with that. just as long as you broke one of the target blocks everything else is fair game. use your check right in the for loop nest the item = null part may crash minecraft so hopefully you don't need it, but the idea is there
-
A simple rundown of how I would explain it (this is how I think of it) is events are called on pretty much everything and every action by anything. So larsgerrits suggested 'instanceof' which is very helpful for finding the right type of entity to deal with, lets say you want to do a check or update for every living thing @SubscribeEvent public void onLivingUpdateEvent(LivingUpdateEvent event) { This is how you will hook into any EntityLivingBase's update event, so if you wanted all players, wolves, iron golems, and villagers to "slowly heal" you would need: @SubscribeEvent public void onLivingUpdateEvent(LivingUpdateEvent event) { if (event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; player.heal(0.025f); } else if (event.entity instanceof EntityIronGolem) { EntityIronGolem golem = (EntityIronGolem) event.entity; golem.heal(0.05f); } else if (event.entity instanceof EntityVillager) { EntityVillager villager = (EntityVillager) event.entity; villager.heal(0.075f); } else if (event.entity instanceof EntityWolf) { EntityWolf wolf = (EntityWolf) event.entity; wolf.heal(0.05f); } } I'd really suggest going through a few tutorials on this (like I have) either jabelar's that he posted above or CoolAlias's [1.7.2][1.6.4] EventHandler and IExtendedEntityProperties.
-
Hey I've been working on this for a week now, searching and reading up on all the posts about this and the tutorials. However I get crashes when I register my custom packets/messages "net.registerMessage(customPacketHandler.class, customPacket.class, packetId++, Side.SERVER);" From what I read in posts they use the proxies, however I have no idea how to use it, or use it correctly. I can't find any tutorials or read any posts that make sense to me, all I want is to be able to start using custom GUIs to control tileEntities and other information. And so I would like to ask for some kind of example of doing this whole setup, I really would like to get started on this my mod is so backlogged from this. Would anyone be nice enough to show me, how to code "The registering of messages/packets", "Sending the packets/messages", and "receiving these messages/packets in a tileEntity". Also just for references these are the threads I've found and read: https://gist.github.com/CatDany/4a3df7fcb3c8270cf70b http://www.minecraftforge.net/forum/index.php/topic,22201.0.html http://www.minecraftforge.net/forum/index.php/topic,20135.0.html http://www.minecraftforge.net/forum/index.php/topic,20138.0.html I've tried to understand these and I fail time and time again, and this is my last resort to ask for some kind of visual code example of how to do this. Thanks for any that respond.
-
public TileEntityAngellicInfuser() { slots = new ItemStack[4]; } this.addSlotToContainer(new Slot(teAngellicInfuser, 0, 49, 35)); this.addSlotToContainer(new Slot(teAngellicInfuser, 1, 49, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 2, 7, 40)); this.addSlotToContainer(new SlotAngellicInfuser(invPlayer.player, teAngellicInfuser, 3, 143, 34)); //Is this intentional? looks broken to me. this.addSlotToContainer(new Slot(teAngellicInfuser, 4, 49, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 5, 67, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 6, 67, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 7, 67, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 8, 85, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 9, 85, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 10, 85, 53)); well the issue here is your container. In your tileEntity you setup 4 slots (0-3 this is done in the constructor posted first in this reply) then in your container you try to add 11 slots (0-10) in which you will get a crash once it reaches "this.addSlotToContainer(new Slot(teAngellicInfuser, 4, 49, 53));" that is if the line before it does crash it hard (placed comment next to offending code) my guess is that it's crashing because index out of array. try adding 11 slots to your tileEntity instead of 4 and see how it goes.
-
Change Block Texture on Right-Click
hugo_the_dwarf replied to Noodly_Doodly's topic in Modder Support
override "onBlockActivated" params in it are :World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ then inside you can check for the player.getHeldItem() and set the blocks metaData if(!world.isRemote) { if (player.getHeldItem().getItem().equals(Items.apple)) world.setBlockMetadataWithNotify(x, y, z, metaData, 2); } return true; metaData will be 0-15 (16 spots? from what I remember people saying) and all you have to do is register your icons and display the correct one through the GetIcon method. -
[1.7.2] Problems with SimpleNetworkWrappers and IMessages SOLVED!
hugo_the_dwarf replied to Kant0sh's topic in Modder Support
Well I saw this fellow post this in Paintings and Packets I haven't tried it get, but I bookmarked it and will give it a shot when I can, maybe it can help you? -
Thing that is more important, and kinda want to ask it here. How can a block detect an explosion (creeper, tnt, ghast,etc) and "absorb" or nullify the dmg/destruction. There is a flower in Botania that will absorb the force of a tnt blast and turn it into power. Is that just checking for an event? or is there a way for the block to "detect" an explosion and cancel it out?
-
why is the myPane the only one tossed into Load? put it up with the rest public static Block SampleBlock = new SampleBlockClass(3000, Material.glass).setBlockName("SampleBlock"); public static Block LuxWhiteBlock = new LuxWhiteClass(3001, Material.rock).setBlockName("LuxWhiteBlock"); public static Block Wood01 = new Wood1Class(3003, Material.wood).setBlockName("Wood01"); public static Block Wood02 = new Wood2Class(3002, Material.wood).setBlockName("Wood02"); public static Block myPane; just make this one = new BlockPaneRot...... public static Block ChWhiteBlock = new ChWhiteClass(3004, Material.wood).setBlockName("ChWhiteBlock");
-
What he means is you are registering the block before you actually make it. like GameRegister(MyBLock,"name") then you try to say MyBlock = newBlock; can't do that. define the object then register it. Look at the order of this: public static Block myPane; ----- myPane = new BlockPaneRot("stone", "cobblestone", Material.rock, false).setHardness(1.5F).setResistance(10.0F).setBlockName("stoneSheet"); ----- GameRegistry.registerBlock(myPane, myPane.getUnlocalizedName().substring(5));
-
I tried it, saw the same issue, for some reason BlockPane's constructor is "protected" not sure if that is a forge 'oops' or what. so what I had to do was extend BlockPane then use that like so: import net.minecraft.block.BlockPane; import net.minecraft.block.material.Material; public class BlockPaneRot extends BlockPane { //NOTE when you have eclipse make the constructor for you it *WILL BE 'protected'* so make sure to make this public like below. public BlockPaneRot(String flatFaceTextureName, String rimTextureName, Material mat, boolean bool) { super(flatFaceTextureName, rimTextureName, mat, bool); // TODO Auto-generated constructor stub } } now you can call your mimic of BlockPaneXYZ toss in the textures and set the values of what you want. defining it: public static Block myPane; ----- myPane = new BlockPaneRot("stone", "cobblestone", Material.rock, false).setHardness(1.5F).setResistance(10.0F).setBlockName("stoneSheet"); ----- GameRegistry.registerBlock(myPane, myPane.getUnlocalizedName().substring(5));