-
Posts
157 -
Joined
-
Last visited
Everything posted by Dragonisser
-
I wouldnt mind the 1.12 code, it wont be that much different than the 1.11 one. Probably gonna start doing a new dimension in 1.12 first and adding the rest later so i have that going.
-
Please tell me that your dimension doesnt lag. I somehow got mine working for 1.11.2 but it lags horrible, even if i turn off the decoration. Im out of ideas, its not the cascading issue, not too many mobs, or stuff, it lags in eclipse and normal minecraft. Im not sure what i added that it started lagging so much. picture Could you somehow provide me your code, so i could take a look at it?
-
[1.11.2] Message value is null / Capabilities
Dragonisser replied to Dragonisser's topic in Modder Support
Yep it also didnt worked before using those printIn. But now im using the code above which works, suddenly. -
[1.11.2] Message value is null / Capabilities
Dragonisser replied to Dragonisser's topic in Modder Support
So how can i send the whole in one with all data. Back with IEEP ive send the whole RpgPlayer NVM. Seems to work like it should. @Override public void fromBytes(ByteBuf buf) { byte[] bytes = new byte[buf.readableBytes()]; buf.readBytes(bytes); try (ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bis)) { this.mana = (IMana) ois.readObject(); } catch (ClassNotFoundException | IOException e) { RPGMain.getLogger().error("Couldnt sync player", e); } } @Override public void toBytes(ByteBuf buf) { if (this.mana != null) { try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos)) { oos.writeObject(this.mana); buf.writeBytes(bos.toByteArray()); } catch (IOException e) { RPGMain.getLogger().error("Couldnt sync player with client", e); } } } -
[1.11.2] Message value is null / Capabilities
Dragonisser replied to Dragonisser's topic in Modder Support
Even without it it is null. Thats one of the reason i wondered why the other code works. -
Currently trying to sync my capabilities, the problem is the value im sending(IMana) is null even though its there when i create the message. Even the ByteBuf has the data. Checked this thread here but cant find any difference. Console output [18:50:56] [Server thread/INFO] [RPGMOD]: Sending info to client [18:50:56] [Server thread/INFO] [RPGMOD]: EntityPlayerMP['Dragonisser'/137993, l='New World', x=110.88, y=87.00, z=-2.19] [18:50:56] [Server thread/INFO] [RPGMOD]: de.prwh.rpg.capabilities.mana.Mana@60173b3b [18:50:56] [Server thread/INFO] [RPGMOD]: Mana isnt null [18:50:56] [Server thread/INFO] [RPGMOD]: ManaNBTMessage: de.prwh.rpg.capabilities.mana.Mana@60173b3b [18:50:56] [Server thread/INFO] [RPGMOD]: Save [18:50:56] [Server thread/INFO] [RPGMOD]: CurrentMana: 3000.0 [18:50:56] [Server thread/INFO] [RPGMOD]: CurrentMaxMana: 250.0 3000.0 250.0 [18:50:56] [Netty Local Client IO #1/INFO] [RPGMOD]: Trying to synced Mana [18:50:56] [Netty Local Client IO #1/INFO]: [STDOUT]: de.prwh.rpg.capabilities.mana.Mana@753c98de [18:50:56] [Netty Local Client IO #1/INFO]: [STDOUT]: de.prwh.rpg.network.message.ManaNBTMessage@478f5a8 [18:50:56] [Netty Local Client IO #1/INFO]: [STDOUT]: null [18:50:56] [Netty Local Client IO #1/INFO]: [STDOUT]: null [18:50:56] [Netty Local Client IO #1/INFO] [RPGMOD]: Mana synced failed. [18:50:56] [Netty Local Client IO #1/INFO] [RPGMOD]: IMana: de.prwh.rpg.capabilities.mana.Mana@753c98de [18:50:56] [Netty Local Client IO #1/INFO] [RPGMOD]: Message: null [18:50:56] [Netty Local Client IO #1/INFO] [RPGMOD]: IMana: true [18:50:56] [Netty Local Client IO #1/INFO] [RPGMOD]: Message: false Via server command private IMana getManaInfo() { RPGMain.getLogger().info("Sending info to client"); IMana manaInfo = player.getCapability(ManaProvider.MANA_CAP, null); RPGMain.getLogger().info(this.player); RPGMain.getLogger().info(manaInfo); ManaNBTMessage message = new ManaNBTMessage(manaInfo); RPGPacketDispatcher.sendTo(message, (EntityPlayerMP) this.player); return manaInfo; } Message package de.prwh.rpg.network.message; import de.prwh.rpg.RPGMain; import de.prwh.rpg.capabilities.mana.IMana; import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; /** * This message is sent to the client giving it the wanted bytes */ public class ManaNBTMessage implements IMessage { private IMana mana; public ManaNBTMessage() { this.mana = null; } public ManaNBTMessage(IMana mana) { setValue(mana); if(mana != null) { RPGMain.getLogger().info("Mana isnt null"); } else { RPGMain.getLogger().info("Mana is null"); } RPGMain.getLogger().info("ManaNBTMessage: " + this.mana); } @Override public void fromBytes(ByteBuf buf) { System.out.println(buf.readFloat()); System.out.println(buf.readFloat()); if (this.mana != null) { this.mana.setMana(buf.readFloat()); this.mana.setMaxMana(buf.readFloat()); RPGMain.getLogger().info("Load"); RPGMain.getLogger().info("CurrentMana: " + mana.getMana()); RPGMain.getLogger().info("CurrentMaxMana: " + mana.getMaxMana()); } } @Override public void toBytes(ByteBuf buf) { if (this.mana != null) { buf.writeFloat(this.mana.getMana()); buf.writeFloat(this.mana.getMaxMana()); RPGMain.getLogger().info("Save"); RPGMain.getLogger().info("CurrentMana: " + mana.getMana()); RPGMain.getLogger().info("CurrentMaxMana: " + mana.getMaxMana()); } } public void setValue(IMana mana) { this.mana = mana; } public IMana getValue() { return this.mana; } } Handler package de.prwh.rpg.network.handler.client; import de.prwh.rpg.RPGMain; import de.prwh.rpg.capabilities.mana.IMana; import de.prwh.rpg.capabilities.mana.ManaProvider; import de.prwh.rpg.network.message.ManaNBTMessage; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class ManaNBTMessageHandler extends AbstractClientMessageHandler<ManaNBTMessage> { @Override public IMessage handleClientMessage(EntityPlayer player, ManaNBTMessage message, MessageContext ctx) { RPGMain.getLogger().info("Trying to synced Mana"); if (player != null) { IMana mana = player.getCapability(ManaProvider.MANA_CAP, null); final IMana message_mana = message.getValue(); try { System.out.println(mana); System.out.println(message); System.out.println(message.getValue()); System.out.println(message_mana); if (mana != null && message_mana != null) { mana.setMana(message_mana.getMana()); mana.setMaxMana(message_mana.getMaxMana()); RPGMain.getLogger().info("Mana synced"); } else { RPGMain.getLogger().info("Mana synced failed."); RPGMain.getLogger().info("IMana: " + mana); RPGMain.getLogger().info("Message: " + message_mana); RPGMain.getLogger().info("IMana: " + (mana != null)); RPGMain.getLogger().info("Message: " + (message_mana != null)); } } catch (Exception e) { e.printStackTrace(); } } return null; } }
-
[1.10.2 - 1249] Npe while trying to teleport player
Dragonisser replied to Dragonisser's topic in Modder Support
Gonna try it. -
[1.10.2 - 1249] Npe while trying to teleport player
Dragonisser replied to Dragonisser's topic in Modder Support
Your Collision bounding box is null. It can not be null or entities can not collide with it. Well its the code of the original Portalblock. public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { switch ((EnumFacing.Axis)state.getValue(AXIS)) { case X: return X_AABB; case Y: default: return Y_AABB; case Z: return Z_AABB; } } @Nullable public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return NULL_AABB; } http://pastebin.com/gTGsCgqk oh and btw. that's fixed so far, but i cant go back into the overworld dimension, crashing with the same error. -
Ive made a portal in the 1.10.2 but it keeps crashing with an NPE as soon as i step into the portal block. Error: http://pastebin.com/TG24XnP7 BlockPortal: http://pastebin.com/BV9dZDhx Teleporter: http://pastebin.com/rGXXsfZG I tried debugging but hadn't any luck so far. Oh and i get teleported since im in the other dimension after reloading the world.
-
[1.10.2 - 1249] entityIn.motionZ/X limit?
Dragonisser replied to Dragonisser's topic in Modder Support
I've already reverted my change yesterday which changed exactly nothing. I can't make it slower nor faster. There isn't much more of soulsand in the mc code or the jsons. That's the code and nothing more is changed. registerBlock(88, "soul_sand", (new BlockSoulSand()).setHardness(0.5F).setSoundType(SoundType.SAND).setUnlocalizedName("hellsand")); package net.minecraft.block; import javax.annotation.Nullable; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockSoulSand extends Block { protected static final AxisAlignedBB SOUL_SAND_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D); public BlockSoulSand() { super(Material.SAND, MapColor.BROWN); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); } @Nullable public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return SOUL_SAND_AABB; } /** * Called When an Entity Collided with the Block */ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.motionX *= 0.4D; entityIn.motionZ *= 0.4D; } } -
[1.10.2 - 1249] entityIn.motionZ/X limit?
Dragonisser replied to Dragonisser's topic in Modder Support
You got it the wrong way around. The BB from getCollisionBoundinBox has to be bigger than the one from getBoundingBox. Either make the block return a BB with a smaller y-max in getBoundingBox, or make your collision BB have a y-max > 1.0. Soulsand code, which works like shown. package net.minecraft.block; import javax.annotation.Nullable; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockSoulSand extends Block { protected static final AxisAlignedBB SOUL_SAND_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D); public BlockSoulSand() { super(Material.SAND, MapColor.BROWN); this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); } @Nullable public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return SOUL_SAND_AABB; } /** * Called When an Entity Collided with the Block */ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.motionX *= 0.4D; entityIn.motionZ *= 0.4D; } } -
[1.10.2 - 1249] entityIn.motionZ/X limit?
Dragonisser replied to Dragonisser's topic in Modder Support
It is smaller: new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D); It is the soulsand code. -
I tried to make a similar block like the soulsand but the slow effect would be even slower. Well the problem is it wont go any slower. I tried entityIn.motionZ *= 0.1D/0.3D/0.6D; but it is still same speed as the soulsand. Is there some sort of limit to slow(i think it that there wont be one). package de.prwh.nanpa.common.core.blocks; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockJungleMud extends Block { protected static final AxisAlignedBB TAR_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D); public BlockJungleMud() { super(Material.GROUND); this.setHardness(0.6F); this.setUnlocalizedName("jungle_mud"); this.setRegistryName("jungle_mud"); this.setSoundType(SoundType.GROUND); } @Nullable public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return TAR_AABB; } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.motionX *= 0.1D; entityIn.motionZ *= 0.1D; } } Did i miss something?
-
[Solved][1.7.10] Custom biome spawns in Overworld
Dragonisser replied to Dragonisser's topic in Modder Support
Bump .-. Edit: Can be closed. Problem got solved thanks to the author. -
[Solved][1.7.10] Custom biome spawns in Overworld
Dragonisser replied to Dragonisser's topic in Modder Support
As i already said: "Also as soon as i prevent the biomes to be registered in the biomelist of BiomeGenBase, they dont spawn in the overworld anymore. Doesnt help though since they created an npe, when trying to teleport to the dimension." So yeah and i already search in the code but couldnt find anything yet, that would help my with my task. Maybe asking the mod author directly. Edit: Well hes seems to be afk at the minecraftforum -
[Solved][1.7.10] Custom biome spawns in Overworld
Dragonisser replied to Dragonisser's topic in Modder Support
Tried adding my biomes to the biomgen.cfg of BOP and put them on false and the other one was adding the boolean to the contstructor at my biomes because BiomGenBase checks if it should register or not with a boolean "overworld biomes to generate" { B:Higherlands=false B:"Cobex Forest"=false B:"Deep Swamp"=false B:"Tall Forest"=false B:"Blue Mountains"=false B:"Cobalt Caves"=false B:Alps=true B:Arctic=true B:"Bamboo Forest"=true B:Bayou=true public BiomeGenBase(int p_i1971_1_, boolean register) { this.topBlock = Blocks.grass; this.field_150604_aj = 0; this.fillerBlock = Blocks.dirt; this.field_76754_C = 5169201; this.rootHeight = height_Default.rootHeight; this.heightVariation = height_Default.variation; this.temperature = 0.5F; this.rainfall = 0.5F; this.waterColorMultiplier = 16777215; this.spawnableMonsterList = new ArrayList(); this.spawnableCreatureList = new ArrayList(); this.spawnableWaterCreatureList = new ArrayList(); this.spawnableCaveCreatureList = new ArrayList(); this.enableRain = true; this.worldGeneratorTrees = new WorldGenTrees(false); this.worldGeneratorBigTree = new WorldGenBigTree(false); this.worldGeneratorSwamp = new WorldGenSwamp(); this.biomeID = p_i1971_1_; if (register) biomeList[p_i1971_1_] = this; public static void init() { biomemountains = new BiomeGenCobaltMountains(CMMain.biomemountainsid, false).setBiomeName("Higherlands"); biomeplains = new BiomeGenCobaltPlains(CMMain.biomeplainsid, false).setBiomeName("Cobex Forest"); biomeswamp = new BiomeGenCobaltSwamp(CMMain.biomeswampid, false).setBiomeName("Deep Swamp"); biometall = new BiomeGenCobaltTall(CMMain.biometallid, false).setBiomeName("Tall Forest"); biomehills = new BiomeGenCobaltHills(CMMain.biomehillsid, false).setBiomeName("Blue Mountains"); biomecaves = new BiomeGenCobaltCaves(CMMain.biomecavesid, false).setBiomeName("Cobalt Caves"); } Like that -
Hi as my title already says, my custom biome spawns in the normal overworld, which it shouldnt obviously since it is made for the dimension. This all happens only when im using the Biomes o' Plenty worldtype, other worldtypes like, default, superflat, amplified, large biomes arent affected with that bug. Some vanilla Biomes are getting replaced with the biome of mine but still with the same name as it would have normally. It kinda looks like this and is everywhere This it how it looks on the server before i fixed the filler and topblocks, the grey places are all the biome. There are also no id conflicts which normally would cause such a thing. Also as soon as i prevent the biomes to be registered in the biomelist of BiomeGenBase, they dont spawn in the overworld anymore. Doesnt help though since they created an npe, when trying to teleport to the dimension. My Code can be found here: https://github.com/Dragonisser/CobaltMod I appreciate any help i can get, since its a huge bug, which isnt fun to play on modpack server(like we tried yesterday). PS: If any information is needed im reachable via Skype(Dragonisser) or this thread/pm. Edit: As another member stated Biomes o' Plenty seems to add every biome of other mods to the list of possible generation in the overworld, though trying to disabling it in the config didnt worked.
-
[1.7.10] Custom entity glitches through floor
Dragonisser replied to Dragonisser's topic in Modder Support
Le bump? -
Well i made a sandvich on a plate and as soon as i throw it and it lands, it glitches through the floor (kinda like the arrrow issue). Only when i load the world again i can see it where it should be. Entity package de.prwh.minefortress.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import de.prwh.minefortress.main.Inits; public class EntitySandvich extends EntityMob implements IThrowableEntity { public int innerRotation; private int delayBeforeCanPickup = 10; public Entity shootingEntity; public EntitySandvich(World p_i1595_1_) { super(p_i1595_1_); this.innerRotation = this.rand.nextInt(100000); } public EntitySandvich(World p_i1595_1_, EntityLivingBase par2EntityLivingBase) { super(p_i1595_1_); this.shootingEntity = par2EntityLivingBase; } public boolean isAIEnabled() { return true; } public void onLivingUpdate() { this.innerRotation++; if (this.delayBeforeCanPickup > 0) { --this.delayBeforeCanPickup; } this.updateArmSwingProgress(); float f = this.getBrightness(1.0F); if (f > 0.5F) { this.entityAge += 2; } super.onLivingUpdate(); } public boolean canBeCollidedWith() { return true; } @SideOnly(Side.CLIENT) public float getShadowSize() { return this.height / 8.0F; } public boolean hitByEntity(Entity p_85031_1_) { return true; } protected Entity findPlayerToAttack() { return entityToAttack; } public void onCollideWithPlayer(EntityPlayer player) { if (!this.worldObj.isRemote) { if (this.delayBeforeCanPickup > 0) { return; } if (this.shootingEntity == player) { player.inventory.addItemStackToInventory(new ItemStack(Inits.sandvich, 1)); this.setDead(); } else if (this.shootingEntity != player) { final float heal = player.getMaxHealth() - player.getHealth(); player.heal(heal); player.getFoodStats().func_151686_a((ItemFood) Inits.sandvich, new ItemStack(Inits.sandvich, 1)); this.setDead(); } } } @Override public Entity getThrower() { return shootingEntity; } @Override public void setThrower(Entity entity) { this.shootingEntity = entity; } } Render package de.prwh.minefortress.render; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import de.prwh.minefortress.entity.EntitySandvich; import de.prwh.minefortress.entity.ModelSandvich; @SideOnly(Side.CLIENT) public class RenderSandvich extends RenderLiving { protected ModelBase model; public RenderSandvich(ModelSandvich modelsandvich, float f) { super(modelsandvich, f); model = new ModelSandvich(); } public static final ResourceLocation resources = new ResourceLocation("minefortress:textures/entity/sandvich.png"); public void renderSandvich(EntitySandvich entity, double par2, double par4, double par6, float par8, float par9) { float f2 = (float) entity.innerRotation /* + par9 */; float f3 = MathHelper.sin(f2 * 0.05F) / 2.0F + 0.5F; //f3 += f3 * f3; f3 = Math.abs(f3 / 6); super.doRender(entity, par2, par4 + f3, par6, par8, par9); } public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { renderSandvich((EntitySandvich) par1Entity, par2, par4, par6, par8, par9); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return resources; } } Item package de.prwh.minefortress.items; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import de.prwh.minefortress.entity.EntitySandvich; public class ItemSandvich extends ItemFood { public ItemSandvich(int p_i45339_1_, float p_i45339_2_, boolean p_i45339_3_) { super(p_i45339_1_, p_i45339_2_, p_i45339_3_); this.setAlwaysEdible(); } public int getMaxItemUseDuration(ItemStack p_77626_1_) { return 64; } public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) { --p_77654_1_.stackSize; p_77654_3_.getFoodStats().func_151686_a(this, p_77654_1_); final float heal = p_77654_3_.getMaxHealth() - p_77654_3_.getHealth(); p_77654_3_.heal(heal); double d = Math.random(); if (d < 0.33) { p_77654_2_.playSoundAtEntity(p_77654_3_, "minefortress:weapon.nom", 0.5F, p_77654_2_.rand.nextFloat() * 0.1F + 0.9F); } else if (d > 0.33 && d < 0.66) { p_77654_2_.playSoundAtEntity(p_77654_3_, "minefortress:weapon.nom2", 0.5F, p_77654_2_.rand.nextFloat() * 0.1F + 0.9F); } else if (d > 0.66) { p_77654_2_.playSoundAtEntity(p_77654_3_, "minefortress:weapon.nom3", 0.5F, p_77654_2_.rand.nextFloat() * 0.1F + 0.9F); } this.onFoodEaten(p_77654_1_, p_77654_2_, p_77654_3_); return p_77654_1_; } public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityLiving; if (stack.stackSize > 1) { --stack.stackSize; } else if (stack.stackSize == 1) { --stack.stackSize; player.inventory.setInventorySlotContents(player.inventory.currentItem, null); } if (!entityLiving.worldObj.isRemote) { EntitySandvich sand = new EntitySandvich(entityLiving.worldObj, entityLiving); sand.setLocationAndAngles(player.posX + Math.random(), player.posY + 1.5D, player.posZ + Math.random(), player.rotationYaw, player.rotationPitch); double x = -1 * Math.sin(player.rotationYaw * Math.PI / 180) * 0.75F; double z = Math.cos(player.rotationYaw * Math.PI / 180) * 0.75F; double y = (float) 0.5F; sand.setVelocity(x, y, z); player.worldObj.spawnEntityInWorld(sand); } } return false; } }
-
[1.7.10] [Solved] onEntitySwing doesnt consume item
Dragonisser replied to Dragonisser's topic in Modder Support
Doesnt look like it is happy. -
[1.7.10] [Solved] onEntitySwing doesnt consume item
Dragonisser replied to Dragonisser's topic in Modder Support
Thanks a lot :3 Finally i can throw my sandvich and eat it <- little example what it looks like. -
I tried using this code to throw an entity as soon as i left click with the item. The problem is, it doesnt consume the last item. It only does when i hit an entity with it. is there any other way to make it? public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { //--stack.stackSize; if (entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityLiving; --player.getHeldItem().stackSize; if (!entityLiving.worldObj.isRemote) { EntityWolf wolf = new EntityWolf(player.worldObj); wolf.setLocationAndAngles(player.posX + Math.random(), player.posY + 1.5D, player.posZ + Math.random(), player.rotationYaw, player.rotationPitch); player.worldObj.spawnEntityInWorld(wolf); } } return false; }
-
[1.8] How to make a Item not consumable in the crafting table
Dragonisser replied to windows300's topic in Modder Support
https://bitbucket.org/Dragonisser/cobaltmod/src/6c8c494bc93717fb3ce7a008eeb0b5b8760579ac/cobaltmod/main/items/ItemHunterKnife.java?at=master