-
Posts
307 -
Joined
-
Last visited
Posts posted by Tschipp
-
-
1 minute ago, KeeganDeathman said:
Really you should move to JSON, just saying
If you want to things like entities or special TEs, you can't use JSON
-
I made a custom model using MrCrayfish's modeler, and I can't seem to get the texutres working. The model works, all textures are just the black/purple box.
There are no errors in the console.
All textures are in the correct folder, I know that because the break particle texture is correct.
This is my model:
{ "textures": { "particle" : "forgottenitems:blocks/base_down" }, "elements": [ { "name": "Base", "from": [ 0.0, 0.0, 0.0 ], "to": [ 16.0, 3.0, 16.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_side", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, "east": { "texture": "forgottenitems:blocks/base_side", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, "south": { "texture": "forgottenitems:blocks/base_side", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, "west": { "texture": "forgottenitems:blocks/base_side", "uv": [ 0.0, 0.0, 16.0, 3.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } }, { "name": "Edge1", "from": [ 0.0, 3.0, 0.0 ], "to": [ 1.0, 6.0, 1.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Edge2", "from": [ 15.0, 3.0, 0.0 ], "to": [ 16.0, 6.0, 1.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Edge3", "from": [ 15.0, 3.0, 15.0 ], "to": [ 16.0, 6.0, 16.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Edge4", "from": [ 0.0, 3.0, 15.0 ], "to": [ 1.0, 6.0, 16.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 1.0, 1.0 ] } } }, { "name": "Center1", "from": [ 1.0, 3.0, 1.0 ], "to": [ 15.0, 6.0, 15.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 14.0, 3.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 14.0, 3.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 14.0, 3.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 14.0, 3.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 14.0, 14.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 14.0, 14.0 ] } } }, { "name": "Center2", "from": [ 0.0, 6.0, 0.0 ], "to": [ 16.0, 12.0, 16.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 6.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 6.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 6.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 6.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } } }, { "name": "Cube", "from": [ 2.0, 12.0, 2.0 ], "to": [ 14.0, 13.0, 14.0 ], "faces": { "north": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, "east": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, "south": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, "west": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, "up": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 12.0, 12.0 ] }, "down": { "texture": "forgottenitems:blocks/base_down", "uv": [ 0.0, 0.0, 12.0, 12.0 ] } } }, { "name": "Cube", "from": [ 4.0, 13.0, 4.0 ], "to": [ 12.0, 14.0, 12.0 ], "faces": { "north": { "texture": "blocks/beacon", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "east": { "texture": "blocks/beacon", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "south": { "texture": "blocks/beacon", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "west": { "texture": "blocks/beacon", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, "up": { "texture": "blocks/beacon", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, "down": { "texture": "blocks/beacon", "uv": [ 0.0, 0.0, 8.0, 8.0 ] } } } ] }
-
2 minutes ago, diesieben07 said:
You register your ICustomModelLoader in ModelRegistryEvent using ModelLoaderRegistry.registerLoader.
When you set up a MDK workspace you will have Forge as a library available to you. Alternatively you can find the code on Github.
Whoops, I thought you meant acutal examples.
EDIT: Also, congrats on 5000 rep!
-
2 hours ago, diesieben07 said:
- ICustomModelLoader: Basically what it says on the tin, this is something that knows how to take a model file (from the assets) and read/parse it. For example the OBJ loader knows how to read OBJ files.
- IModel: A representation of a model's data in code. An IModel cannot be rendered, it merely "knows all the data" about the model, but still allows modification (e.g. retexturing or transformation). This is what's produced from ICustomModelLoader when it loads a model file.
- IBakedModel: A compact model representation that can be rendered. You obtain this from the IModel and basically it just contains a list of BakedQuads. Every IBakedModel also has an ItemOverrideList associated with it, which allows the model to substitute a different model right before an Item is rendered based on that Item (this is what you need).
As for example, there are quite a few in the Forge codebase.
Thanks, just two more things: How and where do I register all this stuff and can you give me the link to the Forge codebase? I couldn't find it.
-
22 hours ago, diesieben07 said:
You will need to write a custom model implementation (using ICustomModelLoader, IModel, IBakedModel and ItemOverrideList) and then bake new models on the fly based on contained block's model.
Oh dear, that sounds really complicated... I don't know why, but all model and rendering stuff seems to be the hardest thing about modding to me. Can you maybe try to explain what each of these elements do, or where I can find a tutorial or sample code? I didn't find any.
-
I'm trying to make an Item that looks like a block (Has the model of a block with 6 same sides).
The Item should have a NBT tag where the block name and meta is stored (like minecraft:log, 2). It then gets the texture of that block that it is in NBT and applies it to its model.
So in the end I will have a Item that looks like any block and changes its texture based on NBT.
How would I go about creating something like this?
-
3 hours ago, Leomelonseeds said:
post your code please
It's pretty generic, but here you go:
ItemArmor:
package tschipp.forgottenitems.items; import java.util.List; import java.util.UUID; import javax.annotation.Nullable; import com.google.common.collect.Multimap; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import tschipp.forgottenitems.FIM; import tschipp.forgottenitems.models.ModelGolemArmor; import tschipp.forgottenitems.util.FIHelper; public class ItemGolemArmor extends ItemArmor { private int id; private static final UUID[] ARMOR_MODIFIERS = new UUID[] {UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")}; public ItemGolemArmor(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, int id) { super(materialIn, renderIndexIn, equipmentSlotIn); registerItem(name); this.setCreativeTab(FIM.forgottenItems); this.id = id; } private void registerItem(String name) { super.setUnlocalizedName(name); GameRegistry.register(this, new ResourceLocation(FIM.MODID + ":" + name)); } @Override @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack stack) { return "" + TextFormatting.DARK_AQUA + I18n.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name"); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { tooltip.add("Hard like a Rock"); } @Override @SideOnly(Side.CLIENT) @Nullable public ModelBiped getArmorModel(EntityLivingBase living, ItemStack stack, EntityEquipmentSlot slot, ModelBiped defaultModel) { if(!stack.isEmpty()) { if(stack.getItem() instanceof ItemArmor) { ModelGolemArmor armorModel = (ModelGolemArmor) FIM.proxy.getGolemArmor().get(this); if(armorModel != null) { armorModel.bipedHead.showModel = slot == EntityEquipmentSlot.HEAD; armorModel.bipedHeadwear.showModel = slot == EntityEquipmentSlot.HEAD; armorModel.bipedBody.showModel = slot == EntityEquipmentSlot.CHEST; armorModel.bipedRightArm.showModel = slot == EntityEquipmentSlot.CHEST; armorModel.bipedLeftArm.showModel = slot == EntityEquipmentSlot.CHEST; armorModel.LeftLeg.showModel = slot == EntityEquipmentSlot.LEGS; armorModel.RightLeg.showModel = slot == EntityEquipmentSlot.LEGS; armorModel.LeftFoot.showModel = slot == EntityEquipmentSlot.FEET; armorModel.RightFoot.showModel = slot == EntityEquipmentSlot.FEET; armorModel.isSneak = defaultModel.isSneak; armorModel.isRiding = defaultModel.isRiding; armorModel.isChild = defaultModel.isChild; if(living instanceof EntityArmorStand) armorModel.swingProgress = 0; armorModel.rightArmPose = defaultModel.rightArmPose; armorModel.leftArmPose = defaultModel.leftArmPose; return armorModel; } } } return null; } @Override public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot); if (equipmentSlot == this.armorType) { multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", (double)this.damageReduceAmount, 0)); multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", (double)this.toughness, 0)); multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier("generic.knockbackResistance", 0.25, 0)); } return multimap; } @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { if(player.isSneaking() && !world.isRemote && player.isCreative()) { FIHelper.printCraftingRecipe(world, player, this.id); return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } else { return super.onItemRightClick(world, player, hand); } } }
ModelBiped:
// Date: 15.02.2017 19:20:43 // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package tschipp.forgottenitems.models; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelGolemArmor extends ModelBiped { //fields private ModelRenderer righta1; private ModelRenderer Shoulderright; private ModelRenderer Shoulderleft; private ModelRenderer lefta1; private ModelRenderer righta2; private ModelRenderer lefta2; private ModelRenderer righta3; private ModelRenderer lefta3; private ModelRenderer righta4; private ModelRenderer lefta4; private ModelRenderer righta5; private ModelRenderer lefta5; private ModelRenderer Body1; private ModelRenderer Body2; private ModelRenderer Body3; private ModelRenderer Body4; private ModelRenderer Body5; private ModelRenderer Body6; private ModelRenderer Body7; private ModelRenderer Body8; private ModelRenderer rightl1; private ModelRenderer rightl2; private ModelRenderer rightl3; private ModelRenderer rightl4; private ModelRenderer rightl5; private ModelRenderer rightl6; private ModelRenderer leftl1; private ModelRenderer leftl2; private ModelRenderer leftl3; private ModelRenderer leftl4; private ModelRenderer leftl5; private ModelRenderer leftl6; private ModelRenderer RF1; private ModelRenderer LF1; private ModelRenderer RF2; private ModelRenderer LF2; private ModelRenderer RF3; private ModelRenderer LF3; public ModelRenderer RightLeg; public ModelRenderer LeftLeg; public ModelRenderer RightFoot; public ModelRenderer LeftFoot; private ModelRenderer H1; private ModelRenderer H2; private ModelRenderer H3; private ModelRenderer H4; private ModelRenderer H5; private ModelRenderer H6; private ModelRenderer H7; private ModelRenderer H8; private ModelRenderer H9; private ModelRenderer H10; public ModelGolemArmor(float scale) { super(scale, 0, 64, 64); textureWidth = 64; textureHeight = 64; righta1 = new ModelRenderer(this, 0, 43); righta1.addBox(-5F, -0.6F, -3F, 2, 7, 6); righta1.setRotationPoint(0,0,0); righta1.setTextureSize(64, 64); righta1.mirror = true; setRotation(righta1, 0F, 0F, -0.1487144F); Shoulderright = new ModelRenderer(this, 15, 33); Shoulderright.addBox(-4F, -3F, -3F, 6, 2, 6); Shoulderright.setRotationPoint(0,0,0); Shoulderright.setTextureSize(64, 64); Shoulderright.mirror = true; setRotation(Shoulderright, 0F, 0F, -0.2268928F); Shoulderleft = new ModelRenderer(this, 15, 33); Shoulderleft.addBox(-2F, -3F, -3F, 6, 2, 6); Shoulderleft.setRotationPoint(0,0,0); Shoulderleft.setTextureSize(64, 64); Shoulderleft.mirror = true; setRotation(Shoulderleft, 0F, 0F, 0.2268928F); lefta1 = new ModelRenderer(this, 0, 43); lefta1.addBox(3F, -0.6F, -3F, 2, 7, 6); lefta1.setRotationPoint(0,0,0); lefta1.setTextureSize(64, 64); lefta1.mirror = true; setRotation(lefta1, 0F, 0F, 0.1487195F); righta2 = new ModelRenderer(this, 52, 33); righta2.addBox(-3F, -1F, -3F, 4, 5, 2); righta2.setRotationPoint(0,0,0); righta2.setTextureSize(64, 64); righta2.mirror = true; setRotation(righta2, -0.1487144F, 0F, 0F); lefta2 = new ModelRenderer(this, 52, 33); lefta2.addBox(-1F, -1F, -3F, 4, 5, 2); lefta2.setRotationPoint(0,0,0); lefta2.setTextureSize(64, 64); lefta2.mirror = true; setRotation(lefta2, -0.1487144F, 0F, 0F); righta3 = new ModelRenderer(this, 52, 33); righta3.addBox(-3F, -1F, 1F, 4, 5, 2); righta3.setRotationPoint(0,0,0); righta3.setTextureSize(64, 64); righta3.mirror = true; setRotation(righta3, 0.1487195F, 0F, 0F); lefta3 = new ModelRenderer(this, 52, 33); lefta3.addBox(-1F, -1F, 1F, 4, 5, 2); lefta3.setRotationPoint(0,0,0); lefta3.setTextureSize(64, 64); lefta3.mirror = true; setRotation(lefta3, 0.1487195F, 0F, 0F); righta4 = new ModelRenderer(this, 39, 34); righta4.addBox(-3F, 3F, -4F, 4, 3, 2); righta4.setRotationPoint(0,0,0); righta4.setTextureSize(64, 64); righta4.mirror = true; setRotation(righta4, 0.1858931F, 0F, 0F); lefta4 = new ModelRenderer(this, 39, 34); lefta4.addBox(-1F, 3F, -4F, 4, 3, 2); lefta4.setRotationPoint(0,0,0); lefta4.setTextureSize(64, 64); lefta4.mirror = true; setRotation(lefta4, 0.1858931F, 0F, 0F); righta5 = new ModelRenderer(this, 39, 34); righta5.addBox(-3F, 3F, 2F, 4, 3, 2); righta5.setRotationPoint(0,0,0); righta5.setTextureSize(64, 64); righta5.mirror = true; setRotation(righta5, -0.185895F, 0F, 0F); lefta5 = new ModelRenderer(this, 39, 34); lefta5.addBox(-1F, 3F, 2F, 4, 3, 2); lefta5.setRotationPoint(0,0,0); lefta5.setTextureSize(64, 64); lefta5.mirror = true; setRotation(lefta5, -0.185895F, 0F, 0F); Body1 = new ModelRenderer(this, 0, 35); Body1.addBox(-4.5F, 0F, -3F, 5, 6, 2); Body1.setRotationPoint(0F, 0F, 0F); Body1.setTextureSize(64, 64); Body1.mirror = true; setRotation(Body1, -0.0743572F, 0.1487144F, 0F); Body2 = new ModelRenderer(this, 0, 35); Body2.addBox(-0.5F, 0F, -3F, 5, 6, 2); Body2.setRotationPoint(0F, 0F, 0F); Body2.setTextureSize(64, 64); Body2.mirror = true; setRotation(Body2, -0.0743572F, -0.1487195F, 0F); Body3 = new ModelRenderer(this, 0, 35); Body3.addBox(-4.5F, 5.5F, -4F, 5, 6, 2); Body3.setRotationPoint(0F, 0F, 0F); Body3.setTextureSize(64, 64); Body3.mirror = true; setRotation(Body3, 0.074351F, 0.1487144F, 0F); Body4 = new ModelRenderer(this, 0, 35); Body4.addBox(-0.5F, 5.5F, -4F, 5, 6, 2); Body4.setRotationPoint(0F, 0F, 0F); Body4.setTextureSize(64, 64); Body4.mirror = true; setRotation(Body4, 0.074351F, -0.1487195F, 0F); Body5 = new ModelRenderer(this, 0, 35); Body5.addBox(-4.5F, 0F, 1F, 5, 6, 2); Body5.setRotationPoint(0F, 0F, 0F); Body5.setTextureSize(64, 64); Body5.mirror = true; setRotation(Body5, 0.074351F, -0.1485624F, 0F); Body6 = new ModelRenderer(this, 0, 35); Body6.addBox(-0.5F, 0F, 1F, 5, 6, 2); Body6.setRotationPoint(0F, 0F, 0F); Body6.setTextureSize(64, 64); Body6.mirror = true; setRotation(Body6, 0.074351F, 0.1487195F, 0F); Body7 = new ModelRenderer(this, 0, 35); Body7.addBox(-4.5F, 5.5F, 2F, 5, 6, 2); Body7.setRotationPoint(0F, 0F, 0F); Body7.setTextureSize(64, 64); Body7.mirror = true; setRotation(Body7, -0.074351F, -0.1485624F, 0F); Body8 = new ModelRenderer(this, 0, 35); Body8.addBox(-0.5F, 5.5F, 2F, 5, 6, 2); Body8.setRotationPoint(0F, 0F, 0F); Body8.setTextureSize(64, 64); Body8.mirror = true; setRotation(Body8, -0.074351F, 0.1485624F, 0F); rightl1 = new ModelRenderer(this, 33, 9); rightl1.addBox(-2F, 0F, -3F, 4, 5, 1); rightl1.setRotationPoint(0,0,0); rightl1.setTextureSize(64, 64); rightl1.mirror = true; setRotation(rightl1, -0.1115358F, 0F, 0F); rightl2 = new ModelRenderer(this, 33, 9); rightl2.addBox(-2F, 4.4F, -4F, 4, 5, 1); rightl2.setRotationPoint(0,0,0); rightl2.setTextureSize(64, 64); rightl2.mirror = true; setRotation(rightl2, 0.111544F, 0F, 0F); rightl3 = new ModelRenderer(this, 33, 9); rightl3.addBox(-2F, 0F, 2F, 4, 5, 1); rightl3.setRotationPoint(0,0,0); rightl3.setTextureSize(64, 64); rightl3.mirror = true; setRotation(rightl3, 0.111544F, 0F, 0F); rightl4 = new ModelRenderer(this, 33, 9); rightl4.addBox(-2F, 4.4F, 3F, 4, 5, 1); rightl4.setRotationPoint(0,0,0); rightl4.setTextureSize(64, 64); rightl4.mirror = true; setRotation(rightl4, -0.1115358F, 0F, 0F); rightl5 = new ModelRenderer(this, 33, 9); rightl5.addBox(-2F, 0F, -3F, 4, 5, 1); rightl5.setRotationPoint(0,0,0); rightl5.setTextureSize(64, 64); rightl5.mirror = true; setRotation(rightl5, -0.1115358F, 1.570796F, 0F); rightl5.mirror = false; rightl6 = new ModelRenderer(this, 33, 9); rightl6.addBox(-2F, 4.4F, -4F, 4, 5, 1); rightl6.setRotationPoint(0,0,0); rightl6.setTextureSize(64, 64); rightl6.mirror = true; setRotation(rightl6, 0.111544F, 1.570796F, 0F); leftl1 = new ModelRenderer(this, 33, 9); leftl1.addBox(-2F, 0F, -3F, 4, 5, 1); leftl1.setRotationPoint(0,0,0); leftl1.setTextureSize(64, 64); leftl1.mirror = true; setRotation(leftl1, -0.1115358F, 0F, 0F); leftl2 = new ModelRenderer(this, 33, 9); leftl2.addBox(-2F, 4.4F, -4F, 4, 5, 1); leftl2.setRotationPoint(0,0,0); leftl2.setTextureSize(64, 64); leftl2.mirror = true; setRotation(leftl2, 0.111544F, 0F, 0F); leftl3 = new ModelRenderer(this, 33, 9); leftl3.addBox(-2F, 0F, 2F, 4, 5, 1); leftl3.setRotationPoint(0,0,0); leftl3.setTextureSize(64, 64); leftl3.mirror = true; setRotation(leftl3, 0.111544F, 0F, 0F); leftl4 = new ModelRenderer(this, 33, 9); leftl4.addBox(-2F, 4.4F, 3F, 4, 5, 1); leftl4.setRotationPoint(0,0,0); leftl4.setTextureSize(64, 64); leftl4.mirror = true; setRotation(leftl4, -0.1115358F, 0F, 0F); leftl5 = new ModelRenderer(this, 33, 9); leftl5.addBox(-2F, 0F, 2F, 4, 5, 1); leftl5.setRotationPoint(0,0,0); leftl5.setTextureSize(64, 64); leftl5.mirror = true; setRotation(leftl5, 0.1102874F, 1.570796F, 0F); leftl6 = new ModelRenderer(this, 33, 9); leftl6.addBox(-2F, 4.4F, 3F, 4, 5, 1); leftl6.setRotationPoint(0,0,0); leftl6.setTextureSize(64, 64); leftl6.mirror = true; setRotation(leftl6, -0.111544F, 1.570796F, 0F); RightLeg = new ModelRenderer(this, 0, 0); RightLeg.addBox(0F, 0F, 0F, 1, 1, 1); RightLeg.setRotationPoint(0, 0, 0); RightLeg.setTextureSize(64, 64); RightLeg.mirror = true; setRotation(RightLeg, 0F, 0F, 0F); LeftLeg = new ModelRenderer(this, 0, 0); LeftLeg.addBox(0F, 0F, 0F, 1, 1, 1); LeftLeg.setRotationPoint(0, 0, 0); LeftLeg.setTextureSize(64, 64); LeftLeg.mirror = true; setRotation(LeftLeg, 0F, 0F, 0F); RF1 = new ModelRenderer(this, 0, 57); RF1.addBox(-3F, 10F, -3F, 6, 1, 6); RF1.setRotationPoint(0,0,0); RF1.setTextureSize(64, 64); RF1.mirror = true; setRotation(RF1, 0F, 0F, 0F); LF1 = new ModelRenderer(this, 0, 57); LF1.addBox(-3F, 10F, -3F, 6, 1, 6); LF1.setRotationPoint(0,0,0); LF1.setTextureSize(64, 64); LF1.mirror = true; setRotation(LF1, 0F, 0F, 0F); RF2 = new ModelRenderer(this, 17, 41); RF2.addBox(-3F, 11F, -6F, 6, 2, 9); RF2.setRotationPoint(0,0,0); RF2.setTextureSize(64, 64); RF2.mirror = true; setRotation(RF2, 0F, 0F, 0F); LF2 = new ModelRenderer(this, 17, 41); LF2.addBox(-3F, 11F, -6F, 6, 2, 9); LF2.setRotationPoint(0,0,0); LF2.setTextureSize(64, 64); LF2.mirror = true; setRotation(LF2, 0F, 0F, 0F); RF3 = new ModelRenderer(this, 16, 52); RF3.addBox(-3F, 9.433333F, -7.466667F, 6, 1, 4); RF3.setRotationPoint(0,0,0); RF3.setTextureSize(64, 64); RF3.mirror = true; setRotation(RF3, 0.1487144F, 0F, 0F); RF3.mirror = false; LF3 = new ModelRenderer(this, 16, 52); LF3.addBox(-3F, 9.4F, -7.5F, 6, 1, 4); LF3.setRotationPoint(0,0,0); LF3.setTextureSize(64, 64); LF3.mirror = true; setRotation(LF3, 0.1487144F, 0F, 0F); RightFoot = new ModelRenderer(this, 0, 0); RightFoot.addBox(0F, 0F, 0F, 1, 1, 1); RightFoot.setRotationPoint(0,0,0); RightFoot.setTextureSize(64, 64); RightFoot.mirror = true; setRotation(RightFoot, 0F, 0F, 0F); LeftFoot = new ModelRenderer(this, 0, 0); LeftFoot.addBox(0F, 0F, 0F, 1, 1, 1); LeftFoot.setRotationPoint(0,0,0); LeftFoot.setTextureSize(64, 64); LeftFoot.mirror = true; setRotation(LeftFoot, 0F, 0F, 0F); H1 = new ModelRenderer(this, 42, 50); H1.addBox(-4.666667F, -4.5F, -5F, 1, 4, 10); H1.setRotationPoint(0F, 0F, 0F); H1.setTextureSize(64, 64); H1.mirror = true; setRotation(H1, 0F, 0F, -0.1487144F); H2 = new ModelRenderer(this, 42, 50); H2.addBox(-5.7F, -7.166667F, -5F, 1, 4, 10); H2.setRotationPoint(0F, 0F, 0F); H2.setTextureSize(64, 64); H2.mirror = true; setRotation(H2, 0F, 0F, 0.1487195F); H3 = new ModelRenderer(this, 42, 50); H3.addBox(3.7F, -4.5F, -5F, 1, 4, 10); H3.setRotationPoint(0F, 0F, 0F); H3.setTextureSize(64, 64); H3.mirror = true; setRotation(H3, 0F, 0F, 0.1487195F); H4 = new ModelRenderer(this, 42, 50); H4.addBox(4.7F, -7.2F, -5F, 1, 4, 10); H4.setRotationPoint(0F, 0F, 0F); H4.setTextureSize(64, 64); H4.mirror = true; setRotation(H4, 0F, 0F, -0.1487144F); H5 = new ModelRenderer(this, 19, 57); H5.addBox(-4F, -4.5F, 3.7F, 8, 4, 1); H5.setRotationPoint(0F, 0F, 0F); H5.setTextureSize(64, 64); H5.mirror = true; setRotation(H5, -0.1487144F, 0F, 0F); H6 = new ModelRenderer(this, 19, 57); H6.addBox(-4F, -7.2F, 4.7F, 8, 4, 1); H6.setRotationPoint(0F, 0F, 0F); H6.setTextureSize(64, 64); H6.mirror = true; setRotation(H6, 0.1487195F, 0F, 0F); H7 = new ModelRenderer(this, 42, 50); H7.addBox(8F, -2.3F, -5F, 1, 4, 10); H7.setRotationPoint(0F, 0F, 0F); H7.setTextureSize(64, 64); H7.mirror = true; setRotation(H7, 0F, 0F, -1.301251F); H8 = new ModelRenderer(this, 42, 50); H8.addBox(-9F, -2.3F, -5F, 1, 4, 10); H8.setRotationPoint(0F, 0F, 0F); H8.setTextureSize(64, 64); H8.mirror = true; setRotation(H8, 0F, 0F, 1.301248F); H9 = new ModelRenderer(this, 47, 40); H9.addBox(-4F, -8F, -5F, 8, 3, 1); H9.setRotationPoint(0F, 0F, 0F); H9.setTextureSize(64, 64); H9.mirror = true; setRotation(H9, 0F, 0F, 0F); H10 = new ModelRenderer(this, 48, 45); H10.addBox(-1F, -5F, -5F, 2, 2, 1); H10.setRotationPoint(0F, 0F, 0F); H10.setTextureSize(64, 64); H10.mirror = true; setRotation(H10, 0F, 0F, 0F); bipedLeftArm.addChild(Shoulderleft); bipedLeftArm.addChild(lefta1); bipedLeftArm.addChild(lefta2); bipedLeftArm.addChild(lefta3); bipedLeftArm.addChild(lefta4); bipedLeftArm.addChild(lefta5); bipedRightArm.addChild(Shoulderright); bipedRightArm.addChild(righta1); bipedRightArm.addChild(righta2); bipedRightArm.addChild(righta3); bipedRightArm.addChild(righta4); bipedRightArm.addChild(righta5); bipedBody.addChild(Body1); bipedBody.addChild(Body2); bipedBody.addChild(Body3); bipedBody.addChild(Body4); bipedBody.addChild(Body5); bipedBody.addChild(Body6); bipedBody.addChild(Body7); bipedBody.addChild(Body8); RightLeg.addChild(rightl1); RightLeg.addChild(rightl2); RightLeg.addChild(rightl3); RightLeg.addChild(rightl4); RightLeg.addChild(rightl5); RightLeg.addChild(rightl6); bipedRightLeg.addChild(RightLeg); LeftLeg.addChild(leftl1); LeftLeg.addChild(leftl2); LeftLeg.addChild(leftl3); LeftLeg.addChild(leftl4); LeftLeg.addChild(leftl5); LeftLeg.addChild(leftl6); bipedLeftLeg.addChild(LeftLeg); RightFoot.addChild(RF1); RightFoot.addChild(RF2); RightFoot.addChild(RF3); bipedRightLeg.addChild(RightFoot); LeftFoot.addChild(LF1); LeftFoot.addChild(LF2); LeftFoot.addChild(LF3); bipedLeftLeg.addChild(LeftFoot); bipedHead.addChild(H1); bipedHead.addChild(H2); bipedHead.addChild(H3); bipedHead.addChild(H4); bipedHead.addChild(H5); bipedHead.addChild(H6); bipedHead.addChild(H7); bipedHead.addChild(H8); bipedHead.addChild(H9); bipedHead.addChild(H10); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } }
-
-
I'm trying to make armor that has the knockback resistance attribute modifier on it.
I've tried this in my armor clas:
@Override public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot); if (equipmentSlot == this.armorType) { multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", (double)this.damageReduceAmount, 0)); multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", (double)this.toughness, 0)); multimap.put(SharedMonsterAttributes.KNOCKBACK_RESISTANCE.getName(), new AttributeModifier("generic.knockbackResistance", 0.25, 0)); } return multimap; }
I use the "add" operation and a value of 0.25, so when the player is wearing the entire set, he has a knockback resistance of 1 (which would prevent all knockback, right?).
It works and appears in game, but I get full knockback resistance even when only wearing one armor piece. The knockback resistance also stays on the player even if he isn't wearing any armor at all, it resets when he dies.
So, what do I need to change? I changed the operation to "% additive" and "% multiplicative", but those didn't seem to have any effect.
-
6 hours ago, Spyeedy said:
Firstly, you are adding your boots as child of the legs hence they share the same rotation point and your setting your rotation point in your boots hence why your boots moved down. Change the float value of your rotation point all to 0.
Secondly, why are you rendering your boots again when you've rendered with addChild?
Thank you so much, that was exactly the problem. I'm very new to models.
-
-
1 minute ago, WildHeart said:
Why? I use the vanilla texture minecraft. Yes, and I'm more interested in the option of repainting, but then you can't leave a not working code))
Am I understanding something wrong? If your problem is, that the texture is blue and not black or whatever, you might want to not use the vanilla texture (which is blue). Just create a new texture. Then again, I might not be understanding what the problem is. Mind showing some pictures?
-
5 minutes ago, WildHeart said:
public FluidOil() { super("fluidOil", new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/water_flow")); }
I have no experience with fluids, but might this have anything to do with it? Try making a custom Texture.
-
I tried having a go at custom armor models, as it seemed fairly simple.
I followed this tutorial, which was made for 1.10.2. Has something major changed in 1.11, or am I just messing up once again? Anyway, my problem is the armor gets rendered very weirdly.
Here, some pictures:
The first picture shows a model of simple boots, as I modeled them in Te
chne. I made the positions of all the parts the same as the legs, and I changed the offset, just like described in the tutorial.
However, Ingame, it shows up like this:
The boots are streched out weirdly, and some other part is showing below the player that I didn't model. The boots also don't have a back-texture (I used the default generated texture)
Also, while moving it looks like this:
As you can see, the part that is correct is not moving with the legs, however the part that magically appeared is moving...
This is my ItemArmor class:
package tschipp.forgottenitems.items; import java.util.List; import javax.annotation.Nullable; import tschipp.forgottenitems.FIM; import tschipp.forgottenitems.models.ModelCushionedBoots; import tschipp.forgottenitems.models.ModelGolemArmor; import tschipp.forgottenitems.util.FIHelper; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ItemCushionedBoots extends ItemArmor { public ItemCushionedBoots(ArmorMaterial material) { super(material, 1, EntityEquipmentSlot.FEET); registerItem("cushioned_boots"); this.setCreativeTab(FIM.forgottenItems); } private void registerItem(String name) { super.setUnlocalizedName(name); GameRegistry.register(this, new ResourceLocation(FIM.MODID + ":" + name)); } @Override @SideOnly(Side.CLIENT) public String getItemStackDisplayName(ItemStack stack) { return "" + TextFormatting.RED + I18n.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name"); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { tooltip.add("Softens your fall"); } @Override @SideOnly(Side.CLIENT) @Nullable public ModelBiped getArmorModel(EntityLivingBase living, ItemStack stack, EntityEquipmentSlot slot, ModelBiped defaultModel) { if(!stack.isEmpty()) { if(stack.getItem() instanceof ItemArmor) { ModelCushionedBoots armorModel = FIM.proxy.getCushionedBootsModel(); armorModel.bipedRightLeg.showModel = slot == EntityEquipmentSlot.FEET; armorModel.bipedLeftLeg.showModel = slot == EntityEquipmentSlot.FEET; armorModel.isSneak = defaultModel.isSneak; armorModel.isRiding = defaultModel.isRiding; armorModel.isChild = defaultModel.isChild; armorModel.rightArmPose = defaultModel.rightArmPose; armorModel.leftArmPose = defaultModel.leftArmPose; return armorModel; } } return null; } @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { if(player.isSneaking() && !world.isRemote && player.isCreative()) { FIHelper.printCraftingRecipe(world, player, 19); } return new ActionResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } }
And this is the model:
// Date: 16.02.2017 21:54:36 // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package tschipp.forgottenitems.models; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelCushionedBoots extends ModelBiped { //fields private ModelRenderer Right1; private ModelRenderer Left1; private ModelRenderer Right2; private ModelRenderer Left2; public ModelCushionedBoots(float scale) { super(scale, 0, 64, 64); textureWidth = 64; textureHeight = 64; Right1 = new ModelRenderer(this, 36, 0); Right1.addBox(-3F, 10F, -5F, 5, 2, 8); Right1.setRotationPoint(-2F, 12F, 0F); Right1.setTextureSize(64, 64); Right1.mirror = true; setRotation(Right1, 0F, 0F, 0F); Left1 = new ModelRenderer(this, 36, 0); Left1.addBox(-2F, 10F, -5F, 5, 2, 8); Left1.setRotationPoint(2F, 12F, 0F); Left1.setTextureSize(64, 64); Left1.mirror = true; setRotation(Left1, 0F, 0F, 0F); Right2 = new ModelRenderer(this, 0, 0); Right2.addBox(-3F, 7F, -3F, 5, 3, 6); Right2.setRotationPoint(-2F, 12F, 0F); Right2.setTextureSize(64, 64); Right2.mirror = true; setRotation(Right2, 0F, 0F, 0F); Left2 = new ModelRenderer(this, 0, 0); Left2.addBox(-2F, 7F, -3F, 5, 3, 6); Left2.setRotationPoint(2F, 12F, 0F); Left2.setTextureSize(64, 64); Left2.mirror = true; setRotation(Left2, 0F, 0F, 0F); this.bipedRightLeg.addChild(Right1); this.bipedRightLeg.addChild(Right2); this.bipedLeftLeg.addChild(Left1); this.bipedLeftLeg.addChild(Left2); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Right1.render(f5); Left1.render(f5); Right2.render(f5); Left2.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } }
And the clientProxy:
package tschipp.forgottenitems.util; import java.util.HashMap; import java.util.Map; import net.minecraft.client.model.ModelBiped; import net.minecraft.item.Item; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import tschipp.forgottenitems.items.ItemCraftingRune; import tschipp.forgottenitems.items.ItemList; import tschipp.forgottenitems.items.ItemRendering; import tschipp.forgottenitems.models.ModelCushionedBoots; import tschipp.forgottenitems.models.ModelGolemArmor; public class ClientProxy extends CommonProxy { private static final ModelGolemArmor golemArmor = new ModelGolemArmor(1.0f); private static final ModelGolemArmor golemArmorLegs = new ModelGolemArmor(0.5f); private static final ModelCushionedBoots cushionedBoots = new ModelCushionedBoots(0.5F); public static final Map<Item, ModelBiped> golemArmorModels = new HashMap<Item, ModelBiped>(); public void preInit(FMLPreInitializationEvent event) { super.preInit(event); ItemRendering.registerItemRenders(); golemArmorModels.put(ItemList.golemHelmet, golemArmor); golemArmorModels.put(ItemList.golemChestplate, golemArmor); golemArmorModels.put(ItemList.golemLeggings, golemArmorLegs); golemArmorModels.put(ItemList.golemBoots, golemArmor); } public void init(FMLInitializationEvent event) { super.init(event); FMLClientHandler.instance().getClient().getItemColors().registerItemColorHandler(new ItemCraftingRune.Color(), ItemList.craftingRune); } public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } @Override public Map<Item, ModelBiped> getGolemArmor() { return golemArmorModels; } @Override public ModelCushionedBoots getCushionedBootsModel() { return cushionedBoots; } }
So, where did I mess up? Because it's certainly me overlooking something trivial again
-
2 minutes ago, diesieben07 said:
Depends on what you want to achieve. As far as I can tell from your code you are trying to smelt a block in the world, right? The most accurate ItemStack representation of a block you can get is by calling getPickBlock on the Block. And then to place it back down you'd have to simulate onItemUse on the Item, but the block might smelt into an item that does not represent a block (e.g. Iron Ore into Iron), you would have to handle that.
Ok, I'll try it. But out of sheer why should I not use these two methods? I see that Block::getStateFromMeta is deprecated, but why?
-
3 minutes ago, diesieben07 said:
- Why do you call super.onItemRightClick but then completely ignore the result?
I implement another class made by me, it's just some debug stuff.
4 minutes ago, diesieben07 said:- Never ever call Block::getMetaFromState (or Block::getStateFromMeta).
What should I use instead?
-
Beware, it's a mess:
public static void addHeat(ItemStack stack, int heat) { stack.getItem().setDamage(stack, stack.getItemDamage() - heat); //stack.damageItem(-heat, new EntityPig(null)); } public static void removeHeat(ItemStack stack, int heat) { stack.getItem().setDamage(stack, stack.getItemDamage() + heat); //stack.damageItem(heat, new EntityPig(null)); } @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { super.onItemRightClick(world, player, hand); ItemStack stack = player.getHeldItem(hand); RayTraceResult ray = this.rayTrace(world, player, true); ItemStack stack2 = stack.copy(); if(ray != null && ray.getBlockPos() != null) { BlockPos pos = ray.getBlockPos(); if(world.getBlockState(pos).getBlock() == Blocks.LAVA) { addHeat(stack2, 10); world.setBlockToAir(ray.getBlockPos()); return new ActionResult(EnumActionResult.SUCCESS, stack2); } } return new ActionResult(EnumActionResult.PASS, stack); } @Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); int meta = block.getMetaFromState(state); Map<ItemStack, ItemStack> smelting = FurnaceRecipes.instance().getSmeltingList(); ItemStack blockstack = new ItemStack(block, 1, meta); ItemStack stack2 = stack.copy(); if(stack.getItemDamage() < 1000 && !world.isRemote) { if(FurnaceRecipes.instance().getSmeltingResult(blockstack) != null) { ItemStack output = FurnaceRecipes.instance().getSmeltingResult(blockstack); Block outputblock = Block.getBlockFromItem(output.getItem()); int outputmeta = output.getMetadata(); if(outputblock != Blocks.AIR || !FIConfig.heatTalismanCreatesItems) { IBlockState outputstate = outputblock.getStateFromMeta(outputmeta); world.setBlockState(pos, outputstate); removeHeat(stack2, 1); ((WorldServer)world).spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.25D, (double)pos.getZ() + 0.5D, 8, 0.5D, 0.25D, 0.5D, 0.0D, new int[0]); world.playSound((EntityPlayer)null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.3F, 0.8F / (itemRand.nextFloat() * 0.1F + 0.8F)); player.setHeldItem(hand, stack2); return EnumActionResult.SUCCESS; } else if(!output.isEmpty()) { removeHeat(stack2, 1); output.setCount(1); world.spawnEntity(new EntityItem(world, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, output)); world.setBlockToAir(pos); ((WorldServer)world).spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.25D, (double)pos.getZ() + 0.5D, 8, 0.25D, 0.25D, 0.25D, 0.0D, new int[0]); world.playSound((EntityPlayer)null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.3F, 0.8F / (itemRand.nextFloat() * 0.1F + 0.8F)); player.setHeldItem(hand, stack2); return EnumActionResult.SUCCESS; } } } return EnumActionResult.FAIL; }
-
12 minutes ago, diesieben07 said:
See my reply in the other thread:
No, that sadly also doesn't do the trick
-
So my problem seems pretty simple:
I want to damage an ItemStack, even when the Player is in Creative Mode
So far, i've used
ItemStack#setItemDamage
ItemStack#damageItem
Item#setDamage
but nothing has worked. I've passed null as EntityLivingBase in ItemStack#damageItem, results in a NullPointerException. I have even passed a newly created EntityPig as argument, it still somehow did the creative mode check and didn't damage the item...
So, what is the solution here? Events? Nbt? Or am I just simply overlooking something major?
-
It somehow still does a creative mode check, even when using a entityPig as the argument... There must be a simpler way to damage an item in creative mode...
You know what, I'll just open a new thread for it.
-
2 hours ago, Draco18s said:
Inside the ItemStack class. IIRC, If the entity passed in is null, that check can't be made (because there is no entity, and the damage just happens).
No, it crashes with a null pointer. I guess I'll try making it any arbitrary entity, like an EntityPig
-
4 minutes ago, Choonster said:
Create your own copy of the ItemStack#damageItem method without the creative mode check.
I am currently using the ItemStack#setItemDamage method, but there still seems to be some sort of creative mode check somewhere, as the item isn't damageable while in creative mode.
Where is this check even happening?
-
I have one more unrelated question that is not worth opening an entire new thread:
How do you damage/repair an item if the player is in creative mode?
-
1 minute ago, Choonster said:
You mentioned an ore recipe, but you didn't mention that the ingredient was an ore dictionary entry.
In that case, you need to use OreDictionary.WILDCARD_VALUE when adding your item to the ore dictionary.
Ah I see, sorry I wasn't clear enough.
Techne Missing?
in Modder Support
Posted
No they don't