Having prior knowledge in Java is always good, but from the plugin code examples I've seen (I don't actually program plugins), plugins have a very different syntax, and only work server-side, meaning that you don't need to deal with any of the hassle that the siding system brings. This doesn't really matter if you just want to make some simple blocks/items, but it could get a little painful if you try to move beyond that.
I suppose what I'm trying to say is that you should be fine, so long as you look up a few tutorials on modding beforehand.
As it says in the title, I'm a little stuck. I've been trying to add an armor set with a custom model to a mod I'm working on, but the getArmorModel method (which claims to change your model if you change it to return a new one) is never called, despite having been overwritten in the new armor class.
Ignore what I said above, I was confused. The tag you are retrieving using the getTagCompound.getTag() function should already be a NBTTagCompound, so you should be fine to cast it.
Ok, I think I see what is going on here now. If you replace the method starting on line 98 with the below code, it should work. It is basically a copy paste of the same method, but I am reading the nbt from the stack being passed in and writing it to the TileEntity being placed.
Do you mean that the entire itemStackHandler object was being used to test something?
If not, then you need to find a way to get the information stored in it across, because I'm fairly sure that is where you inventory is being stored, and I don't see anything accessing it to store it in the container of the inventory.
Ok, try this then. In your container class, replace the line
IItemHandler itemHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
I'm not quite sure what you are trying to do here. Is the item filter slot supposed to be the only one that sticks around when you pick it up, or did you want all of them to stay?
I mean do you have it doing the opposite. From what you have said, it sounds like you are saving it correctly, what I'm wondering is if you remembered to load the NBT tags into your TileEntity.
That explains why it never triggered the if statement at all, but I'm still having the issue of it only triggering on either side twice. I did a bit more snooping, and the event only seems to fire four times per time you sleep. Is there a different event that is better if I want the event to do something the whole time you are asleep?
Do you have it set up to read and filter the NBT tag's contents into the inventory of your block?
Edit: I realized that the above might be a little ambiguous. What I meant to ask is if you also have the data being read (Item stack being output) placed into the inventory of the TileEntity.
In the below code, I am attempting to restore mana to the player while they are asleep. However, something weird seems to be going on, and the conditions below never seem to all match up. Additionally, I ran a check to see how often the !event.entity.worldObj.isRemote condition works, and it only seems to be true twice, right when you start sleeping in the bed. Does anyone know a fix/what is causing this?
@SubscribeEvent
public void sleepingEvents(PlayerSleepInBedEvent event)
So, as the title says, I need some help figuring out how to draw a line in a GUI. There are methods to draw vertical and horizontal lines, but I need to draw lines at an angle, and can't seem to figure out how to do so. If anyone has any idea how to do this, help would be appreciated.
0
Having prior knowledge in Java is always good, but from the plugin code examples I've seen (I don't actually program plugins), plugins have a very different syntax, and only work server-side, meaning that you don't need to deal with any of the hassle that the siding system brings. This doesn't really matter if you just want to make some simple blocks/items, but it could get a little painful if you try to move beyond that.
I suppose what I'm trying to say is that you should be fine, so long as you look up a few tutorials on modding beforehand.
0
As it says in the title, I'm a little stuck. I've been trying to add an armor set with a custom model to a mod I'm working on, but the getArmorModel method (which claims to change your model if you change it to return a new one) is never called, despite having been overwritten in the new armor class.
ClientProxy
https://pastebin.com/JwSHCjFe
Common Proxy
https://pastebin.com/1zLKZ048
Armor Class
https://pastebin.com/U9NZbaxy
Armor Model Class
https://pastebin.com/nYcbFb0V
Anyone have any clue why it isn't running?
0
Ok, great, sorry that it took me so long to get it tracked down.
0
Ignore what I said above, I was confused. The tag you are retrieving using the getTagCompound.getTag() function should already be a NBTTagCompound, so you should be fine to cast it.
0
No, sorry, its a little late here, just change it to an NBTBase.
0
Ok, I think I see what is going on here now. If you replace the method starting on line 98 with the below code, it should work. It is basically a copy paste of the same method, but I am reading the nbt from the stack being passed in and writing it to the TileEntity being placed.
https://pastebin.com/jsaYdj7z
0
Ok, where are you storing the NBT when you pick up the block?
0
Do you mean that the entire itemStackHandler object was being used to test something?
If not, then you need to find a way to get the information stored in it across, because I'm fairly sure that is where you inventory is being stored, and I don't see anything accessing it to store it in the container of the inventory.
0
Ok, try this then. In your container class, replace the line
IItemHandler itemHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
with
IItemHandler itemHandler = te.temStack()
(It is on line 52.)
0
I'm not quite sure what you are trying to do here. Is the item filter slot supposed to be the only one that sticks around when you pick it up, or did you want all of them to stay?
0
I mean do you have it doing the opposite. From what you have said, it sounds like you are saving it correctly, what I'm wondering is if you remembered to load the NBT tags into your TileEntity.
Seeing the code would be very helpful.
0
That explains why it never triggered the if statement at all, but I'm still having the issue of it only triggering on either side twice. I did a bit more snooping, and the event only seems to fire four times per time you sleep. Is there a different event that is better if I want the event to do something the whole time you are asleep?
0
Do you have it set up to read and filter the NBT tag's contents into the inventory of your block?
Edit: I realized that the above might be a little ambiguous. What I meant to ask is if you also have the data being read (Item stack being output) placed into the inventory of the TileEntity.
0
In the below code, I am attempting to restore mana to the player while they are asleep. However, something weird seems to be going on, and the conditions below never seem to all match up. Additionally, I ran a check to see how often the !event.entity.worldObj.isRemote condition works, and it only seems to be true twice, right when you start sleeping in the bed. Does anyone know a fix/what is causing this?
public void sleepingEvents(PlayerSleepInBedEvent event)
{
if(event.entity != null && event.entity.worldObj.isRemote && event.entity instanceof EntityPlayerMP)
{
IMagicCapability mana = event.entity.getCapability(MagicProvider.MAGIC_CAP, null);
System.out.println("refilling mana");
if( mana.getMana() <= mana.GetMaxMana()/10)
{
System.out.println("adding" + (mana.getMana() / 100)*(mana.GetMaxMana() / 100) + "maximum mana");
mana.SetMaxMana((mana.GetMaxMana() / 100)*(mana.GetMaxMana() / 100));
mana.setMana(mana.GetMaxMana()/10 + 1);
PacketDispatcher.sendTo(new SyncMaxManaPacket(mana.GetMaxMana()), (EntityPlayerMP)event.entity);
}
if(mana.getMana() < mana.GetMaxMana())
{
mana.fillMana(mana.GetMaxMana() / 100);
PacketDispatcher.sendTo(new SyncManaPacket(mana.getMana()), (EntityPlayerMP)event.entity);
}
System.out.println("current mana " + mana.getMana() + " max mana " + mana.GetMaxMana());
}
}
0
So, as the title says, I need some help figuring out how to draw a line in a GUI. There are methods to draw vertical and horizontal lines, but I need to draw lines at an angle, and can't seem to figure out how to do so. If anyone has any idea how to do this, help would be appreciated.