Jump to content

jordan30001

Members
  • Posts

    157
  • Joined

  • Last visited

Everything posted by jordan30001

  1. OP updated added fixed EntityZeusLightningbolt code tag
  2. Oh wait it is working but due to my listener being registered after vanilla registration it doesn't invoke my method for vanilla ores anyway to register my event before objects start getting registed?
  3. I found the following class within OreDictionary public static class OreRegisterEvent extends Event { public final String Name; public final ItemStack Ore; public OreRegisterEvent(String name, ItemStack ore) { this.Name = name; this.Ore = ore; } } and above this method is the forge event bus invoker private static void registerOre(String name, int id, ItemStack ore) { ArrayList<ItemStack> ores = getOres(id); ore = ore.copy(); ores.add(ore); MinecraftForge.EVENT_BUS.post(new OreRegisterEvent(name, ore)); } I have my ForgeEvents class setup to receive these events and have successfully received other events but not this one public class ForgeEvents { @ForgeSubscribe public void DropEvent(LivingDropsEvent e) { //working event snipped for less spam code } @ForgeSubscribe public void oreRegistrationEvent(OreRegisterEvent e) { Log.log("Recieved oreRegistrationEvent"); if (e.Name.toLowerCase().contains("ore")) { addOre(e.Name); } } } and in my preInit method I have MinecraftForge.EVENT_BUS.register(new ForgeEvents()); is there a reason why I am not receiving this particular event?
  4. I have a Throwable item but for some reason its not rendering the item when thrown. Main @Init method EntityRegistry.registerModEntity(EntityZeusLightningBolt.class, "Zeus Lightning Bolt", 2, this, 250, 5, false); RenderingRegistry.registerEntityRenderingHandler(EntityZeusLightningBolt.class, new RenderZeusLightningBolt(Main.ZeusSword)); [code] EntityZeusLightningBolt [code] public class ItemZuesLightningBolt extends ItemSword { @Override @SideOnly(Side.CLIENT) public void updateIcons(IconRegister iconRegistry) { this.iconIndex = iconRegistry.registerIcon("TestMod:EntityLightningBolt"); } public ItemZuesLightningBolt(int ID, EnumToolMaterial m, String name) { super(ID, m, name); } public ItemStack onItemRightClick(ItemStack item, World w, EntityPlayer p) { if (!p.capabilities.isCreativeMode) { item.damageItem(1, p); } if (!w.isRemote) { w.spawnEntityInWorld(new EntityZeusLightningBolt(w, p)); } return item; } } and finally my render class public class RenderZeusLightningBolt extends RenderSnowball { public RenderZeusLightningBolt(Item item) { super(item); } } public class EntityZeusLightningBolt extends EntityThrowable { public EntityZeusLightningBolt(World w) { super(w); } public EntityZeusLightningBolt(World w, EntityLiving par2EntityLiving) { super(w, par2EntityLiving); } public EntityZeusLightningBolt(World w, double par2, double par4, double par6) { super(w, par2, par4, par6); } protected void onImpact(MovingObjectPosition MOP) { if (MOP.entityHit != null) { EntityLiving e = (EntityLiving) MOP.entityHit; e.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0); WorldUtils.strikeThunderAtEntity(e, 0); } if(MOP.typeOfHit == EnumMovingObjectType.TILE) { World w = this.worldObj; WorldUtils.strikeThunderAtBlock(w, MOP.blockX, MOP.blockY, MOP.blockZ, 0); } if (!this.worldObj.isRemote) { this.setDead(); } } }
  5. note a block can be null but still contain a block for instance redpower blocks are all stored as null but they are actually not null
  6. maybe you could parse the ItemStack[] into a separate thread and then process it in the other thread so the main Minecraft thread doesn't take a huge hit every tick comparing old itemstack to new itemstack. obviously still going to get a hit if the CPU affinity is 1.
  7. as I said its not 100% perfect you would need to fix the errors yourself by decompiling it with something like JAD after BON has deobfuscated it which is what everyone does if they need to test with mods non open source but be careful when doing this as to not include anything in things like github ect ect
  8. Beared Octo nemesis can decompile a mod that's use able in the forge development mods folder although do note that I having certain mods together will cause it to craft as the decompiled isn't 100% perfect you can find it over @ chicken bones forum
  9. Just wondering, what version of forge is this running with and what mc version
  10. for the random picking Note this is probably not efficient at all within the second loop import java.util.LinkedList; import java.util.List; import java.util.Random; public class Main { static List<String> stringList = new LinkedList<String>(); static Random rand = new Random(); public static void main(String[] args) { for (int i = 0; i < 10; i++) stringList.add(i, Integer.toString(i)); for(int i = 0; i < stringList.size() + 1; i++) { int element = rand.nextInt(stringList.size()); System.out.println(stringList.get(element)); stringList.remove(element); i--; if(i < 0) i = 0; } } }
  11. I'm not 100% sure but I don't think grass (I think you mean fancy grass) renders two textures to one face it just has 3 Icons for the sides (dirt, bit of grass, full grass) and depending on surrounding blocks it will display one of the 3 icons
  12. vista? *shivers* running the file as administrator?
  13. is that the full code? if it is then you cannot save null as an integer
  14. is that the full code? if it is then you cannot save null as an integer
  15. within your onBlockActivated method use this http://jd.minecraftforge.net/net/minecraft/client/entity/EntityPlayerSP.html#isSneaking()
  16. within your onBlockActivated method use this http://jd.minecraftforge.net/net/minecraft/client/entity/EntityPlayerSP.html#isSneaking()
  17. i removed comments and item/block declatartiosn ect because its irelevant but read the comments below to fix it import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.src.ModLoader; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.EnumHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; @Mod(modid = "tuskiomi", name = "survival++", version = "1.0.1") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class tuskiomi { private static final String[] colors = { "Red", "Black", "Cyan", "Blue", "Brown", "Dark Gray", "Dark Green", "Gray", "Light Blue", "Light Green", "Magenta", "Orange", "Pink", "Purple", "White", "Yellow" }; @SidedProxy(clientSide = "tuskiomi.client.ClientProxytuskiomi", serverSide = "tuskiomi.common.CommonProxytuskiomi") protected final static String modid = "tuskiomi"; /*@NetworkMod(clientSideRequired=true, serverSideRequired=false, clientPacketHandlerSpec = @SidedPacketHandler(channels = {"TutorialMod" }, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec =@SidedPacketHandler(channels = {"TutorialMod" }, packetHandler = ServerPacketHandler.class))*/ // mithril private static int cnt = 0; protected static final int IIDR = 12103; protected static final int BIDR = 3021; private static final String[] typ = { "Brick", "Cobblestone", "Glass", "Iron Block", "Lapiz Block", "Light Dark", "Light Lit", "Nether Brick", "Smoothe Cobblestone", "Stone Brick", "Stone Slab", "Stone", "Wood" }; /* this needs to be in a method not the class body for(int BDC = 0; BDC > colors.length; BDC++){ for(int BDD = 0; BDD > typ.length; BDD++){ } } */ protected GameRegistry GR = new GameRegistry(); volatile LanguageRegistry LR = new LanguageRegistry(); @Init public void load(FMLInitializationEvent event) { MinecraftForgeClient.preloadTexture("/tuskiomi/modsheet.png"); MinecraftForgeClient.preloadTexture("/tuskiomi/moditemsheet.png"); MinecraftForgeClient.preloadTexture("/tuskiomi/painted blocks.png"); } } /* too many } } */[code]
  18. its asking for a string not an item so maybe do this (I havent used this api so im not enirely sure how it works) ItemInterface.getItem("Item.canBiofuel")) or ItemInterface.getItem("canBiofuel"))
  19. you did but either you deleted your own post or a moderator did
  20. what is EnumWeaponMaterial
  21. there is a slight error in the code see striketrough above
  22. Its *erroring* (spelling) because you cant assign values to an array within a class it has to be in a method to assign values and by the looks of the values within this you want to make it private static final rather than making a new one of these arrays everytime the class is made. for non forge questions I would suggest http://stackoverflow.com/ public class test { private static final String[] colors = { "Red", "Black", "Cyan", "Blue", "Brown", "Dark Gray", "Dark Green", "Gray", "Light Blue", "Light Green", "Magenta", "Orange", "Pink", "Purple", "White", "Yellow" }; }
×
×
  • Create New...

Important Information

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