Jump to content

ProfitOrange

Forge Modder
  • Posts

    19
  • Joined

  • Last visited

Everything posted by ProfitOrange

  1. Particles are client sided, so by having the if(!attacker.world.isRemote()), they won't appear. Since you have the world parameter, the method won't run unless you have called it from somewhere else, you can simply just get the world from the attacker and remove the world parameter. Below is an example. public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { World world = attacker.world(); //get the world from the attacker if (!world.isRemote()) { target.addPotionEffect(new EffectInstance(Effects.SLOWNESS, 45, 1)); world.playSound(null, attacker.getPosX(), attacker.getPosY(), attacker.getPosZ(), SoundEvents.BLOCK_ANCIENT_DEBRIS_BREAK, SoundCategory.PLAYERS, 1, 1); } else { world.addParticle(new BlockParticleData(ParticleTypes.BLOCK, Blocks.ANCIENT_DEBRIS.getDefaultState()), true, target.getPosX(), target.getPosY() + 0.5D, target.getPosZ(), 0, 1, 0); } return super.hitEntity(stack, target, attacker); }
  2. Next time I rewrite this mod, I definitely will, the only problem is that I have nearly 5,000 files that use that mod ID to reference stuff.
  3. I added a custom item that I want to be dropped from minecraft's wither skeleton, but I can't seem to figure out how to add to loot tables, this is what I have tried: Loot Table Event Class: package com.ProfitOrange.MoShiz.event; import com.ProfitOrange.MoShiz.Reference; import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.loot.LootPool; import net.minecraft.world.storage.loot.TableLootEntry; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class LootTableEvents { private static ResourceLocation wither_skeleton_drops = new ResourceLocation("minecraft", "entities/wither_skeleton"); @SubscribeEvent public static void onLootLoad(LootTableLoadEvent event) { if (event.getName().equals(wither_skeleton_drops)) { event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation(Reference.MOD_ID, "entities/wither_skeleton_mod"))).build()); } } } And the loot table json file: { "type": "minecraft:entity", "pools": [ { "rolls": 1, "entries": [ { "type": "minecraft:item", "functions": [ { "function": "minecraft:set_count", "count": { "min": 0.0, "max": 1.0, "type": "minecraft:uniform" } }, { "function": "minecraft:looting_enchant", "count": { "min": 0.0, "max": 1.0 } } ], "name": "ms:nether/witherbone" } ] } ] } Any help on this issue would be much appreciated.
  4. Thanks for the help, I know this is late, but now everything is working perfectly.
  5. I seem to have an issue when right clicking on the ground with custom sugar cane item. Crashlog: The code in my item class for the sugar cane And my Nether Reed block class I have the Nether Reed block to place and render correctly when using the block version of it, but the issue causes the game to crash as soon as I try placing the nether reed item.
  6. Thanks so much for this, in my mod I have ~48 fences, and I was looking at ~432 .JSON files to create.
  7. Could you post all of your code so I can take a look at it.
  8. This is my food class right now: package com.ProfitOrange.moshiz.init; import com.ProfitOrange.moshiz.MoShizMain; import com.ProfitOrange.moshiz.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraftforge.fml.common.registry.GameRegistry; public class MoShizFoods { public static Item beefSandwich; public static void init() { beefSandwich = new ItemFood(8, 0.8F, false).setUnlocalizedName("beefSandwich").setCreativeTab(MoShizMain.tabGems); } public static void register() { GameRegistry.registerItem(beefSandwich, beefSandwich.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(beefSandwich); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));; } } Then my preInit method in my main class: @EventHandler public void preInit(FMLPreInitializationEvent event) { MoShizFoods.init(); MoShizFoods.register(); } In my ClientProxy class: @Override public void registerRenders() { MoShizFoods.registerRenders(); }
  9. It will look like an untextured block until the .JSON file is used to reference the texture. In your assets folder you need another folder called models, in the models folder you need a folder called item, place the Rubble.JSON file in that item folder.
  10. As of right now due to the sheer amount of JSON files I need to add into my mod, I was wondering on how to change the location of where the mod pulls the .JSON file from, I was able to figure out with the models/block, where it will call the files from models/block/gem. I want to be able to do the same with the models/item folder, where it would call food .JSON files from: models/item/food. That way I don't have 800+ .JSON files in one folder.
  11. Bump, Also, the textures worked fine in Minecraft 1.6.4 so I believe it must have something to do with the new transparency rendering, but I can't seem to figure out what needs to be changed so the icon shows correctly.
  12. So, I created a black stairs block using the black glass texture, but it doesn't seem to show the transparency when holding it. As seen here:
  13. I removed my old code in there. What I'm trying to ask, is how would I be able to call the class like this: public static Block BlackCobbleWall = new WallBlock(coloredcobble, 0).setBlockName("blackcobblewall"); public static Block RedCobbleWall = new WallBlock(coloredcobble, 1).setBlockName("redcobblewall"); public static Block GreenCobbleWall = new WallBlock(coloredcobble, 2).setBlockName("greencobblewall"); And so on through the 16 colored blocks, I'm not trying to make metadata walls, I am trying to use the metadata colored cobble info to create each one of the walls, but the way they are set up by default, they don't have the ability to call metadata blocks
  14. Here is the WallBlock class: package net.minecraft.block; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import com.ProfitOrange.moshiz.MoShizMain; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class WallBlock extends BlockWall { private Block icon; public WallBlock(Block block) { super(block); this.setHardness(block.blockHardness); this.setResistance(block.blockResistance / 3.0F); this.setStepSound(block.stepSound); this.setCreativeTab(MoShizMain.tabDecor); this.icon = block; } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return icon.getBlockTextureFromSide(side); } @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { list.add(new ItemStack(item, 1, 0)); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister icon) {} @Override public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { return true; } } Here is the constructor: public static Block ColoredCobblestoneWall = new WallBlock(coloredcobblestone).setBlockName("coloredcobblestonewall"); I just wanted to be able to do something like this: public static Block ColoredCobblestoneWall = new WallBlock(coloredcobblestone, 1).setBlockName("coloredcobblestonewall"); The 1 after the block being the metadata value for the colored cobblestone which would bring red, thus making a red cobblestone wall. I was able to get the Icons to show the correct cobblestone color, but when I placed it, it showed a black cobblestone wall, being 0 on the metadata
  15. Currently I have my WallBlock class set up so I can create walls by simply creating a constructor. When I tried creating them using my metadata colored cobblestone, I ran into a problem since Minecrafts BlockWall only uses Block, and doesn't have an integer like Minecrafts BlockStairs class does. I have had quite a bit of troubles with this, any help on the matter would be greatly appreciated.
  16. I'm not sure what I am doing wrong, but I cannot seem to find that method.
  17. package com.ProfitOrange.armor; import com.ProfitOrange.moshiz.MoShizArmor; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class HellfireArmor extends ItemArmor { public HellfireArmor(ArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par2EnumArmorMaterial, par3, par4); } public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String type) { if (itemstack.getItem() == MoShizArmor.HellfireHelmet || itemstack.getItem() == MoShizArmor.HellfireChest || itemstack.getItem() == MoShizArmor.HellfireBoots) { return "moshiz:textures/model/armor/hellfire_layer_1.png"; }else if (itemstack.getItem() == MoShizArmor.HellfireLegs) { return "moshiz:textures/model/armor/hellfire_layer_2.png"; }else{ return null; } } public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack){ int hellfire1=0,hellfire2=0,hellfire3=0,hellfire4=0; if (player.getCurrentArmor(4)!=null){ ItemStack helmet=player.getCurrentArmor(4); if(helmet.getItem()==MoShizArmor.HellfireHelmet){ hellfire1=1; } else{ hellfire1=0; } } if (player.getCurrentArmor(3)!=null){ ItemStack chestplate=player.getCurrentArmor(3); if(chestplate.getItem()==MoShizArmor.HellfireChest){ hellfire2=1; } else{ hellfire2=0; } } if (player.getCurrentArmor(2)!=null){ ItemStack leggings=player.getCurrentArmor(2); if(leggings.getItem()==MoShizArmor.HellfireLegs){ hellfire3=1; } else{ hellfire3=0; } } if (player.getCurrentArmor(1)!=null){ ItemStack boots=player.getCurrentArmor(1); if(boots.getItem()==MoShizArmor.HellfireBoots){ hellfire4=1; } else{ hellfire4=0; } } if(hellfire1==1&&hellfire2==1&&hellfire3==1&&hellfire4==1){ player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(),5,0)); } } } Sorry for the confusion, I put the method in the armor class, as I saw other people doing it that way. And for the int thing, the code in there I wrote quite awhile ago and I'm not sure what I was thinking then. Here is the crash log:
  18. In 1.6.4 I used the ITickHandler to add potion effects, only if the player is currently wearing all the armor. Here is my code that I have tried to implement, yet it throws up an out of bounds array error: public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack){ int hellfire1=0,hellfire2=0,hellfire3=0,hellfire4=0; if (player.getCurrentArmor(4)!=null){ ItemStack helmet=player.getCurrentArmor(4); if(helmet.getItem()==MoShizArmor.HellfireHelmet){ hellfire1=1; } else{ hellfire1=0; } } if (player.getCurrentArmor(3)!=null){ ItemStack chestplate=player.getCurrentArmor(3); if(chestplate.getItem()==MoShizArmor.HellfireChest){ hellfire2=1; } else{ hellfire2=0; } } if (player.getCurrentArmor(2)!=null){ ItemStack leggings=player.getCurrentArmor(2); if(leggings.getItem()==MoShizArmor.HellfireLegs){ hellfire3=1; } else{ hellfire3=0; } } if (player.getCurrentArmor(1)!=null){ ItemStack boots=player.getCurrentArmor(1); if(boots.getItem()==MoShizArmor.HellfireBoots){ hellfire4=1; } else{ hellfire4=0; } } if(hellfire1==1&&hellfire2==1&&hellfire3==1&&hellfire4==1){ player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(),5,0)); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.