Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

vassdeniss

Members
  • Posts

    46
  • Joined

  • Last visited

Recent Profile Visitors

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

vassdeniss's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I know about custom recipes but the anvil uses a recipe container to check if the item can be used and i dont know how to make a custom one.
  2. Well nevermind it does work! Now just how would i be able to make custom recipes for it that a normal anvil can't do?
  3. Why not yeah but that won't make things all work yet in my opinion
  4. I am trying to create a custom anvil for my mod and the approach i am trying is to create a normal vanilla anvil with custom recipe container - i tried creating the block and passing a custom container to it but i do feel a bit stuck and confused on how to do this. Some explanation and guidence would be great! Thanks in advance. package com.vassdeniss.makoru.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.SimpleNamedContainerProvider; import net.minecraft.stats.Stats; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.IWorldPosCallable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; public class AngelAnvilBlock extends Block { private static final ITextComponent AngelAnvilContainer = new TranslationTextComponent("container.crafting"); public AngelAnvilBlock() { super(Block.Properties.create()); } @Override public ActionResultType onBlockActivated(BlockState p_225533_1_, World worldIn, BlockPos p_225533_3_, PlayerEntity player, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) { if (worldIn.isRemote) { return ActionResultType.SUCCESS; } else { NetworkHooks.openGui(player, ); player.addStat(Stats.INTERACT_WITH_ANVIL); return ActionResultType.CONSUME; } } @Override public INamedContainerProvider getContainer(BlockState state, World world, BlockPos pos) { return new SimpleNamedContainerProvider((id, inventory, player) -> new AngelAnvilContainer(id, inventory, IWorldPosCallable.of(world, pos)), AngelAnvilContainer); } } package com.vassdeniss.makoru.blocks; import com.vassdeniss.makoru.util.RegistryHandler; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.RepairContainer; import net.minecraft.util.IWorldPosCallable; public class AngelAnvilContainer extends RepairContainer { private final IWorldPosCallable field_217070_e; public AngelAnvilContainer(int id, PlayerInventory playerInventory, IWorldPosCallable p_i50102_3_) { super(id, playerInventory, p_i50102_3_); this.field_217070_e = p_i50102_3_; } @Override public boolean canInteractWith(PlayerEntity player) { return isWithinUsableDistance(this.field_217070_e, player, RegistryHandler.ANGEL_ANVIL.get()); } }
  5. I recently got an iMac and now I' m transferring everything i need over - including my mod - but when i try to run it i get this error which i can't find information on it anywhere and would appreciate if anyone can help! Heres the error
  6. Fixed it. Just looked at how vanilla does it in the Features class and implemented it in my own generation class
  7. Still no. Jesus i have no idea heres my registry line public static final RegistryObject<Block> MINT_BUSH_BLOCK = BLOCKS.register("mint_bush_block", MintBush::new); and the mint bush class itself public class MintBush extends SweetBerryBushBlock { public MintBush() { super(Block.Properties.create(Material.PLANTS) .hardnessAndResistance(0, 0) .doesNotBlockMovement() .tickRandomly() .sound(SoundType.PLANT) ); } @Override public ItemStack getItem(IBlockReader worldIn, BlockPos pos, BlockState state) { return new ItemStack(RegistryHandler.MINT.get()); } @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { int i = state.get(AGE); boolean flag = i == 3; if (!flag && player.getHeldItem(handIn).getItem() == Items.BONE_MEAL) { return ActionResultType.PASS; } else if (i > 1) { int j = 1 + worldIn.rand.nextInt(2); spawnAsEntity(worldIn, pos, new ItemStack(RegistryHandler.MINT.get(), j + (flag ? 1 : 0))); worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_SWEET_BERRIES_PICK_FROM_BUSH, SoundCategory.BLOCKS, 1, 0.8f + worldIn.rand.nextFloat() * 0.4f ); worldIn.setBlockState(pos, state.with(AGE, 1), 2); return ActionResultType.SUCCESS; } else { return super.onBlockActivated(state, worldIn, pos, player, handIn, hit); } } @Override public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { super.onEntityCollision(state, worldIn, pos, entityIn); } } maybe its something there but I doubt it
  8. How can I look at what unmapped function does what?
  9. @Mod.EventBusSubscriber public class DecorationGeneration { public static ConfiguredFeature<?, ?> MINT; public static void registerBushes() { MINT = register("mint", Feature.RANDOM_PATCH.withConfiguration( new BlockClusterFeatureConfig.Builder( new SimpleBlockStateProvider( RegistryHandler.MINT_BUSH_BLOCK.get().getDefaultState().with(MintBush.AGE, 3)), SimpleBlockPlacer.PLACER) .tries(64).func_227317_b_() .whitelist(Sets.newHashSet(Blocks.GRASS_BLOCK)).build()) .withPlacement(Features.Placements.PATCH_PLACEMENT).chance(80) ); } @SubscribeEvent(priority = EventPriority.HIGHEST) public static void gen(BiomeLoadingEvent event) { if (MINT != null) { event.getGeneration().withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, MINT); } } private static <FC extends IFeatureConfig> ConfiguredFeature<FC, ?> register(String name, ConfiguredFeature<FC, ?> configuredFeature) { return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation("makoru", name), configuredFeature); } } DecoGeneration private void setup(final FMLCommonSetupEvent event) { OreGeneration.registerOres(); DecorationGeneration.registerBushes(); DeferredWorkQueue.runLater(() -> { GlobalEntityTypeAttributes.put(RegistryHandler.NIMBAT.get(), NimbatEntity.setCustomAttributes().create()); }); } Main Class
  10. MINT = register("mint", Feature.RANDOM_PATCH.withConfiguration( new BlockClusterFeatureConfig.Builder( new SimpleBlockStateProvider( RegistryHandler.MINT_BUSH_BLOCK.get().getDefaultState().with(MintBush.AGE, 3)), SimpleBlockPlacer.PLACER) .tries(64).func_227317_b_() .whitelist(Sets.newHashSet(Blocks.GRASS_BLOCK)).build()) .withPlacement(Features.Placements.PATCH_PLACEMENT).chance(80) ); Still not seeing it Everything seems correct i don't get it
  11. Youve been of amazing help! Ill try to see if it generates now. I believe i shall also update my mappings
  12. Specifically noProjection and HEIGHTMAP_DOUBLE_SQUARE
  13. Im missing some of the code youre using. Im using MCP i think it uses different functions?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.