• Recently Browsing

    No registered users viewing this page.

  • Posts

    • ServerChunkProvider#getSavedData and then DimensionSavedDataManager#folder (needs reflection) will get you the data folder. However I would really encourage you to consider not using a custom data format.
    • In my container class ive created slots  private static final EquipmentSlotType[] VALID_EQUIPMENT_SLOTS = new EquipmentSlotType[]{EquipmentSlotType.HEAD, EquipmentSlotType.CHEST, EquipmentSlotType.LEGS, EquipmentSlotType.FEET}; en.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { int index =0; for(int i = 8;i < 64;i+=18) { final EquipmentSlotType equipmentslottype = VALID_EQUIPMENT_SLOTS[index]; addSlot(new SlotItemHandler(h,index,8,i) { public int getSlotStackLimit() { return 1; } public boolean isItemValid(ItemStack stack) { return stack.canEquip(equipmentslottype,en); } public boolean canTakeStack(PlayerEntity playerIn) { ItemStack itemstack = this.getStack(); return !itemstack.isEmpty() && !playerIn.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.canTakeStack(playerIn); } @OnlyIn(Dist.CLIENT) public Pair<ResourceLocation, ResourceLocation> getBackground() { return Pair.of(MyModContainer.LOCATION_BLOCKS_TEXTURE, MyModContainer.ARMOR_SLOT_TEXTURES[equipmentslottype.getIndex()]); } }); index++; } });   In my entity class i can use hadler to set and get my items from slots public ItemStackHandler handler; private ItemStackHandler getHandler() { if(handler == null) { handler = new ItemStackHandler(4); } return handler; } @Override public ILivingEntityData onInitialSpawn(IServerWorld worldIn, DifficultyInstance difficultyIn, SpawnReason reason, @Nullable ILivingEntityData spawnDataIn, @Nullable CompoundNBT dataTag) { handler.setStackInSlot(0,new ItemStack(Items.DIAMOND_HELMET)); return super.onInitialSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); }   But i cant get an itemstack from my handler from my layer model class. the game crashes. but i can get it from EquipmentSlotType but i dont need it because i store items in my container class slots public class top1Layer extends LayerRenderer<MyEntity, MobModel<MyEntity>> { private static final ResourceLocation TEXTURE_TOP1 = new ResourceLocation(Main.MODID,"textures/entity/mob/monster.png"); public top1Layer(IEntityRenderer<MyEntity, MobModel<MyEntity>> entityRendererIn) { super(entityRendererIn); } @Override public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, MyEntity entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { ItemStack itemstack = entitylivingbaseIn.handler.getStackInSlot(0); } }
    • Whenever i try to launch forge the launcher disappears but Minecraft never shows up. It dosent appear on my taskbar or in my task manager, so i dont know where i can stop it. I tried going into the launcher and starting the game again, but it says the game is already running and something about worlds getting corrupted, so i press play anyway and the same thing happens and nothing has changed. I tried reinstalling forge and restarting my pc, but it still dosent work. There is no crash report btw. This only happens with forge 1.8.9 as far as i can tell, i can run badlion and vanilla. This problem came out if nowhere as i was playing on hypixel and my game crashed. There was nothing going on that was super laggy, or any problem in the network that i can see. I did notice later that i had two copies of a mod called skyblockaddons in my mods folder.   help please?
    • Alright after checking the lilypad item I finally got it working. Thanks so much guys.   And for everyone who has the same question:   This was the right solution for the CustomCrop class: @Override protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { FluidState fluidstate = worldIn.getFluidState(pos); FluidState fluidstate1 = worldIn.getFluidState(pos.up()); return (fluidstate.getFluid() == Fluids.WATER || state.getMaterial() == Material.ICE) && fluidstate1.getFluid() == Fluids.EMPTY; }   And this for the CustomSeed class: /** * Called when this item is used when targetting a Block */ public ActionResultType onItemUse(ItemUseContext context) { return ActionResultType.PASS; } /** * Called to trigger the item's "innate" right click behavior. To handle when this item is used on a Block, see * {@link #onItemUse}. */ public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { BlockRayTraceResult blockraytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.SOURCE_ONLY); BlockRayTraceResult blockraytraceresult1 = blockraytraceresult.withPosition(blockraytraceresult.getPos().up()); ActionResultType actionresulttype = super.onItemUse(new ItemUseContext(playerIn, handIn, blockraytraceresult1)); return new ActionResult<>(actionresulttype, playerIn.getHeldItem(handIn)); }  
    • First, thanks for your help! 😃   The reason why I used isIn() was because nether warts use this to check if it is soulsand: protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { return state.isIn(Blocks.SOUL_SAND); }   I checked how it is done with lilypads before and that didn't do anything either.   So checking if the State at the position is water and the position above is empty would be:   public class BelladonnaCrop extends CropsBlock { private static final VoxelShape[] SHAPES = new VoxelShape[]{Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 10.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D)}; public BelladonnaCrop(Properties builder) { super(builder); } @Override protected IItemProvider getSeedsItem() { return ItemRegister.BELLADONNA_SEEDS.get(); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPES[state.get(this.getAgeProperty())]; } @Override public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) { return super.canSustainPlant(state, world, pos, facing, plantable); } @Override protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { FluidState fluidstate = worldIn.getFluidState(pos); FluidState fluidstate1 = worldIn.getFluidState(pos.up()); return (fluidstate.getFluid() == Fluids.WATER || state.getMaterial() == Material.ICE) && fluidstate1.getFluid() == Fluids.EMPTY; } }   Weird thing about it is that it still works on farmland even though I have overridden the isValidGround function. 😅   Could it be that I need to create a custom event for rightclicking with the seeds as soon as I dont use farmland?    
  • Topics

  • Who's Online (See full list)