Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

robodude

Members
  • Joined

  • Last visited

  1. I have no clue here is the entire class. package com.fredtech.tutorial.wuppy; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; public class SmiteEventHandle { public SmiteEventHandle() { // TODO Auto-generated constructor stub } @ForgeSubscribe public void onInteract(PlayerInteractEvent event){ long id = 0; try{ id = event.entityPlayer.getHeldItem().itemID; }catch(Exception e){} if(event.action == Action.RIGHT_CLICK_AIR && id == Wuppy.smiter.itemID) { Vec3 loc = event.entityPlayer.getLookVec(); MovingObjectPosition pos = event.entityPlayer.rayTrace(100, 2.0F); //try{ try{ //event.entityPlayer.worldObj.spawnEntityInWorld(new net.minecraft.entity.effect.EntityLightningBolt(event.entityPlayer.worldObj, pos.blockX, pos.blockY, pos.blockZ)); }catch(Exception e){} try{ event.entityPlayer.worldObj.createExplosion(event.entityLiving.worldObj.getClosestPlayerToEntity(event.entityLiving, 50), pos.blockX, pos.blockY, pos.blockZ, 3.0F, true); }catch(Exception e){} //}catch(Exception e){} try{ EntityLiving mob = (EntityLiving) pos.entityHit; mob.setEntityHealth(mob.getHealth() - 20); }catch(Exception e){} event.entityPlayer.sendChatToPlayer(pos.blockX + ", " + pos.blockY + ", " + pos.blockZ); } } }
  2. When I create an explosion it sometimes leaves behind invisible blocks, when I reload the world the invisible blocks reappear. Code: event.entityPlayer.worldObj.createExplosion(event.entityLiving.worldObj.getClosestPlayerToEntity(event.entityLiving, 50), pos.blockX, pos.blockY, pos.blockZ, 3.0F, true); Extra Info: This code is within a PlayerInteractEvent method
  3. robodude replied to robodude's topic in Modder Support
    PlayerInteractEvent, could you show me how to make one of those?
  4. robodude posted a topic in Modder Support
    How do I make a cooldown for a forge event? I have an event i only want executed every 10 seconds.
  5. This is probably very easy but I am kinda new to forge. Also, the command im looking for is the player.getTargetBlock(int) from the bukkit api equivalent for the forge api.
  6. I have an item that needs to tp the player to a far off location that it is looking at i.e. a cliff face in the distance much like the jumpto command in worldedit. How do I find the block the player is looking at in the distance?
  7. How do I edit the NBT code of a mob spawner so it spawns mobs with specific properties. I.E. charged creepers Code: world.setBlock(x, y - 1, z, Block.mobSpawner.blockID); TileEntityMobSpawner zombies = (TileEntityMobSpawner)world.getBlockTileEntity(x, y - 1, z); zombies.func_98049_a().setMobID("Villager");
  8. I know this is an extremely broad topic but if someone could point to me to some good Forge tutorials on this subject as I can only find modloader tutorials. Thanks!
  9. How do I do that and still get a spawn egg and natural spawns?
  10. Sorry my code is a little messy at the moment as a result of me trying to fix this stupid error, just ignore that I really need help on the problem of the non-rendered mob.
  11. Hello when I run this mod and activate the spawn egg the mob spawns and makes its sound but is invisible and doesnt render BaseMod: package com.fredtech.tutorial.wuppy; import java.awt.Color; import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.Item; import net.minecraft.src.BaseMod; import net.minecraft.src.ModLoader; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; 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.registry.EntityRegistry; @Mod(modid = Wuppy.modid, name = "Wuppy", version = "1.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Wuppy extends BaseMod { public static final String modid = "FredTech_Wuppy"; public static Block testBlock; public static Item testItem; public static Item blaster; @Init public void load(FMLInitializationEvent event){ testBlock = new TestBlock(500, Material.rock).setUnlocalizedName("testBlock"); testItem = new TestItem(5000).setUnlocalizedName("testItem"); blaster = new Blaster(5001).setCreativeTab(CreativeTabs.tabCombat).setUnlocalizedName("blaster"); EntityRegistry.registerModEntity(Bolt.class, "Bolt", 0,this,256,1,true); RenderingRegistry.registerEntityRenderingHandler(Bolt.class, new BoltRenderer()); ModLoader.registerEntityID(MobTest.class, "TestMob", 31); ModLoader.addSpawn("TestMob", 15, -5, 1, EnumCreatureType.creature); ModLoader.addLocalization("entity.TestMob.name", "Test Mob"); EntityList.entityEggs.put(Integer.valueOf(31), new EntityEggInfo(31, 894731, (new Color(21,15,6).getRGB()))); Register.registerItems(); } @Override public String getVersion() { // TODO Auto-generated method stub return null; } @Override public void load() { } @Override public void addRenderer(Map var1) { var1.put(MobTest.class, new RenderLiving(new ModelMob(),.5f)); } } Register: package com.fredtech.tutorial.wuppy; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityEggInfo; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.src.ModLoader; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; public class Register { public static void registerItems(){ ItemStack godSword = new ItemStack(Item.swordDiamond); godSword.addEnchantment(Enchantment.unbreaking, 10); godSword.addEnchantment(Enchantment.smite, 10); godSword.addEnchantment(Enchantment.knockback, 2); godSword.addEnchantment(Enchantment.looting, 10); godSword.addEnchantment(Enchantment.fireAspect, 10); godSword.addEnchantment(Enchantment.sharpness, 10); godSword.addEnchantment(Enchantment.baneOfArthropods, 10); GameRegistry.registerBlock(Wuppy.testBlock, Wuppy.modid+Wuppy.testBlock.getUnlocalizedName2()); GameRegistry.addShapelessRecipe(new ItemStack(Wuppy.testBlock), new Object[]{ new ItemStack(Item.diamond, 1), new ItemStack(Block.stone, 1),new ItemStack(Item.dyePowder, 1, 15) }); GameRegistry.addRecipe(new ItemStack(Wuppy.testBlock), new Object[]{ "XZX", "CXC", 'X', Item.ingotGold, 'C', Block.stone, 'Z', new ItemStack(Item.dyePowder, 1, 15) }); GameRegistry.addRecipe(godSword, new Object[]{ " C", " B ", "A ", 'A', Item.stick, 'B', new ItemStack(Item.diamond, 5), 'C', new ItemStack(Item.emerald, 5) }); ModLoader.registerEntityID(MobTest.class, "TestMob", 50); ModLoader.addSpawn("TestMob", 15, -5, 1, EnumCreatureType.creature); ModLoader.addLocalization("enity.TestMob.name", "Test Mob"); EntityList.entityEggs.put(Integer.valueOf(50), new EntityEggInfo(50,894731, (new Color(21,15,6).getRGB()))); LanguageRegistry.addName(Wuppy.testBlock, "Test Block"); LanguageRegistry.addName(Wuppy.testItem, "Test Item"); LanguageRegistry.addName(Wuppy.blaster, "Blaster"); MinecraftForge.EVENT_BUS.register(new ItemClickHandle()); } } MobTest: package com.fredtech.tutorial.wuppy; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveTwardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.world.World; public class MobTest extends EntityCreature { public MobTest(World worldObj) { super(worldObj); this.texture = "/mob/GreenMonster.png"; this.moveSpeed = 0.4f;//sets how fast this mob moves isImmuneToFire = false; //below this is all the ai tasks that specify how the mob will behave mess around with it to see what happens this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false)); this.tasks.addTask(2, new EntityAIMoveTwardsRestriction(this, this.moveSpeed)); this.tasks.addTask(3, new EntityAIWander(this, this.moveSpeed)); this.tasks.addTask(4, new EntityAILookIdle(this)); this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 25.0F, 0, true)); } @Override public int getMaxHealth() { // TODO Auto-generated method stub return 10; } public boolean isAIEnabled() { return true; } protected String getLivingSound() { return "mob.pig.say"; } protected String getHurtSound() { return "mob.pig.say"; } protected String getDeathSound() { return "mob.pig.death"; } protected int getDropItemId() { return 200; } protected boolean canDespawn() { return true; } } ModelMob (Generated by Techne): package com.fredtech.tutorial.wuppy; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelMob extends ModelBase { //fields ModelRenderer Leg2; ModelRenderer Leg1; ModelRenderer Body; ModelRenderer Arm1; ModelRenderer Arm2; ModelRenderer Head; public ModelMob() { textureWidth = 64; textureHeight = 128; Leg2 = new ModelRenderer(this, 48, 49); Leg2.addBox(-2F, 0F, -2F, 4, 11, 4); Leg2.setRotationPoint(-4F, 13F, 0F); Leg2.setTextureSize(64, 128); Leg2.mirror = true; setRotation(Leg2, 0F, 0F, 0F); Leg1 = new ModelRenderer(this, 31, 49); Leg1.addBox(-2F, 0F, -2F, 4, 11, 4); Leg1.setRotationPoint(2F, 13F, 0F); Leg1.setTextureSize(64, 128); Leg1.mirror = true; setRotation(Leg1, 0F, 0F, 0F); Body = new ModelRenderer(this, 0, 68); Body.addBox(0F, 0F, 0F, 12, 7, 7); Body.setRotationPoint(-7F, 7F, -3F); Body.setTextureSize(64, 128); Body.mirror = true; setRotation(Body, 0F, 0F, 0F); Arm1 = new ModelRenderer(this, 0, 34); Arm1.addBox(0F, -1F, -9F, 4, 3, 12); Arm1.setRotationPoint(5F, 8F, -3F); Arm1.setTextureSize(64, 128); Arm1.mirror = true; setRotation(Arm1, 0F, 0F, 0F); Arm2 = new ModelRenderer(this, 0, 19); Arm2.addBox(-4F, -1F, -10F, 4, 3, 12); Arm2.setRotationPoint(-7F, 8F, -3F); Arm2.setTextureSize(64, 128); Arm2.mirror = true; setRotation(Arm2, 0F, 0F, 0F); Head = new ModelRenderer(this, 0, 0); Head.addBox(-3F, -6F, -2F, 8, 6, 5); Head.setRotationPoint(-2F, 7F, 0F); Head.setTextureSize(64, 128); Head.mirror = true; setRotation(Head, 0F, 0F, 0F); } 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); Leg2.render(f5); Leg1.render(f5); Body.render(f5); Arm1.render(f5); Arm2.render(f5); Head.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { // super.setRotationAngles(f, f1, f2, f3, f4, f5); } } This is all the code that has to do with this issue GreenMonster.png is located at /forge/mcp/src/minecraft/mobs
  12. Thank you so much, someone needs to change the tutorial for entity rendering on the wiki.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.