Jump to content

Yamahari

Members
  • Posts

    47
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Yamahari's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Omg this actually fixed it, thanks! ( You have no idea how hard I tried to fix this, I think I lost 50% of my hair ) @Override public boolean isReplaceable(BlockState blockStateIn, BlockItemUseContext blockItemUseContextIn) { //return blockItemUseContextIn.getItem().getItem() == this.asItem(); for(Block block : Constants.SCAFFOLDINGS) { if(blockItemUseContextIn.getItem().getItem() == Item.getItemFromBlock(block)) return true; } return false; } My question now is, why did this fix this, I don't get it
  2. Normally I wait until mapping catch up, but I want help so I updated the names as far as I could without intentionally changing the meaning ( I hope )
  3. Hi, I made a custom scaffolding block and a corresponding item class that you can have a look at here: https://github.com/Yamahari/ILikeWood/blob/master/src/main/java/yamahari/ilikewood/blocks/WoodenScaffoldingBlock.java https://github.com/Yamahari/ILikeWood/blob/master/src/main/java/yamahari/ilikewood/items/WoodenScaffoldingItem.java My issue is the following: https://imgur.com/jdwOKtN Basically when I try to place a scaffolding block that is not of the same wood type as the block I aimed at, the autostacking feature doesn't work. I tracked it down to the following issue: When I use the "appropiate" scaffolding the "getBlockItemUseContext" method of my custom item is called with a BlockItemUseContext that has the position of the scaffolding block I aimed at. But if I use another wood type the function gets called with a context that contains the block that is one block off in the direction of the face I was aiming at, e.g. in the video that's an air block. This causes my "instanceof" checks in the "getBlockItemUseContext" method to fail. But I can't figure out why it's not passing the scaffolding block position in the context when it's a different wood type. Does BlockItem somehow change the logic of chosing the forwarded block position depending on whether or not the used item corresponds to the block that was registered to the BlockItem?
  4. oh yea and forget that part in onRegisterTileEntity, that was me trying to fix it for myself but that line crashes the game
  5. there are no 1.14 versions of these mods, where did you get them from
  6. Here's the github if you wanna take a look https://github.com/Yamahari/ILikeWood
  7. there's no related code but what I already mentioned for(String wood : new String[]{"oak", "dark_oak", "spruce", "birch", "jungle", "acacia"}) { event.getRegistry().register(new BarrelBlock( Block.Properties.create(Material.WOOD).hardnessAndResistance(2.5f).sound(SoundType.WOOD)).setRegistryName(wood + "_barrel")); } and the appropiate BlockItems in register Items. My guess it's some issue between client and server, but I have never worked with containers so I have no idea what to do.
  8. Hi, I am trying to make a custom barrel block. So i registered a new instance of BarrelBlock and setup all the models etc. correctly. My block appears in-game and if I click it a GUI shows up. BUT, if I put items in the barrel they disappear and if I close the GUI the barrel stays in the "open" state. ( the lid is open ). I am sure I forgot something but I don't know what. Any ideas
  9. In my case, on 1.12.2 Forge didn't create a launcher profile, I had to make a new profile and select the version if Forge I just installed
  10. Hm, just as I say that I think I got it. The event is not called with the position of the stem but the position of the melon/pumpkin. Why? Now that's gonna be annoying to fix. Is this intentional? Because the same code works as intented on 1.13.2
  11. Hi, I have this event handler @SubscribeEvent public static void onCropGrowPost(final BlockEvent.CropGrowEvent.Post event) { World world = event.getWorld(); IBlockState blockState = event.getState(); Block block = blockState.getBlock(); BlockPos pos = event.getPos(); if(block instanceof BlockCrops) { int age = blockState.getValue(((BlockCrops) block).AGE); int maxAge = ((BlockCrops) block).getMaxAge(); if (age == maxAge) { IBlockState soil = world.getBlockState(pos.down()); Block soilBlock = soil.getBlock(); if (soilBlock == BlockList.dry_farmland) { if(!world.isRemote) world.setBlockState(pos.down(), soil.withProperty(((BlockDryFarmland) soilBlock).getNutrition(), Boolean.valueOf(false)),1 | 2); } } else if (block != BlockList.weeds) { if (world.rand.nextInt(10) == 0) { if(!world.isRemote) world.setBlockState(pos, BlockList.weeds.getDefaultState().withProperty(((BlockCrops) block).AGE, (int)Math.floor(((float)age / (float)maxAge) * 7.f)), 1 | 2); } } } else if (block instanceof BlockStem) { if (blockState.getValue(((BlockStem) block).AGE) == 7) { IBlockState soil = world.getBlockState(pos.down()); Block soilBlock = soil.getBlock(); if (soilBlock == BlockList.dry_farmland) { if(!world.isRemote) world.setBlockState(pos.down(), soil.withProperty(((BlockDryFarmland) soilBlock).getNutrition(), Boolean.valueOf(false)), 1 | 2); } } } event.setResult(Event.Result.DEFAULT); } But for some reason stems only reset the nutrition of my custom farmland block when they grow to age 7, not when they grow a fruit. Does anyone know why?
  12. In java "==" does mean something different than in other languages, "==" compares if both references reference the same instance, if you wanna compare if 2 objects are equal, you can use .equals() method or as provided by Forge a reference to the registered Item/Block in Items.<name of block>, Blocks.<name of block> ( note that as pointed out by @TheOnlyTrueEnte you can use == here because the getItem() method you're using returns a reference to some item in Items or your custom item list not a new instance of that item)
  13. i tried overwriting the farmland block in 1.13.2 with the result of an runtime exception - illegal vanilla overwrite or smth like that, changed my code since then don't remember exactly
×
×
  • Create New...

Important Information

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