Jump to content

DonKresenko

Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by DonKresenko

  1. Got it now Thank you for your help I removed this if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; }
  2. Alright I almost got it. The problem now is this image code: public IBlockState getStateFromMeta(int meta) { int lvl = meta>>2; int face = meta & 0b11; EnumFacing enumfacing = EnumFacing.getHorizontal(face); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(lvl)).withProperty(FACING, enumfacing); }
  3. Ok. public IBlockState getStateFromMeta(int meta) { int lvl = meta>>2; int face = meta & 0b11; EnumFacing enumfacing = EnumFacing.getFront(face); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(lvl)).withProperty(FACING, enumfacing); } This works for NORTH and SOUTH but not for the EAST and WEST This is my problem now (note that directional block is working, this is after reloading the world)
  4. sorry I read getMetaFromState public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(meta)).withProperty(FACING, enumfacing); }
  5. I now decreased my property LEVEL to 2 bits (0-3) I tried this code but it seems not to be working public int getMetaFromState(IBlockState state) { int lvl = ((Integer)state.getValue(LEVEL)).intValue(); lvl <<= 2; int i = ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); // System.out.println(lvl+" | "+i+" = "+(lvl |= i)); lvl |= i; return lvl; } What am I doing wrong?
  6. Thank you for the information. I have LEVEL property (0,6) that takes 3 bits and FACING (n, s, e, w) which takes 2 bits. So I cannot do this cause I need 5 bits?
  7. I found this in BlockEndPortalFrame, but I am not quite familiar with this public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); if (((Boolean)state.getValue(EYE)).booleanValue()) { i |= 4; } return i; }
  8. Or even if I have 3 properties, then I would probably need TileEntity class
  9. I have two properties in my block, LEVEL and FACING. I need to store the meta in order to save the properties. I have this code public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(LEVEL)).intValue(); } which saves LEVEL property. I need a way to save FACING property too.
  10. The thing is that you did not understood what I asked. I want to be able to place more than one liquid in the cauldron but I don't want to "mix" them. In other words, only one liquid can be in the cauldron at the time Here is the onBlockActivated method in my block With this code, I can add lava in my cauldron and take it out from the cauldron. Now I want to add the ability to store water, but not if there is lava already in the cauldron. Thank you for the reply
  11. I am creating a custom cauldron. It functions almost the same way as vanilla cauldron except it can store multiple liquids. My problem is that I don't know how to detect which liquid I am storing and preventing the player to "mix" liquids in same cauldron (in other words, only one type of liquid can be in cauldron). Any ideas how to do that?
  12. Yes, that worked. Thank you I used entityitem.setPickupDelay(20); to set my own delay
  13. Thanks, it works now. One more question, i see that pick up delay int (EntityItem.delayBeforeCanPickup ) is now private, is there any substitute? new code
  14. Help me solve this problem. When I place my block, i want an item to spawn. I tryed this method but it isn't working. @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { if(!worldIn.isRemote) { float f = 0.7F; double d = worldIn.rand.nextFloat() * f + (1.0F - f) * 0.5D; double d1 = worldIn.rand.nextFloat() * f + (1.0F - f) * 0.2D + 0.6D; double d2 = worldIn.rand.nextFloat() * f + (1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(worldIn, hitX + d, hitY + d1, hitZ + d2, new ItemStack(Items.apple, 1)); //entityitem.delayBeforeCanPickup = 5; worldIn.spawnEntityInWorld(entityitem); } return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer); } anyone knows solution? Thanks
  15. Got the recipe working, but it crashes when i use the trade source package com.nuclearbanana.anticraft.entity; import com.nuclearbanana.anticraft.AntiCraft; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.Tuple; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.world.World; public class EntityWizard extends EntityVillager { //private MerchantRecipeList buyingList; public EntityWizard(World w) { super(w); } @Override public MerchantRecipeList getRecipes(EntityPlayer player) { MerchantRecipeList merchantrecipelist = new MerchantRecipeList(); merchantrecipelist.add(new MerchantRecipe(new ItemStack(Items.ghast_tear, 8, 0), new ItemStack(AntiCraft.Triphophyllite), new ItemStack(AntiCraft.Kukstibite, 16))); return merchantrecipelist; } @Override public void setRecipes(MerchantRecipeList recipeList) { recipeList.add(new MerchantRecipe(new ItemStack(Items.ghast_tear, 8, 0), new ItemStack(AntiCraft.Triphophyllite), new ItemStack(AntiCraft.Kukstibite, 16))); } public void addDefaultEquipmentAndRecipies(int i) { MerchantRecipeList merchantrecipelist; merchantrecipelist = new MerchantRecipeList(); merchantrecipelist.add(new MerchantRecipe(new ItemStack(Items.ghast_tear, 8, 0), new ItemStack(AntiCraft.Triphophyllite), new ItemStack(AntiCraft.Kukstibite, 16))); } } Crash report \/
  16. I have a check where if it's null then will return a recipe. But isn't working. Know how to fix it?
  17. First of all, I'M NOT MAKING A NEW VILLAGER TYPE (that one is easy), I'm making a new MOB that can trade with the player and has only 1 trade. The mob has a custom model and custom render (that part is done), but I can't get the trade to work. The GUI shows up when i right-click on a mob, but there's a blank trade (see photo). Anyone know how to fix it? Would help Problem photo Entity code package com.blabla.test; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.Tuple; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.world.World; public class EntityWizard extends EntityVillager { private MerchantRecipeList buyingList; public EntityWizard(World w) { super(w); } @Override public MerchantRecipeList getRecipes(EntityPlayer player) { if (this.buyingList == null) { this.addDefaultEquipmentAndRecipies(1); } return this.buyingList; } @Override public void setRecipes(MerchantRecipeList recipeList) { recipeList.add(new MerchantRecipe(new ItemStack(Items.ghast_tear, 8, 0), null, new ItemStack(Items.arrow, 16))); } public void addDefaultEquipmentAndRecipies(int i) { MerchantRecipeList merchantrecipelist; merchantrecipelist = new MerchantRecipeList(); merchantrecipelist.add(new MerchantRecipe(new ItemStack(Items.ghast_tear, 8, 0), null, new ItemStack(Items.arrow, 16))); } }
  18. In other word, what should i do in order to my item to dorp whenever the block is placed?
×
×
  • Create New...

Important Information

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