Everything posted by DonKresenko
-
How can i convert ItemStack to Supplier<ItemStack>???
Supplier is just a function that produces a value of type T (in your case ItemStack). You can use lambda here () -> new ItemStack(Blocks.ANVIL)
-
[1.12.2][solved] Block getMetaFromState for multiple properties
Got it now Thank you for your help I removed this if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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); }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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)
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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); }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
That is getStateFromMeta method I get this exception
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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?
-
[1.12.2][solved] Block getMetaFromState for multiple properties
Alright. Thank you
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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?
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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; }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
Or even if I have 3 properties, then I would probably need TileEntity class
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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.
-
[1.12.2] Custom cauldron liquid storing detection (?)
Alright. Thank you
-
[1.12.2] Custom cauldron liquid storing detection (?)
Ok, I'll have a look. Thank you
-
[1.12.2] Custom cauldron liquid storing detection (?)
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
-
[1.12.2] Custom cauldron liquid storing detection (?)
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?
-
[1.8.9][SOLVED] Spawning item when the block is placed
Yes, that worked. Thank you I used entityitem.setPickupDelay(20); to set my own delay
-
[1.8.9][SOLVED] Spawning item when the block is placed
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
-
[1.8.9][SOLVED] Spawning item when the block is placed
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
-
[1.7.10] Adding trade to "new" villager type mob
Ok, thank you guys
-
[1.7.10] Adding trade to "new" villager type mob
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 \/
-
[1.7.10] Adding trade to "new" villager type mob
I have a check where if it's null then will return a recipe. But isn't working. Know how to fix it?
-
[1.7.10] Adding trade to "new" villager type mob
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))); } }
-
[SOLVED][1.7.10] On block placed method is executed twice?
Oh, wait. Nevermind. I fixed it
-
[SOLVED][1.7.10] On block placed method is executed twice?
Sorry, I don't quite get it
IPS spam blocked by CleanTalk.