@SideOnly(Side.CLIENT)
public ModelBiped getSpidermanModelArmor(ItemStack stack, Entity entity, int slot)
{
return new ModelArmor(0.5F, 64, 64);
}
I'm guessing it does? The ModelArmor creates the extra layer of armor as the 1.8 < x version skins does.
No, it doesn't. You should store the model instances in fields (like I've been telling you to do) instead of returning a new one every time the method is called.
I got that command from the mcforums however it only worked in 1.10.2 until a mob spawned in. This sounds like a stupid feature they add 4 million nbt functions for 1.10.2 then they say only creative people can edit or read nbt? Well what about maps they reqiure nbt to be read from the player for certain functions why does anybody want to play that version?
was this only affected by 1.10.2 only or 1.8.9 and 1.8 to.
It looks like Forge added a patch in 1.8 that only allows the NBT reading on these blocks for OPs (to fix MC-75630 - Exploit with signs and command blocks), then Mojang added this themselves in 1.8.6. 1.9 added the additional check for Creative Mode, but also the ability to pass null as the EntityPlayer argument of ItemBlock.setTileEntityNBT to skip the check completely.
Only Mob Spawners, Signs and Command Blocks are restricted in this way, other TileEntity blocks will use the NBT from "BlockEntityTag" regardless of the player's OP/Creative Mode status.
My mob spawner always said missing model textures with underscore 0 through 15 or higher. However it renders the model in the world before the render override was there. Even if I get the texture working wont render code only render it as a block? Since its liquid its still less then a block.
It's hard to help you with the missing textures if you're only going to paraphrase the errors. Post the full log with the errors if you want help with them.
What do you actually want the liquid spawner to render as? A liquid or a regular model with the water texture?
Oh sorry, I misunderstood your explanation. I thought you were telling me to remove the annotation.
Like so? Code here.
You don't want to create a new instance of your models every time the method is called (there'd be no point in having the fields at all if that was the case). Only create an instance of the model and store it in the field if the field's current value is null.
1.10.2 is permantly glitched. I did a vanilla command that is suppose to place down a spawner with a specified entity and it doesn until you log out or it spawns in a single entity. I think I should report this this is all vanilla. on the ide with forge it didn't even show anything besides a pig. I tried the other format with the array nbt and that didn't even give me an item this is the only thing that worked
If you post the code/commands that didn't work, I can probably tell you what you did wrong.
Keep in mind that Minecraft won't read the NBT from "BlockEntityTag" when you place down a Mob Spawner, Sign or Command Block (or anything else that returns true from TileEntity#onlyOpsCanSetNbt) if you're not in Creative Mode or not an OP.
I am going to have to use manual read nbt like 1.7 again but, this time it's a nightmare it tries to override any of my nbt reading code. I will just have to use this format and hopefully it will work. this doesn't mean setting the block it means getting the tile entity at is pos andthen setting it using setblock format.
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie"}}
If you want to bypass the Creative Mode/OP restriction, you'll need to do one of two things:
Create your own Item that places the vanilla Block (like ItemBlockSpecial) and pass null as the EntityPlayer argument of ItemBlock#setTileEntityNBT
Create your own Block and TileEntity (extending BlockMobSpawner/TileEntityMobSpawner) and override TileEntity#onlyOpsCanSetNbt to return false.
Like this? Code here. For some reason, the width of the armor is expanding instead of the width AND the height.
Do not initialise fields marked as @SideOnly inline. FML will remove the field itself, but not the initialiser. This will crash the dedicated server when an instance of the class is created. You need to initialise the fields lazily when their values are first needed, i.e. in your getArmorModel method.
You don't need to check for each slot, just return the body model if it's not the legs slot.
I can't help you much more with the models themselves.
the render code is what makes the texture go blank. I noticed alot of render code and open gl mixer codes in the liquid class. So if I just created a block without those codes It wouldn't look the same.
@Override
public int getRenderType()
{
return 3;
}
There should be an error in the log telling you why the model failed to load.
According to this Mojang page, only Java versions below 8u60 will work with first- and second-generation Intel HD graphics chipsets; which I suspect you have. Mojang's launcher apparently handles this automatically, which would be why you don't experience this crash outside of the development environment.
Either downgrade Java to 8u51 or get a proper graphics card that doesn't have this problem.
The reason why I need these liquids to be full blocks is because, you can't see the tile entity in the lava block which means I would have to cut some of the texture out which would look ugly if it was a half water slab liquid thing.
Screenshot
BlockLiquid overrides Block#getRenderType to return 1 (in 1.8) or EnumBlockRenderType.LIQUID (in 1.10.2), which renders the block with vanilla's liquid renderer instead of the baked model system. Override this to return 3 (in 1.8) or EnumBlockRenderType.MODEL (in 1.10.2) to render the block with the baked model system.
I am also having issues with the leaf spawner block as well. I got it to render the foliage in the world but, in the inventory or anywhere else it appears to be silver completly ignoring my code. The names are different because, gist won't allow the same names.
In 1.8, you need to use an ItemBlock class that overrides the colour-related Item methods to call the corresponding methods of the Block. Vanilla uses ItemLeaves for its leaf blocks, you should create a similar class. Use an overload of GameRegistry.registerBlock that takes a Class<? extends ItemBlock> argument to register your Block, passing the Class object of the ItemBlock class you created as this argument.
In 1.10.2, all colour-related methods in Block and Item have been replaced by IBlockColor and IItemColor. You need to create an implementation of each of these (using an anonymous class or lambda, don't implement them on your Block/Item) and register them with the BlockColors/ItemColors instances in init.
Side notes:
There's no reason to implement ITileEntityProvider or extend BlockContainer, instead you should override Block#hasTileEntity(IBlockState) to return true and Block#createTileEntity to create and return a new instance of the TileEntity.
Always annotate override methods with @Override so you get a compilation error if they don't actually override a super method.
I want to check if right item has current enchantment then I want to check the enchantment level. And if the config option for enchants is disable completly ignore the enchantment check(I don't know why some people would want this but, I heard that some did so I am going to add that feature).
In 1.10.2, EnchantmentHelper#getEnchantmentLevel will return 0 if the ItemStack doesn't have the Enchantment and the Map returned by EnchantmentHelper#getEnchantments won't have a value for any Enchantment not on the ItemStack.
I will try changing the hand code to get the item and nbt. I will also take a look later at bucket code(sounds like a plugin mod?).
You're thinking of Bukkit, which is completely unrelated.
Edit: RayTraceResult.Type.BLOCK/Also filled bucket where is that at? what is that under starting this in 1.8 will backport to 1.7.10 and port to later versions later? I found some code online copied it then modified it some.
RayTraceResult was called MovingObjectPosition in 1.8. The FillBucketEvent#result field was public in 1.8, so just set it directly instead of calling the setter method I mentioned.
How do you get the tile entity from the liquid block? It keeps returning null and crashes if I write that to nbt.
You're trying to get the TileEntity for your LiquidMobSpawner blocks and it's returning null? I'm not sure why that would happen, your code looks correct.
Let be more specific. I need to get the enchantment from the item and then the level.I just want to check to see if it has a specified item. That method returns an int.
If you want to get the level of a specific Enchantment on an ItemStack, use EnchantmentHelper.getEnchantmentLevel. If you want to get the level of every Enchantment on an ItemStack, use EnchantmentHelper#getEnchantments.
The entity name is on the tag I just don't know how to use nbt structure. Here is the nbt below
The top-level tag is a compound tag (NBTTagCompound). Use NBTTagCompound#getCompoundTag to get the compound tag with the key "SpawnData" from the top-level tag, then use NBTTagCompound#getString to get the string with the key "id" from the "SpawnData" compound tag.
The get current equiped item requires enum hand which isn't a boolean. So I can't use that argument. I am trying to get the item from the hand. So it's either active hand or swinging hand that I saw.
Block harvesting always uses the item in the player's main hand, which you can get with EntityLivingBase#getHeldItemMainhand. Other parts of the code will usually give you the relevant EnumHand and/or held item.
I finally got the water and lava mob spawners to be liquid and with it's material properties. I have two issues with this. One of the issues is that it isn't a full block like I would want it to be and any attempt I have made to make it a full block has resaulted in a blank texture.
I'm not sure why this would happen. Post your code, model and a screenshot of the issue.
The other issue is the vanilla bucket will pick the block up and give me a water bucket. I tried to disable it with an event handler but, that didn't work. My intent is if you don't have silk touch on a bucket then it will give you water / lava and it already does this. I can't disable the function though when I have a silk touch bucket or even without a silk touch bucket. I can't seem to disable the function to give me my modded bucket.
You should be able to do the following:
Subscribe to FillBucketEvent
Check that the RayTraceResult isn't null and its typeOfHit field is RayTraceResult.Type.BLOCK
Check that the empty bucket (FillBucketEvent#getEmptyBucket) is Items.BUCKET
Check that the block at the RayTraceResult's BlockPos is your spawner
If the empty bucket has Silk Touch, set the resulting item (FillBucketEvent#setFilledBucket) to an ItemStack of the spawner with the appropriate NBT
If it doesn't, set the resulting item to a bucket of the appropriate liquid
Set the event's result (Event#setResult) to Event.Result.ALLOW to allow the resulting item to be added to the player's inventory
0
The fields that store the model instances.
When the getArmorModel method is called:
0
You're still creating the model instances every time. Only create and store the model instances once, i.e. when the value of the fields is null.
0
No, it doesn't. You should store the model instances in fields (like I've been telling you to do) instead of returning a new one every time the method is called.
0
It looks like Forge added a patch in 1.8 that only allows the NBT reading on these blocks for OPs (to fix MC-75630 - Exploit with signs and command blocks), then Mojang added this themselves in 1.8.6. 1.9 added the additional check for Creative Mode, but also the ability to pass null as the EntityPlayer argument of ItemBlock.setTileEntityNBT to skip the check completely.
Only Mob Spawners, Signs and Command Blocks are restricted in this way, other TileEntity blocks will use the NBT from "BlockEntityTag" regardless of the player's OP/Creative Mode status.
It's hard to help you with the missing textures if you're only going to paraphrase the errors. Post the full log with the errors if you want help with them.
What do you actually want the liquid spawner to render as? A liquid or a regular model with the water texture?
0
Does getSpidermanModelArmor store the model instances properly?
0
You don't want to create a new instance of your models every time the method is called (there'd be no point in having the fields at all if that was the case). Only create an instance of the model and store it in the field if the field's current value is null.
0
If you post the code/commands that didn't work, I can probably tell you what you did wrong.
Keep in mind that Minecraft won't read the NBT from "BlockEntityTag" when you place down a Mob Spawner, Sign or Command Block (or anything else that returns true from TileEntity#onlyOpsCanSetNbt) if you're not in Creative Mode or not an OP.
If you want to bypass the Creative Mode/OP restriction, you'll need to do one of two things:
0
That's not what I said.
Keep the annotation, remove the initialisers and initialise the fields in the getArmorModel method.
0
Do not initialise fields marked as @SideOnly inline. FML will remove the field itself, but not the initialiser. This will crash the dedicated server when an instance of the class is created. You need to initialise the fields lazily when their values are first needed, i.e. in your getArmorModel method.
You don't need to check for each slot, just return the body model if it's not the legs slot.
I can't help you much more with the models themselves.
0
There should be an error in the log telling you why the model failed to load.
0
PlayerList was called ServerConfigurationManager in 1.7.10.
1.7.10 is extremely outdated and no longer supported by Forge, you should update to 1.10.2.
0
Either downgrade Java to 8u51 or get a proper graphics card that doesn't have this problem.
0
BlockLiquid overrides Block#getRenderType to return 1 (in 1.8) or EnumBlockRenderType.LIQUID (in 1.10.2), which renders the block with vanilla's liquid renderer instead of the baked model system. Override this to return 3 (in 1.8) or EnumBlockRenderType.MODEL (in 1.10.2) to render the block with the baked model system.
In 1.8, you need to use an ItemBlock class that overrides the colour-related Item methods to call the corresponding methods of the Block. Vanilla uses ItemLeaves for its leaf blocks, you should create a similar class. Use an overload of GameRegistry.registerBlock that takes a Class<? extends ItemBlock> argument to register your Block, passing the Class object of the ItemBlock class you created as this argument.
In 1.10.2, all colour-related methods in Block and Item have been replaced by IBlockColor and IItemColor. You need to create an implementation of each of these (using an anonymous class or lambda, don't implement them on your Block/Item) and register them with the BlockColors/ItemColors instances in init.
Side notes:
In 1.10.2, EnchantmentHelper#getEnchantmentLevel will return 0 if the ItemStack doesn't have the Enchantment and the Map returned by EnchantmentHelper#getEnchantments won't have a value for any Enchantment not on the ItemStack.
You're thinking of Bukkit, which is completely unrelated.
RayTraceResult was called MovingObjectPosition in 1.8. The FillBucketEvent#result field was public in 1.8, so just set it directly instead of calling the setter method I mentioned.
You're trying to get the TileEntity for your LiquidMobSpawner blocks and it's returning null? I'm not sure why that would happen, your code looks correct.
0
Yes,
0
If you want to get the level of a specific Enchantment on an ItemStack, use EnchantmentHelper.getEnchantmentLevel. If you want to get the level of every Enchantment on an ItemStack, use EnchantmentHelper#getEnchantments.
The top-level tag is a compound tag (NBTTagCompound). Use NBTTagCompound#getCompoundTag to get the compound tag with the key "SpawnData" from the top-level tag, then use NBTTagCompound#getString to get the string with the key "id" from the "SpawnData" compound tag.
Block harvesting always uses the item in the player's main hand, which you can get with EntityLivingBase#getHeldItemMainhand. Other parts of the code will usually give you the relevant EnumHand and/or held item.
I'm not sure why this would happen. Post your code, model and a screenshot of the issue.
You should be able to do the following: