-
Posts
180 -
Joined
-
Last visited
Everything posted by SackCastellon
-
Just check if the entity hitted is alive .isEntityAlive() @Override public boolean hitEntity(ItemStack itemStack, EntityLivingBase living1, EntityLivingBase living2) { if (!living1.isEntityAlive()) { if (itemStack.getItemDamage() > 0) { itemStack.setItemDamage(itemStack.getItemDamage() - 1); } } return true; }
-
Try running: [*] gradlew.bat setupDecompWorkspace [*] gradlew.bat eclipse P.S.: I mean both of them, first 1 and then 2, not 1 or 2.
-
The problem (as seen in the image below) is that on grow my custom tree the bottom block, where previously was the sapling, has a chance (i think), of appear rotated. https://dl.dropboxusercontent.com/u/184200482/img/tree_grow_bug.png[/img] BlockSapling.java package com.sackcastellon.treeoflife.block; import java.util.Random; import com.sackcastellon.treeoflife.TreeOfLife; import com.sackcastellon.treeoflife.world.gen.WorldGenTree; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.IGrowable; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockSapling extends BlockBush implements IGrowable { public static final String[] field_149882_a = new String[] {"life"}; private static final IIcon[] IconArray = new IIcon[field_149882_a.length]; public BlockSapling() { float f = 0.4F; this.setBlockName("tol_sapling"); this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); this.setCreativeTab(TreeOfLife.tabTol); } /** * Ticks the block if it's been scheduled */ @Override public void updateTick(World world, int x, int y, int z, Random rand) { if (!world.isRemote) { super.updateTick(world, x, y, z, rand); if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextInt(7) == 0) { this.markOrGrowMarked(world, x, y, z, rand); } } } /** * Gets the block's texture. Args: side, meta */ @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { metadata &= 7; return IconArray[MathHelper.clamp_int(metadata, 0, 5)]; } public void markOrGrowMarked(World world, int x, int y, int z, Random rand) { int l = world.getBlockMetadata(x, y, z); if ((l & == 0) { world.setBlockMetadataWithNotify(x, y, z, l | 8, 4); } else { this.growTree(world, x, y, z, rand); } } public void growTree(World world, int x, int y, int z, Random rand) { if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return; int l = world.getBlockMetadata(x, y, z) & 7; Object object = new WorldGenTree(true); int i1 = 0; int j1 = 0; boolean flag = false; Block block = Blocks.air; if (flag) { world.setBlock(x + i1, y, z + j1, block, 0, 4); world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4); world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4); world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4); } else { world.setBlock(x, y, z, block, 0, 4); } if (!((WorldGenerator)object).generate(world, rand, x + i1, y, z + j1)) { if (flag) { world.setBlock(x + i1, y, z + j1, this, l, 4); world.setBlock(x + i1 + 1, y, z + j1, this, l, 4); world.setBlock(x + i1, y, z + j1 + 1, this, l, 4); world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4); } else { world.setBlock(x, y, z, this, l, 4); } } } public boolean isSameSapling(World p_149880_1_, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_) { return p_149880_1_.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this && (p_149880_1_.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_; } /** * Determines the damage on the item the block drops. Used in cloth and wood. */ @Override public int damageDropped(int metadata) { return MathHelper.clamp_int(metadata & 7, 0, 5); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { IconArray[0] = iconRegister.registerIcon("treeoflife:sapling"); } @Override public boolean func_149851_a(World world, int x, int y, int z, boolean flag) { return true; } @Override public boolean func_149852_a(World world, Random rand, int x, int y, int z) { return (double)world.rand.nextFloat() < 0.45D; } @Override public void func_149853_b(World world, Random rand, int x, int y, int z) { this.markOrGrowMarked(world, x, y, z, rand); } } WorldGenTree.java package com.sackcastellon.treeoflife.world.gen; import java.util.Random; import com.sackcastellon.treeoflife.api.Blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import net.minecraftforge.common.util.ForgeDirection; public class WorldGenTree extends WorldGenAbstractTree { public WorldGenTree(boolean par1) { super(par1); } @Override public boolean generate(World world, Random rand, int x, int y, int z) { for (int i = 0; i < 3; ++i) { this.setBlockAndNotifyAdequately(world, x, y + i, z, Blocks.ToLLog, 0); } return true; } } Thanks for helping
-
I've solved it by another way (which seems to work): private Random random = new Random(); private Item itemDropped = null; private int damageDropped; @Override public Item getItemDropped(int par1, Random rand, int par3) { if(rand.nextInt(10) == 0) { if(rand.nextInt(10) == 0) { itemDropped = Item.getItemFromBlock(Blocks.ToLSapling); } else { itemDropped = Item.getItemFromBlock(net.minecraft.init.Blocks.sapling); } } return itemDropped; } @Override public int damageDropped(int par1) { if(itemDropped == Item.getItemFromBlock(Blocks.ToLSapling)) { damageDropped = 0; } else { damageDropped = random.nextInt(6); } return damageDropped; } But any way, thanks to every one who helped
-
Ok, i've witten this code, but now it only drops vanilla saplings with metadata 0 (oak sapling): private Random random = new Random(); @Override public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); if (random.nextInt(10) == 0) { drops.add(new ItemStack(Blocks.ToLSapling)); } else { drops.add(new ItemStack(net.minecraft.init.Blocks.sapling, 1, random.nextInt(5))); } return drops; } Please tell me if made any mistake. Thanks
-
My block has got this two drops: @Override public Item getItemDropped(int par1, Random rand, int par3) { if(rand.nextInt(10) == 0) { return Item.getItemFromBlock(Blocks.ToLSapling); } else { return Item.getItemFromBlock(net.minecraft.init.Blocks.sapling); } } The net.minecraft.init.Blocks.sapling block has 6 subtypes, and i want my block to drop all of them, not at the same time, one each time, and also with a random chance, like: @Override public int damageDropped(int par1) { if(itemDropped == net.minecraft.init.Blocks.sapling) { return rand.nextInt(5); } else { return 0; } } But I've not found any itemDropped method or field, and also there is no Random rand parameter on the damageDropped method Thanks for helping
-
[1.7.2] [Solved] Custom Leaves always render transparent
SackCastellon replied to SackCastellon's topic in Modder Support
Thanks to all of you, it's solved -
Here are two images to see the problem: https://dl.dropboxusercontent.com/u/184200482/img/tree_fancy.png[/img] https://dl.dropboxusercontent.com/u/184200482/img/tree_fast.png[/img] As you can see my leaves always render transparent. Here's my code: package com.sackcastellon.treeoflife.block; import com.sackcastellon.treeoflife.TreeOfLife; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockLeaves extends net.minecraft.block.BlockLeaves { public static final String[][] field_150130_N = new String[][] {{"leaves"}, {"leavesOpaque"}}; public static final String[] field_150131_O = new String[] {"ToL"}; public BlockLeaves() { this.setCreativeTab(TreeOfLife.tabTol); this.setHardness(0.2F); this.setLightOpacity(1); this.setStepSound(soundTypeGrass); } /** * Returns the color this block should be rendered. Used by leaves. */ @SideOnly(Side.CLIENT) public int getRenderColor(int p_149741_1_) { return 65280; } /** * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { return 65280; } protected void func_150124_c(World p_150124_1_, int p_150124_2_, int p_150124_3_, int p_150124_4_, int p_150124_5_, int p_150124_6_) { if ((p_150124_5_ & 3) == 0 && p_150124_1_.rand.nextInt(p_150124_6_) == 0) { this.dropBlockAsItem(p_150124_1_, p_150124_2_, p_150124_3_, p_150124_4_, new ItemStack(Items.apple, 1, 0)); } } protected int func_150123_b(int p_150123_1_) { int j = super.func_150123_b(p_150123_1_); if ((p_150123_1_ & 3) == 3) { j = 40; } return j; } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return (p_149691_2_ & 3) == 1 ? this.field_150129_M[this.field_150127_b][1] : ((p_149691_2_ & 3) == 3 ? this.field_150129_M[this.field_150127_b][3] : ((p_149691_2_ & 3) == 2 ? this.field_150129_M[this.field_150127_b][2] : this.field_150129_M[this.field_150127_b][0])); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister p_149651_1_) { for (int i = 0; i < field_150130_N.length; ++i) { this.field_150129_M[i] = new IIcon[field_150130_N[i].length]; for (int j = 0; j < field_150130_N[i].length; ++j) { this.field_150129_M[i][j] = p_149651_1_.registerIcon("treeoflife:" + field_150130_N[i][j]); } } } public String[] func_150125_e() { return field_150131_O; } } Thanks for helping
-
I need to know how does the colorMultiplier method work to get some specific colors for a bunch of blocks. Just if it works like basecolor x modifier = newcolor // 500 x 20 = 10000 (for example) or else. Thanks for helping.
-
[1.7.2] How to make a player invisible to mobs?
SackCastellon replied to SackCastellon's topic in Modder Support
You can't be serious... haven't you been paying attention to the thread at all? EntityLiving#setAttackTarget has been featured in probably every single bit of code that has been used in the examples. :'( Sorry for that stupid question, but i've just got up. Ok, did it and the mobs (only tested zombies) don't attack me. But if i touch them then minecraft crashes. [12:56:51] [server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:745) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787) [MinecraftServer$2.class:?] Caused by: java.lang.ClassCastException: net.minecraft.entity.player.EntityPlayerMP cannot be cast to net.minecraft.entity.EntityLiving at com.sackcastellon.core.event.MinecraftForgeEvents.onEntityAttack(MinecraftForgeEvents.java:50) ~[MinecraftForgeEvents.class:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_MinecraftForgeEvents_onEntityAttack_LivingAttackEvent.invoke(.dynamic) ~[?:?] at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) ~[ASMEventHandler.class:?] at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) ~[EventBus.class:?] at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:274) ~[ForgeHooks.class:?] at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1132) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:564) ~[EntityPlayerMP.class:?] at net.minecraft.entity.monster.EntityMob.attackEntityAsMob(EntityMob.java:140) ~[EntityMob.class:?] at net.minecraft.entity.monster.EntityZombie.attackEntityAsMob(EntityZombie.java:333) ~[EntityZombie.class:?] at net.minecraft.entity.ai.EntityAIAttackOnCollide.updateTask(EntityAIAttackOnCollide.java:175) ~[EntityAIAttackOnCollide.class:?] at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:131) ~[EntityAITasks.class:?] at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:633) ~[EntityLiving.class:?] at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2023) ~[EntityLivingBase.class:?] at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:451) ~[EntityLiving.class:?] at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39) ~[EntityMob.class:?] at net.minecraft.entity.monster.EntityZombie.onLivingUpdate(EntityZombie.java:236) ~[EntityZombie.class:?] at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856) ~[EntityLivingBase.class:?] at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:270) ~[EntityLiving.class:?] at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47) ~[EntityMob.class:?] at net.minecraft.entity.monster.EntityZombie.onUpdate(EntityZombie.java:328) ~[EntityZombie.class:?] at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2286) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:705) ~[WorldServer.class:?] at net.minecraft.world.World.updateEntity(World.java:2246) ~[World.class:?] at net.minecraft.world.World.updateEntities(World.java:2096) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:536) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:739) ~[MinecraftServer.class:?] ... 4 more [12:56:51] [server thread/ERROR]: This crash report has been saved to: C:\Users\Juanjo hijo\AppData\Roaming\Modding\forge-1.7.2-10.12.0.1024-src\.\crash-reports\crash-2014-03-24_12.56.51-server.txt [12:56:51] [server thread/INFO]: Stopping server [12:56:51] [server thread/INFO]: Saving players ---- Minecraft Crash Report ---- // Quite honestly, I wouldn't worry myself about that. Time: 24/03/14 12:56 Description: Ticking entity java.lang.ClassCastException: net.minecraft.entity.player.EntityPlayerMP cannot be cast to net.minecraft.entity.EntityLiving at com.sackcastellon.core.event.MinecraftForgeEvents.onEntityAttack(MinecraftForgeEvents.java:50) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_MinecraftForgeEvents_onEntityAttack_LivingAttackEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:274) at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1132) at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:564) at net.minecraft.entity.monster.EntityMob.attackEntityAsMob(EntityMob.java:140) at net.minecraft.entity.monster.EntityZombie.attackEntityAsMob(EntityZombie.java:333) at net.minecraft.entity.ai.EntityAIAttackOnCollide.updateTask(EntityAIAttackOnCollide.java:175) at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:131) at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:633) at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2023) at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:451) at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39) at net.minecraft.entity.monster.EntityZombie.onLivingUpdate(EntityZombie.java:236) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:270) at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47) at net.minecraft.entity.monster.EntityZombie.onUpdate(EntityZombie.java:328) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2286) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:705) at net.minecraft.world.World.updateEntity(World.java:2246) at net.minecraft.world.World.updateEntities(World.java:2096) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:536) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:739) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.sackcastellon.core.event.MinecraftForgeEvents.onEntityAttack(MinecraftForgeEvents.java:50) at cpw.mods.fml.common.eventhandler.ASMEventHandler_6_MinecraftForgeEvents_onEntityAttack_LivingAttackEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:274) at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1132) at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:564) at net.minecraft.entity.monster.EntityMob.attackEntityAsMob(EntityMob.java:140) at net.minecraft.entity.monster.EntityZombie.attackEntityAsMob(EntityZombie.java:333) at net.minecraft.entity.ai.EntityAIAttackOnCollide.updateTask(EntityAIAttackOnCollide.java:175) at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:131) at net.minecraft.entity.EntityLiving.updateAITasks(EntityLiving.java:633) at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2023) at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:451) at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39) at net.minecraft.entity.monster.EntityZombie.onLivingUpdate(EntityZombie.java:236) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:270) at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47) at net.minecraft.entity.monster.EntityZombie.onUpdate(EntityZombie.java:328) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2286) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:705) at net.minecraft.world.World.updateEntity(World.java:2246) -- Entity being ticked -- Details: Entity Type: Zombie (net.minecraft.entity.monster.EntityZombie) Entity ID: 4 Entity Name: Zombie Entity's Exact location: -1321,83, 56,00, 925,34 Entity's Block location: World: (-1322,56,925), Chunk: (at 6,3,13 in -83,57; contains blocks -1328,0,912 to -1313,255,927), Region: (-3,1; contains chunks -96,32 to -65,63, blocks -1536,0,512 to -1025,255,1023) Entity's Momentum: 0,00, -0,08, 0,00 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:2096) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:536) -- Affected level -- Details: Level name: New World All players: 1 total; [EntityPlayerMP['Player4'/6, l='New World', x=-1320,69, y=56,00, z=925,46]] Chunk stats: ServerChunkCache: 646 Drop: 0 Level seed: 4740230574978669681 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: 2;7,3x1,52x24;2; Level spawn location: World: (-1359,4,966), Chunk: (at 1,0,6 in -85,60; contains blocks -1360,0,960 to -1345,255,975), Region: (-3,1; contains chunks -96,32 to -65,63, blocks -1536,0,512 to -1025,255,1023) Level time: 141224 game time, 13000 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 80681 (now: false), thunder time: 91378 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:739) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 169809664 bytes (161 MB) / 448659456 bytes (427 MB) up to 878051328 bytes (837 MB) JVM Flags: 0 total; AABB Pool Size: 188 (10528 bytes; 0 MB) allocated, 55 (3080 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 7 mods loaded, 7 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-Core{1.1.1.0} [sKC Core] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-BetterWood{1.1.0.0} [better Wood] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-Camouflage{1.1.0.0} [Camouflage] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-CraftableHorseArmor{1.1.1.0} [Craftable Horse Armor] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 149 (8344 bytes; 0 MB) allocated, 92 (5152 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player4'/6, l='New World', x=-1320,69, y=56,00, z=925,46]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-03-24_12.56.51-server.txt [12:56:51] [Client Shutdown Thread/INFO]: Stopping server [12:56:51] [Client Shutdown Thread/INFO]: Saving players AL lib: (EE) alc_cleanup: 1 device not closed -
[1.7.2] How to make a player invisible to mobs?
SackCastellon replied to SackCastellon's topic in Modder Support
Ok, but where's the ".setCurrentTarget()" (or similar) method is located? -
[1.7.2] How to make a player invisible to mobs?
SackCastellon replied to SackCastellon's topic in Modder Support
Ok, thanks, it works. Now i have another problem: If the player is firstly invisible, then the mobs don't attack him, but if the mobs are attacking him and the player becomes invisible, the mobs still attack him. This is my code: /** * Only works with AI mobs: Zombies, Skeletons and Creepers. * @param event */ @SubscribeEvent public void onEntitySetTarget(LivingSetAttackTargetEvent event) { if (Loader.isModLoaded("SKC-Camouflage")) { if (event.target != null && event.target instanceof EntityPlayer && event.entityLiving.func_94060_bK() != event.target) { if (event.target.isInvisible()) { ((EntityLiving) event.entity).setAttackTarget(null); } } } } -
[1.7.2] How to make a player invisible to mobs?
SackCastellon replied to SackCastellon's topic in Modder Support
Ok, i'll raise my cuestion again: Could you give me some exemples of code? -
[1.7.2] How to make a player invisible to mobs?
SackCastellon replied to SackCastellon's topic in Modder Support
Ok, but, could you give me some steps to do it? code examples? -
How can i make a player invisible to mobs on wearing an specific armor set, by the way the player is not been attacked by them. I've tried this, but the mobs still attack the player: player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); Thanks for helping.
-
[1.6.2] Custom armor doesn't renders correctly
SackCastellon replied to SackCastellon's topic in Modder Support
Do you mean i need to create differents textures for boots and leggings? EDIT: thanks for correcting me i didn't noticed -
[1.6.2] Custom armor doesn't renders correctly
SackCastellon replied to SackCastellon's topic in Modder Support
Here is my code: ItemLoader.class DesertCamouflageBoots = (ItemArmor) new ItemCamouflage(ConfigHandler.DesertCamouflageBootsID, camo_material, RenderingRegistry.addNewArmourRendererPrefix("desert_camo_armor"), 3, 3).setUnlocalizedName("desert_camo_boots"); ItemCamouflage.class package SackCastellon.camouflage.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import SackCastellon.camouflage.loader.ItemLoader; import SackCastellon.camouflage.loader.TabLoader; import SackCastellon.camouflage.reference.Reference; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.Icon; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; public class ItemCamouflage extends ItemArmor { @SideOnly(Side.CLIENT) private Icon invisibleIcon; private int camoType; // private int biomeColor; public ItemCamouflage(int id, EnumArmorMaterial material, int renderID, int part, int camoType) { super(id, material, renderID, part); this.camoType = camoType; this.setCreativeTab(TabLoader.CamouflageTab); } @Override public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { if (player.getCurrentItemOrArmor(4) != null && player.getCurrentItemOrArmor(3) != null && player.getCurrentItemOrArmor(2) != null && player.getCurrentItemOrArmor(1) != null) { ItemStack helmet = player.getCurrentItemOrArmor(4); ItemStack plate = player.getCurrentItemOrArmor(3); ItemStack legs = player.getCurrentItemOrArmor(2); ItemStack boots = player.getCurrentItemOrArmor(1); // Basic if (helmet.getItem() == ItemLoader.CamouflageHelmet && plate.getItem() == ItemLoader.CamouflageChestplate && legs.getItem() == ItemLoader.CamouflageLeggins && boots.getItem() == ItemLoader.CamouflageBoots && player.isSneaking()) { if((world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.forest || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.forestHills || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.swampland || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.jungle || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.jungleHills) && ( world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.grass.blockID || world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.leaves.blockID)) { player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); } } // Dirt else if (helmet.getItem() == ItemLoader.DirtCamouflageHelmet && plate.getItem() == ItemLoader.DirtCamouflageChestplate && legs.getItem() == ItemLoader.DirtCamouflageLeggins && boots.getItem() == ItemLoader.DirtCamouflageBoots && player.isSneaking()) { if(world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.plains && world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.dirt.blockID) { player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); } } // Stone else if (helmet.getItem() == ItemLoader.StoneCamouflageHelmet && plate.getItem() == ItemLoader.StoneCamouflageChestplate && legs.getItem() == ItemLoader.StoneCamouflageLeggins && boots.getItem() == ItemLoader.StoneCamouflageBoots && player.isSneaking()) { if((world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.extremeHills || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.desertHills || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.forestHills || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.taigaHills || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.extremeHillsEdge || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.jungleHills) && world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.stone.blockID) { player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); } } // Ocean else if (helmet.getItem() == ItemLoader.OceanCamouflageHelmet && plate.getItem() == ItemLoader.OceanCamouflageChestplate && legs.getItem() == ItemLoader.OceanCamouflageLeggins && boots.getItem() == ItemLoader.OceanCamouflageBoots && player.isSneaking()) { if((world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.ocean || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.river || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.beach || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.swampland) && ( world.getBlockId((int)player.posX, (int)player.posY, (int)player.posZ) == Block.waterStill.blockID || world.getBlockId((int)player.posX, (int)player.posY, (int)player.posZ) == Block.waterMoving.blockID)) { player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); } } // Desert else if (helmet.getItem() == ItemLoader.DesertCamouflageHelmet && plate.getItem() == ItemLoader.DesertCamouflageChestplate && legs.getItem() == ItemLoader.DesertCamouflageLeggins && boots.getItem() == ItemLoader.DesertCamouflageBoots && player.isSneaking()) { if((world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.desert) && ( world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.sand.blockID || world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.sandStone.blockID || ( world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.stoneDoubleSlab.blockID && world.getBlockMetadata((int)player.posX, (int)player.posY - 1, (int)player.posZ) == 1) || ( world.getBlockId((int)player.posX, (int)(player.posY - 0.5D), (int)player.posZ) == Block.stoneSingleSlab.blockID && world.getBlockMetadata((int)player.posX, (int)(player.posY - 0.5D), (int)player.posZ) == 1))) { player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); } } // Ice else if (helmet.getItem() == ItemLoader.IceCamouflageHelmet && plate.getItem() == ItemLoader.IceCamouflageChestplate && legs.getItem() == ItemLoader.IceCamouflageLeggins && boots.getItem() == ItemLoader.IceCamouflageBoots && player.isSneaking()) { if((world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.frozenOcean || world.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.frozenRiver) && ( world.getBlockId((int)player.posX, (int)player.posY - 1, (int)player.posZ) == Block.ice.blockID)) { player.addPotionEffect((new PotionEffect(Potion.invisibility.id, 2, 0))); } } } // this.biomeColor = world.getBiomeGenForCoords((int)player.posX, (int)player.posZ).getBiomeFoliageColor(); } @Override public void registerIcons(IconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(Reference.TexturePath + this.getUnlocalizedName().substring(5)); this.invisibleIcon = iconRegister.registerIcon(Reference.TexturePath + "invisible"); } @Override public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(player.isInvisible()) { return this.invisibleIcon; } else { return this.itemIcon; } } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { String path; if(entity instanceof EntityPlayer) { if(entity.isInvisible()) { path = "camouflage:textures/models/armor/invisible_camo_armor.png"; } else { if(slot == 0 || slot == 1) { path = "camouflage:textures/models/armor/" + this.getUnlocalizedName().substring(5).replace("_helmet", "").replace("_chestplate", "").replace("_leggins", "").replace("_boots", "") + "_armor_1.png"; } else { path = "camouflage:textures/models/armor/" + this.getUnlocalizedName().substring(5).replace("_helmet", "").replace("_chestplate", "").replace("_leggins", "").replace("_boots", "") + "_armor_2.png"; } } } else { if(slot == 0 || slot == 1) { path = "camouflage:textures/models/armor/" + this.getUnlocalizedName().substring(5).replace("_helmet", "").replace("_chestplate", "").replace("_leggins", "").replace("_boots", "") + "_armor_1.png"; } else { path = "camouflage:textures/models/armor/" + this.getUnlocalizedName().substring(5).replace("_helmet", "").replace("_chestplate", "").replace("_leggins", "").replace("_boots", "") + "_armor_2.png"; } } return path; } /* @Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack itemStack, int pass) { if(this.camoType != 0) { return 16777215; } else { return this.biomeColor; } } @Override public boolean hasColor(ItemStack itemStack) { return true; } @Override public int getColor(ItemStack itemStack) { if(this.camoType == 0) { return this.biomeColor; } return 16777215; } */ } -
I've got the following visual bug on my custom armor boots: It looks like my boots' texture is not in the correct position: https://dl.dropboxusercontent.com/u/184200482/img/armor_bug_bad.png[/img] And it should render as vanilla one: https://dl.dropboxusercontent.com/u/184200482/img/armor_bug_ok.png[/img] Here is my texture: https://dl.dropboxusercontent.com/u/184200482/img/desert_camo_armor_2.png[/img] Does anybody knows how can i fix it? Thanks for helping
-
I want to set a custom color for my custom armor, not the item, i'm refering to the texture which renders over the player. I know how to set a custom color to the item: @Override public boolean hasColor(ItemStack par1ItemStack) { return true; } @Override public int getColor(ItemStack par1ItemStack) { return 16711680; } I've also seen inside of the RenderBiped.class that the color is only got for the items which are a instace of ItemArmor: protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3) { ItemStack itemstack = par1EntityLiving.func_130225_q(3 - par2); if (itemstack != null) { Item item = itemstack.getItem(); if (item instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)item; this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, null)); ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; modelbiped.bipedBody.showModel = par2 == 1 || par2 == 2; modelbiped.bipedRightArm.showModel = par2 == 1; modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped); this.setRenderPassModel(modelbiped); modelbiped.onGround = this.mainModel.onGround; modelbiped.isRiding = this.mainModel.isRiding; modelbiped.isChild = this.mainModel.isChild; float f1 = 1.0F; //Move out of if to allow for more then just CLOTH to have color int j = itemarmor.getColor(itemstack); if (j != -1) { float f2 = (float)(j >> 16 & 255) / 255.0F; float f3 = (float)(j >> 8 & 255) / 255.0F; float f4 = (float)(j & 255) / 255.0F; GL11.glColor3f(f1 * f2, f1 * f3, f1 * f4); if (itemstack.isItemEnchanted()) { return 31; } return 16; } GL11.glColor3f(f1, f1, f1); if (itemstack.isItemEnchanted()) { return 15; } return 1; } } return -1; } So i don't know how to set a custom color to the armor texture. Well, knowing this: Is there any way to set a custom color to the texture of a custom armor? I hope you could understand me and thanks for helping.
-
[1.6.2] Add potion effect on wear full specific armour
SackCastellon replied to SackCastellon's topic in Modder Support
Ok, thank you -
[1.6.4] [Solved] shouldSideBeRendered() Problem.
SackCastellon replied to SackCastellon's topic in Modder Support
Okay, thanks, it works -
[1.6.4] [Solved] How to check if an entity is moving?
SackCastellon replied to SackCastellon's topic in Modder Support
Ok, thanks -
[1.6.4] [Solved] How to check if an entity is moving?
SackCastellon replied to SackCastellon's topic in Modder Support
Then i suppose that if all those fields are equals to 0, the entity is still, am i right?