
UntouchedWagons
Members-
Posts
156 -
Joined
-
Last visited
Everything posted by UntouchedWagons
-
I know about preInit and Init but I didn't know about PostInit which might do what I want. I want to loop through all the available recipes (crafting recipes, furnace recipes, recipe systems of other mods like Buildcraft's Assembly Table, etc...) and sort them according to owning mod. My end goal is to recreate my Resource Calculator as a mod rather than as a website I need to keep maintaining.
-
I have a VPS which I use to host various sites/projects and I want to use it to compile my mods when I push commits to the mods' repositories. What do I need to do that? I think I need the Gradle plugin, installing jenkins itself in debian looks pretty straightforward.
-
How do I make my mob attack attackers like wolves?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
I was playing on Peaceful. DERP! -
How do I make my mob attack attackers like wolves?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
Okay Cool I'll take a look at that -
How do I make my mob attack attackers like wolves?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
I've managed to get my mob to path to the attacker but never actually does any damage: package untouchedwagons.minecraft.mindcrackermobs.entity.mindcrackers; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import java.util.Random; public class EntityCustomMob extends EntityAnimal { public EntityCustomMob(World world) { super(world); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1D)); this.tasks.addTask(3, new EntityAILookIdle(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1, true)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); this.isImmuneToFire = true; } @Override public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { if (this.isEntityInvulnerable()) return false; boolean state = super.attackEntityFrom(p_70097_1_, p_70097_2_); Entity damage_source = p_70097_1_.getEntity(); if (damage_source instanceof EntityPlayer) { this.setTarget(damage_source); this.setRevengeTarget((EntityPlayer)damage_source); } return state; } @Override public void applyEntityAttributes() { super.applyEntityAttributes(); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); } @Override public boolean attackEntityAsMob(Entity target) { float damage = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); int knockback = 0; if (target instanceof EntityLivingBase) { damage += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)target); knockback += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)target); } boolean flag = target.attackEntityFrom(DamageSource.causeMobDamage(this), damage); if (flag) { if (knockback > 0) { target.addVelocity((double) (-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D, (double) (MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F) ); this.motionX *= 0.6D; this.motionZ *= 0.6D; } int j = EnchantmentHelper.getFireAspectModifier(this); if (j > 0) { target.setFire(j * 4); } if (target instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a((EntityLivingBase)target, this); } EnchantmentHelper.func_151385_b(this, target); } return flag; } } -
How do I make my mob attack attackers like wolves?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
This is my entity's code: package untouchedwagons.minecraft.mindcrackermobs.entity.mindcrackers; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import java.util.Random; public class EntityCustomMob extends EntityAnimal { public EntityCustomMob(World world) { super(world); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1D)); this.tasks.addTask(3, new EntityAILookIdle(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1, true)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); this.isImmuneToFire = true; } @Override public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { if (this.isEntityInvulnerable()) return false; Entity damage_source = p_70097_1_.getEntity(); if (damage_source instanceof EntityPlayer) { this.setRevengeTarget((EntityPlayer) damage_source); this.attackingPlayer = (net.minecraft.entity.player.EntityPlayer) damage_source; this.entityToAttack = damage_source; } return super.attackEntityFrom(p_70097_1_, p_70097_2_); } @Override public void applyEntityAttributes() { super.applyEntityAttributes(); this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(16.0D); } } I see that your entity has an 'updateAITasks' method which does some stuff if the entity is angry. I guess I need to implement that stuff -
When you punch an untamed wolf it turns angry and attacks you. The EntityWolf class adds an EntityAIHurtByTarget to its targetTasks list which I've duplicated but my custom mob still doesn't attack me when I punch it so I'm obviously missing something but I don't know what it is.
-
This is correct. You do something like this: public class MyAwesomeRecord extends ItemRecord { public MyAwesomeRecord() { super("record_name"); } @Override public ResourceLocation getRecordResource(String name) { return new ResourceLocation("your-mod-id", "records.whatever"); } } Now in your sounds.json file (this file goes in src/main/resources/assets/your-mod-id/) you put something like this: { "records.whatever": { "category": "record", "sounds": [ { "name": "record/file-name-without-extension", "stream": true } ] } } And that's pretty much it.
-
Since I want the sweater drop to be rare I used dropRareDrop which worked great. All right so that's one hurdle down, several to go. Enchanting is actually pretty easy if a bit strange: EnchantmentHelper.addRandomEnchantment(new Random(), your_item_stack, number_of_levels); And it adds random enchants appropriate to the itemm type and material. I say it's a bit strange because the method returns the ItemStack instance instead of simply being void. But oh well.
-
I tried doing something like this in my entity class: public void setDead() { super.setDead(); this.entityDropItem(this.sweater, 0F); } this.sweater is an ItemStack where the wrapped Item is the same instance as the one I registered but when my mob dies it drops 3 items but I can only pick 1 of them up. I can only destroy the other two by pouring lava over them.
-
This is the item that my custom mob drops on death: public class ItemPinkSweater extends ItemArmor { public ItemPinkSweater() { super(ItemArmor.ArmorMaterial.CLOTH, 0, 1); this.setTextureName("leather_chestplate"); this.setMaxStackSize(1); this.setUnlocalizedName("pinkSweater"); } } This is how my custom mob drops it: protected Item getDropItem() { return new ItemPinkSweater(); } When I look at my custom leather chestplate in NEI it renders fine (as an ordinary leather chestplate) but when my mob drops it, it has the purple/black broken texture and when I pick it up my game crashes with this error: java.lang.NullPointerException: Rendering item at net.minecraft.client.renderer.entity.RenderItem.func_94149_a(RenderItem.java:732) at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:498) at net.minecraft.client.renderer.entity.RenderItem.func_82406_b(RenderItem.java:565) at net.minecraft.client.gui.GuiIngame.func_73832_a(GuiIngame.java:955) at net.minecraftforge.client.GuiIngameForge.renderHotbar(GuiIngameForge.java:206) at net.minecraftforge.client.GuiIngameForge.func_73830_a(GuiIngameForge.java:141) at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1038) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:990) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:887) at net.minecraft.client.main.Main.main(SourceFile:148) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:286) at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:376) at org.multimc.EntryPoint.listen(EntryPoint.java:165) at org.multimc.EntryPoint.main(EntryPoint.java:54)
-
Why does my custom mob move so slowly?
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
Great. -
This is the base class that all my entities are based on: public abstract class EntityCustom extends EntityCreature { public EntityCustom(World world) { super(world); this.setHealth(20); // This method makes the mob not despawn this.func_110163_bv(); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); this.tasks.addTask(2, new EntityAILookIdle(this)); } } Even if I set the wander speed to 4.0, all mobs move at the speed of a person sneaking while blocking with a sword.
-
package untouchedwagons.minecraft.custom_mobs.renders; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class PlayerRender extends RenderLiving { private String player_name; public PlayerRender(String player_name) { super(new ModelBiped(), 0.5F); this.player_name = player_name; } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation("custom-mobs", "skins/" + this.player_name + ".png"); } } This works fine if the skin is from the previous system but the entities' textures are all messed up if the skin is using the new format.
-
<3 LexManos and all his hard work.
-
NullPointerException when spawning entity
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
Yeah I've figured out that I need my class to extend EntityLiving, not EntityPlayerMP: package untouchedwagons.minecraft.fakeplayer.entities; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.world.World; public class FakePlayer extends EntityLiving { public FakePlayer(World world) { super(world); this.setAlwaysRenderNameTag(true); this.setCanPickUpLoot(false); this.setCustomNameTag("Fake Player"); this.setHealth(20); // This method makes the mob not despawn this.func_110163_bv(); this.tasks.addTask(0, new EntityAILookIdle(this)); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0); } @Override public boolean isAIEnabled() { return false; } } However this entity doesn't activate spawners which is ultimately what I want to do, but I don't know how to do it. I've looked at the TileEntityMobSpawner class, followed it to MobSpawnerBaseLogic then to World's getClosestPlayer and noticed that a spawner is activated when a EntityPlayer class is within 16 blocks (or whatever) of the spawner. If I add my entity to the world instance's playerEntities list then the game crashes because my entity can't be cast to an instance of EntityPlayerMP. I don't know what to do from that point. -
Take a look at the EntityWolf class' interact method.
-
NullPointerException when spawning entity
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
I'm getting this exception when I spawn my fake player: java.lang.NoSuchMethodException: untouchedwagons.minecraft.fakeplayer.entities.FakePlayer.<init>(net.minecraft.world.World) My FakePlayer class: package untouchedwagons.minecraft.fakeplayer.entities; import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.Mod; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.server.management.ItemInWorldManager; import net.minecraft.world.World; import net.minecraft.world.WorldServer; public class FakePlayer extends EntityPlayerMP { public FakePlayer(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) { super(p_i45285_1_, p_i45285_2_, p_i45285_3_, p_i45285_4_); } @Mod.EventHandler public void init(World world) { } } -
NullPointerException when spawning entity
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
Oh I have a class called FakePlayer, I'm not using the one in Forge (didn't know there was one when I made this topic). Okay I'll look for the registerModEntity method. -
I've created an item that overrides Item's onItemUse method: @Override public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer player, World world, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if (world.isRemote) return false; MinecraftServer server = MinecraftServer.getServer(); FakePlayer fakePlayer = new FakePlayer( server, server.worldServerForDimension(player.dimension), new GameProfile(null, "Fake Player"), new ItemInWorldManager(world) ); world.spawnEntityInWorld(fakePlayer); return true; } I've wrapped the whole thing in a try/catch block but a NullPointerException keeps getting thrown somewhere: java.lang.NullPointerException: Exception in server tick loop at net.minecraft.entity.EntityTrackerEntry.func_151261_b(EntityTrackerEntry.java:323) at net.minecraft.entity.EntityTrackerEntry.func_111190_b(EntityTrackerEntry.java:289) at net.minecraft.entity.EntityTrackerEntry.func_73122_a(EntityTrackerEntry.java:226) at net.minecraft.entity.EntityTracker.func_72788_a(EntityTracker.java:270) at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:648) at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:111) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) EntityTrackerEntry.func_151261_b deals with packet stuff. Do I need to use the Simple Network Wrapper stuff?
-
How to only call method in integrated and dedicated servers?
UntouchedWagons replied to Gadersd's topic in Modder Support
I think you want to set up a proxy. Perhaps this thread could help