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

[1.17.1] Problem With Custom Fluid


furiusmax55
 Share

Recommended Posts

		public static final RegistryObject<CustomLiquidBlock> PURIFIEDWATERBLOCK = BLOCKS	
		           .register("purified_water", () -> new CustomLiquidBlock(ModFluids.PURIFIEDWATER, 			  BlockBehaviour.Properties.of(Material.WATER).noCollission().strength(100.0F).noDrops()));
Spoiler
public class CustomLiquidBlock extends LiquidBlock{
	   public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL;
	   protected final FlowingFluid fluid;
	   private final List<FluidState> stateCache;
	   public static final VoxelShape STABLE_SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
	   public static final ImmutableList<Direction> POSSIBLE_FLOW_DIRECTIONS = ImmutableList.of(Direction.DOWN, Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST);

	   @Deprecated  // Forge: Use the constructor that takes a supplier
	   public CustomLiquidBlock(FlowingFluid p_54694_, BlockBehaviour.Properties p_54695_) {
	      super(p_54694_, p_54695_);
	      this.fluid = p_54694_;
	      this.stateCache = Lists.newArrayList();
	      this.stateCache.add(p_54694_.getSource(false));

	      for(int i = 1; i < 8; ++i) {
	         this.stateCache.add(p_54694_.getFlowing(8 - i, false));
	      }

	      this.stateCache.add(p_54694_.getFlowing(8, true));
	      this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
	      fluidStateCacheInitialized = true;
	      supplier = p_54694_.delegate;
	   }

	   /**
	    * @param supplier A fluid supplier such as {@link net.minecraftforge.fmllegacy.RegistryObject<Fluid>}
	    */
	   public CustomLiquidBlock(java.util.function.Supplier<? extends FlowingFluid> p_54694_, BlockBehaviour.Properties p_54695_) {
	      super(p_54694_, p_54695_);
	      this.fluid = null;
	      this.stateCache = Lists.newArrayList();
	      this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
	      this.supplier = p_54694_;
	   }
       @Override
	   public VoxelShape getCollisionShape(BlockState p_54760_, BlockGetter p_54761_, BlockPos p_54762_, CollisionContext p_54763_) {
	      return p_54763_.isAbove(STABLE_SHAPE, p_54762_, true) && p_54760_.getValue(LEVEL) == 0 && p_54763_.canStandOnFluid(p_54761_.getFluidState(p_54762_.above()), getFluid()) ? STABLE_SHAPE : Shapes.empty();
	   }
       @Override
	   public boolean isRandomlyTicking(BlockState p_54732_) {
	      return p_54732_.getFluidState().isRandomlyTicking();
	   }
       @Override
	   public void randomTick(BlockState p_54740_, ServerLevel p_54741_, BlockPos p_54742_, Random p_54743_) {
	      p_54740_.getFluidState().randomTick(p_54741_, p_54742_, p_54743_);
	   }
       @Override
	   public boolean propagatesSkylightDown(BlockState p_54745_, BlockGetter p_54746_, BlockPos p_54747_) {
	      return false;
	   }
       @Override
	   public boolean isPathfindable(BlockState p_54704_, BlockGetter p_54705_, BlockPos p_54706_, PathComputationType p_54707_) {
	      return !getFluid().is(FluidTags.LAVA);
	   }
       @Override
	   public FluidState getFluidState(BlockState p_54765_) {
	      int i = p_54765_.getValue(LEVEL);
	      if (!fluidStateCacheInitialized) initFluidStateCache();
	      return this.stateCache.get(Math.min(i, 8));
	   }
       @Override
	   public boolean skipRendering(BlockState p_54716_, BlockState p_54717_, Direction p_54718_) {
	      return p_54717_.getFluidState().getType().isSame(getFluid());
	   }
       @Override
	   public RenderShape getRenderShape(BlockState p_54738_) {
	      return RenderShape.INVISIBLE;
	   }
       @Override
	   public List<ItemStack> getDrops(BlockState p_54720_, LootContext.Builder p_54721_) {
	      return Collections.emptyList();
	   }
       @Override
	   public VoxelShape getShape(BlockState p_54749_, BlockGetter p_54750_, BlockPos p_54751_, CollisionContext p_54752_) {
	      return Shapes.empty();
	   }
       @Override
	   public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) {
	      if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) {
	         p_54755_.getLiquidTicks().scheduleTick(p_54756_, p_54754_.getFluidState().getType(), getFluid().getTickDelay(p_54755_));
	      }

	   }
       @Override
	   public BlockState updateShape(BlockState p_54723_, Direction p_54724_, BlockState p_54725_, LevelAccessor p_54726_, BlockPos p_54727_, BlockPos p_54728_) {
	      if (p_54723_.getFluidState().isSource() || p_54725_.getFluidState().isSource()) {
	         p_54726_.getLiquidTicks().scheduleTick(p_54727_, p_54723_.getFluidState().getType(), getFluid().getTickDelay(p_54726_));
	      }

	      return null;
	   }
       @Override
	   public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) {
	      if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) {
	         p_54710_.getLiquidTicks().scheduleTick(p_54711_, p_54709_.getFluidState().getType(), getFluid().getTickDelay(p_54710_));
	      }

	   }
       
	   private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) {
	      if (getFluid().is(FluidTags.LAVA)) {
	         boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL);

	         for(Direction direction : POSSIBLE_FLOW_DIRECTIONS) {
	            BlockPos blockpos = p_54698_.relative(direction.getOpposite());
	            if (p_54697_.getFluidState(blockpos).is(FluidTags.WATER)) {
	               Block block = p_54697_.getFluidState(p_54698_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
	               p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.defaultBlockState()));
	               this.fizz(p_54697_, p_54698_);
	               return false;
	            }

	            if (flag && p_54697_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) {
	               p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, Blocks.BASALT.defaultBlockState()));
	               this.fizz(p_54697_, p_54698_);
	               return false;
	            }
	         }
	      }

	      return true;
	   }

	   private void fizz(LevelAccessor p_54701_, BlockPos p_54702_) {
	      p_54701_.levelEvent(1501, p_54702_, 0);
	   }
       @Override
	   protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_54730_) {
	      p_54730_.add(LEVEL);
	   }
       @Override
	   public ItemStack pickupBlock(LevelAccessor p_153772_, BlockPos p_153773_, BlockState p_153774_) {
	      if (p_153774_.getValue(LEVEL) == 0) {
	         p_153772_.setBlock(p_153773_, Blocks.AIR.defaultBlockState(), 11);
	         return new ItemStack(getFluid().getBucket());
	      } else {
	         return ItemStack.EMPTY;
	      }
	   }

	   // Forge start
	   private final java.util.function.Supplier<? extends net.minecraft.world.level.material.Fluid> supplier;
	   @Override
	   public FlowingFluid getFluid() {
	      return (FlowingFluid)supplier.get();
	   }

	   private boolean fluidStateCacheInitialized = false;
	   @Override
	   protected synchronized void initFluidStateCache() {
	      if (fluidStateCacheInitialized == false) {
	         this.stateCache.add(getFluid().getSource(false));

	         for (int i = 1; i < 8; ++i)
	            this.stateCache.add(getFluid().getFlowing(8 - i, false));

	         this.stateCache.add(getFluid().getFlowing(8, true));
	         fluidStateCacheInitialized = true;
	      }
	   }
	   @Override
	   public Optional<SoundEvent> getPickupSound() {
	      return getFluid().getPickupSound();
	   }
}

 

	    public static final RegistryObject<FlowingFluid> PURIFIEDWATER = FLUIDS
	            .register("purified_water",
	                    () -> new FluidPurifiedWater.Source(FluidPurifiedWater.PURIFIED_WATER_PROPS));
	    public static final RegistryObject<FlowingFluid> PURIFIEDWATER_FLOW = FLUIDS
	            .register("purified_water_flow",
	                    () -> new FluidPurifiedWater.Flowing(FluidPurifiedWater.PURIFIED_WATER_PROPS));
Spoiler
public abstract class FluidPurifiedWater extends ForgeFlowingFluid{
	
	
   public static final ForgeFlowingFluid.Properties PURIFIED_WATER_PROPS =
            new ForgeFlowingFluid.Properties(
            		ModFluids.PURIFIEDWATER, ModFluids.PURIFIEDWATER_FLOW, FluidAttributes
                    .builder(new ResourceLocation(ArkaneMagicka.MOD_ID, "block/purified_water_still"),
                            new ResourceLocation(ArkaneMagicka.MOD_ID, "block/purified_water_flow"))
                    .color(0x3DDCFF).density(4).viscosity(1).rarity(Rarity.EPIC))
                    .bucket(ModItems.PURIFIEDWATER_BUCKET)
                    .block(ModBlocks.PURIFIEDWATERBLOCK);

    protected FluidPurifiedWater(Properties properties) {
        super(properties);
    }
    

    public static class Flowing extends FluidPurifiedWater {
    	
        protected Flowing(Properties properties) {
			super(properties);
            registerDefaultState(getStateDefinition().any().setValue(LEVEL, 7));

		}
        @Override
		protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> p_76476_) {
            super.createFluidStateDefinition(p_76476_);
            p_76476_.add(LEVEL);
         }
        @Override
         public int getAmount(FluidState p_76480_) {
            return p_76480_.getValue(LEVEL);
         }
        @Override
         public boolean isSource(FluidState p_76478_) {
            return false;
         }

    }
    public static class Source extends FluidPurifiedWater {

        public Source(Properties properties) {
            super(properties);
        }
        @Override
        public int getAmount(FluidState p_76485_) {
            return 8;
         }
        @Override
         public boolean isSource(FluidState p_76483_) {
            return true;
         }
    }
}

 

crash log 
 

Spoiler
---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 15/9/21 12:05
Description: Exception while ticking

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.block.state.BlockState.isAir()" because "p_49910_" is null
	at net.minecraft.world.level.block.Block.updateOrDestroy(Block.java:158) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateNeighbourShapes(BlockBehaviour.java:611) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.Level.markAndNotifyBlock(Level.java:246) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:213) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:177) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.material.FlowingFluid.spreadTo(FlowingFluid.java:244) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spreadToSides(FlowingFluid.java:146) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spread(FlowingFluid.java:125) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.tick(FlowingFluid.java:410) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FluidState.tick(FluidState.java:73) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tickLiquid(ServerLevel.java:602) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.ServerTickList.tick(ServerTickList.java:78) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:341) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:882) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:818) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:85) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:683) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:258) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:831) [?:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
	at net.minecraft.world.level.block.Block.updateOrDestroy(Block.java:158) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateNeighbourShapes(BlockBehaviour.java:611) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.Level.markAndNotifyBlock(Level.java:246) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:213) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:177) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.material.FlowingFluid.spreadTo(FlowingFluid.java:244) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spreadToSides(FlowingFluid.java:146) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spread(FlowingFluid.java:125) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.tick(FlowingFluid.java:410) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FluidState.tick(FluidState.java:73) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tickLiquid(ServerLevel.java:602) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
-- Block being ticked --
Details:
	Block location: World: (-48,4,63), Section: (at 0,4,15 in -3,0,3; chunk contains blocks -48,0,48 to -33,255,63), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Stacktrace:
	at net.minecraft.world.level.ServerTickList.tick(ServerTickList.java:78) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:341) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}


-- Affected level --
Details:
	All players: 1 total; [ServerPlayer['Dev'/99, l='ServerLevel[New World]', x=-48.50, y=4.00, z=61.50]]
	Chunk stats: 2209
	Level dimension: minecraft:overworld
	Level spawn location: World: (-48,4,64), Section: (at 0,4,0 in -3,0,4; chunk contains blocks -48,0,64 to -33,255,79), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
	Level time: 241 game time, 241 day time
	Level name: New World
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
	Level weather: Rain time: 27970 (now: false), thunder time: 15855 (now: false)
	Known server brands: forge
	Level was modded: true
	Level storage version: 0x04ABD - Anvil
Stacktrace:
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:882) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:818) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:85) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:683) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:258) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:831) [?:?] {}


-- System Details --
Details:
	Minecraft Version: 1.17.1
	Minecraft Version ID: 1.17.1
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 16.0.1, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
	Memory: 1174793640 bytes (1120 MiB) / 1895825408 bytes (1808 MiB) up to 4276092928 bytes (4078 MiB)
	CPUs: 16
	Processor Vendor: AuthenticAMD
	Processor Name: AMD Ryzen 7 2700X Eight-Core Processor         
	Identifier: AuthenticAMD Family 23 Model 8 Stepping 2
	Microarchitecture: Zen+
	Frequency (GHz): 3,69
	Number of physical packages: 1
	Number of physical CPUs: 8
	Number of logical CPUs: 16
	Graphics card #0 name: NVIDIA GeForce GTX 1050 Ti
	Graphics card #0 vendor: NVIDIA (0x10de)
	Graphics card #0 VRAM (MB): 4095,00
	Graphics card #0 deviceId: 0x1c82
	Graphics card #0 versionInfo: DriverVersion=27.21.14.5671
	Memory slot #0 capacity (MB): 8192,00
	Memory slot #0 clockSpeed (GHz): 2,67
	Memory slot #0 type: DDR4
	Memory slot #1 capacity (MB): 8192,00
	Memory slot #1 clockSpeed (GHz): 2,67
	Memory slot #1 type: DDR4
	Virtual memory max (MB): 20912,76
	Virtual memory used (MB): 12187,51
	Swap memory total (MB): 4608,00
	Swap memory used (MB): 5,98
	JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -XX:+ShowCodeDetailsInExceptionMessages
	Player Count: 1 / 8; [ServerPlayer['Dev'/99, l='ServerLevel[New World]', x=-48.50, y=4.00, z=61.50]]
	Data Packs: vanilla, mod:arkanemagicka (incompatible), mod:forge
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'forge'
	ModLauncher: 9.0.7+91+master.8569cdf
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		 eventbus PLUGINSERVICE 
		 object_holder_definalize PLUGINSERVICE 
		 runtime_enum_extender PLUGINSERVICE 
		 capability_inject_definalize PLUGINSERVICE 
		 accesstransformer PLUGINSERVICE 
		 runtimedistcleaner PLUGINSERVICE 
		 fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		minecraft@1.0
		javafml@null
	Mod List: 
		forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp|Minecraft                     |minecraft                     |1.17.1              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		main                                              |Arkane Magicka                |arkanemagicka                 |0.0NONE             |DONE      |Manifest: NOSIGNATURE
		                                                  |Forge                         |forge                         |37.0.53             |DONE      |Manifest: NOSIGNATURE
	Crash Report UUID: affe95c1-583d-48a6-bdec-2b4868fdeb6a
	FML: 37.0
	Forge: net.minecraftforge:37.0.53

 

When I put the fluid with its bucket the game crashes giving that error.

The LiquidBlock class constructor is broken and I had to create CustomLiquidBlock to fix it by changing this.fluid to getFluid().

Thanks in advance.

Edited by furiusmax55
Link to comment
Share on other sites

  • furiusmax55 changed the title to [1.17.1] Problem With Custom Fluid
1 minute ago, diesieben07 said:

CustomLiquidBlock is not shown.

Spoiler
public class CustomLiquidBlock extends LiquidBlock{
	   public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL;
	   protected final FlowingFluid fluid;
	   private final List<FluidState> stateCache;
	   public static final VoxelShape STABLE_SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
	   public static final ImmutableList<Direction> POSSIBLE_FLOW_DIRECTIONS = ImmutableList.of(Direction.DOWN, Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST);

	   @Deprecated  // Forge: Use the constructor that takes a supplier
	   public CustomLiquidBlock(FlowingFluid p_54694_, BlockBehaviour.Properties p_54695_) {
	      super(p_54694_, p_54695_);
	      this.fluid = p_54694_;
	      this.stateCache = Lists.newArrayList();
	      this.stateCache.add(p_54694_.getSource(false));

	      for(int i = 1; i < 8; ++i) {
	         this.stateCache.add(p_54694_.getFlowing(8 - i, false));
	      }

	      this.stateCache.add(p_54694_.getFlowing(8, true));
	      this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
	      fluidStateCacheInitialized = true;
	      supplier = p_54694_.delegate;
	   }

	   /**
	    * @param supplier A fluid supplier such as {@link net.minecraftforge.fmllegacy.RegistryObject<Fluid>}
	    */
	   public CustomLiquidBlock(java.util.function.Supplier<? extends FlowingFluid> p_54694_, BlockBehaviour.Properties p_54695_) {
	      super(p_54694_, p_54695_);
	      this.fluid = null;
	      this.stateCache = Lists.newArrayList();
	      this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
	      this.supplier = p_54694_;
	   }
       @Override
	   public VoxelShape getCollisionShape(BlockState p_54760_, BlockGetter p_54761_, BlockPos p_54762_, CollisionContext p_54763_) {
	      return p_54763_.isAbove(STABLE_SHAPE, p_54762_, true) && p_54760_.getValue(LEVEL) == 0 && p_54763_.canStandOnFluid(p_54761_.getFluidState(p_54762_.above()), getFluid()) ? STABLE_SHAPE : Shapes.empty();
	   }
       @Override
	   public boolean isRandomlyTicking(BlockState p_54732_) {
	      return p_54732_.getFluidState().isRandomlyTicking();
	   }
       @Override
	   public void randomTick(BlockState p_54740_, ServerLevel p_54741_, BlockPos p_54742_, Random p_54743_) {
	      p_54740_.getFluidState().randomTick(p_54741_, p_54742_, p_54743_);
	   }
       @Override
	   public boolean propagatesSkylightDown(BlockState p_54745_, BlockGetter p_54746_, BlockPos p_54747_) {
	      return false;
	   }
       @Override
	   public boolean isPathfindable(BlockState p_54704_, BlockGetter p_54705_, BlockPos p_54706_, PathComputationType p_54707_) {
	      return !getFluid().is(FluidTags.LAVA);
	   }
       @Override
	   public FluidState getFluidState(BlockState p_54765_) {
	      int i = p_54765_.getValue(LEVEL);
	      if (!fluidStateCacheInitialized) initFluidStateCache();
	      return this.stateCache.get(Math.min(i, 8));
	   }
       @Override
	   public boolean skipRendering(BlockState p_54716_, BlockState p_54717_, Direction p_54718_) {
	      return p_54717_.getFluidState().getType().isSame(getFluid());
	   }
       @Override
	   public RenderShape getRenderShape(BlockState p_54738_) {
	      return RenderShape.INVISIBLE;
	   }
       @Override
	   public List<ItemStack> getDrops(BlockState p_54720_, LootContext.Builder p_54721_) {
	      return Collections.emptyList();
	   }
       @Override
	   public VoxelShape getShape(BlockState p_54749_, BlockGetter p_54750_, BlockPos p_54751_, CollisionContext p_54752_) {
	      return Shapes.empty();
	   }
       @Override
	   public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) {
	      if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) {
	         p_54755_.getLiquidTicks().scheduleTick(p_54756_, p_54754_.getFluidState().getType(), getFluid().getTickDelay(p_54755_));
	      }

	   }
       @Override
	   public BlockState updateShape(BlockState p_54723_, Direction p_54724_, BlockState p_54725_, LevelAccessor p_54726_, BlockPos p_54727_, BlockPos p_54728_) {
	      if (p_54723_.getFluidState().isSource() || p_54725_.getFluidState().isSource()) {
	         p_54726_.getLiquidTicks().scheduleTick(p_54727_, p_54723_.getFluidState().getType(), getFluid().getTickDelay(p_54726_));
	      }

	      return null;
	   }
       @Override
	   public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) {
	      if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) {
	         p_54710_.getLiquidTicks().scheduleTick(p_54711_, p_54709_.getFluidState().getType(), getFluid().getTickDelay(p_54710_));
	      }

	   }
       
	   private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) {
	      if (getFluid().is(FluidTags.LAVA)) {
	         boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL);

	         for(Direction direction : POSSIBLE_FLOW_DIRECTIONS) {
	            BlockPos blockpos = p_54698_.relative(direction.getOpposite());
	            if (p_54697_.getFluidState(blockpos).is(FluidTags.WATER)) {
	               Block block = p_54697_.getFluidState(p_54698_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
	               p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.defaultBlockState()));
	               this.fizz(p_54697_, p_54698_);
	               return false;
	            }

	            if (flag && p_54697_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) {
	               p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, Blocks.BASALT.defaultBlockState()));
	               this.fizz(p_54697_, p_54698_);
	               return false;
	            }
	         }
	      }

	      return true;
	   }

	   private void fizz(LevelAccessor p_54701_, BlockPos p_54702_) {
	      p_54701_.levelEvent(1501, p_54702_, 0);
	   }
       @Override
	   protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_54730_) {
	      p_54730_.add(LEVEL);
	   }
       @Override
	   public ItemStack pickupBlock(LevelAccessor p_153772_, BlockPos p_153773_, BlockState p_153774_) {
	      if (p_153774_.getValue(LEVEL) == 0) {
	         p_153772_.setBlock(p_153773_, Blocks.AIR.defaultBlockState(), 11);
	         return new ItemStack(getFluid().getBucket());
	      } else {
	         return ItemStack.EMPTY;
	      }
	   }

	   // Forge start
	   private final java.util.function.Supplier<? extends net.minecraft.world.level.material.Fluid> supplier;
	   @Override
	   public FlowingFluid getFluid() {
	      return (FlowingFluid)supplier.get();
	   }

	   private boolean fluidStateCacheInitialized = false;
	   @Override
	   protected synchronized void initFluidStateCache() {
	      if (fluidStateCacheInitialized == false) {
	         this.stateCache.add(getFluid().getSource(false));

	         for (int i = 1; i < 8; ++i)
	            this.stateCache.add(getFluid().getFlowing(8 - i, false));

	         this.stateCache.add(getFluid().getFlowing(8, true));
	         fluidStateCacheInitialized = true;
	      }
	   }
	   @Override
	   public Optional<SoundEvent> getPickupSound() {
	      return getFluid().getPickupSound();
	   }
}

 

 

Link to comment
Share on other sites

8 minutes ago, furiusmax55 said:
  Reveal hidden contents
public class CustomLiquidBlock extends LiquidBlock{
	   public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL;
	   protected final FlowingFluid fluid;
	   private final List<FluidState> stateCache;
	   public static final VoxelShape STABLE_SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
	   public static final ImmutableList<Direction> POSSIBLE_FLOW_DIRECTIONS = ImmutableList.of(Direction.DOWN, Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST);

	   @Deprecated  // Forge: Use the constructor that takes a supplier
	   public CustomLiquidBlock(FlowingFluid p_54694_, BlockBehaviour.Properties p_54695_) {
	      super(p_54694_, p_54695_);
	      this.fluid = p_54694_;
	      this.stateCache = Lists.newArrayList();
	      this.stateCache.add(p_54694_.getSource(false));

	      for(int i = 1; i < 8; ++i) {
	         this.stateCache.add(p_54694_.getFlowing(8 - i, false));
	      }

	      this.stateCache.add(p_54694_.getFlowing(8, true));
	      this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
	      fluidStateCacheInitialized = true;
	      supplier = p_54694_.delegate;
	   }

	   /**
	    * @param supplier A fluid supplier such as {@link net.minecraftforge.fmllegacy.RegistryObject<Fluid>}
	    */
	   public CustomLiquidBlock(java.util.function.Supplier<? extends FlowingFluid> p_54694_, BlockBehaviour.Properties p_54695_) {
	      super(p_54694_, p_54695_);
	      this.fluid = null;
	      this.stateCache = Lists.newArrayList();
	      this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
	      this.supplier = p_54694_;
	   }
       @Override
	   public VoxelShape getCollisionShape(BlockState p_54760_, BlockGetter p_54761_, BlockPos p_54762_, CollisionContext p_54763_) {
	      return p_54763_.isAbove(STABLE_SHAPE, p_54762_, true) && p_54760_.getValue(LEVEL) == 0 && p_54763_.canStandOnFluid(p_54761_.getFluidState(p_54762_.above()), getFluid()) ? STABLE_SHAPE : Shapes.empty();
	   }
       @Override
	   public boolean isRandomlyTicking(BlockState p_54732_) {
	      return p_54732_.getFluidState().isRandomlyTicking();
	   }
       @Override
	   public void randomTick(BlockState p_54740_, ServerLevel p_54741_, BlockPos p_54742_, Random p_54743_) {
	      p_54740_.getFluidState().randomTick(p_54741_, p_54742_, p_54743_);
	   }
       @Override
	   public boolean propagatesSkylightDown(BlockState p_54745_, BlockGetter p_54746_, BlockPos p_54747_) {
	      return false;
	   }
       @Override
	   public boolean isPathfindable(BlockState p_54704_, BlockGetter p_54705_, BlockPos p_54706_, PathComputationType p_54707_) {
	      return !getFluid().is(FluidTags.LAVA);
	   }
       @Override
	   public FluidState getFluidState(BlockState p_54765_) {
	      int i = p_54765_.getValue(LEVEL);
	      if (!fluidStateCacheInitialized) initFluidStateCache();
	      return this.stateCache.get(Math.min(i, 8));
	   }
       @Override
	   public boolean skipRendering(BlockState p_54716_, BlockState p_54717_, Direction p_54718_) {
	      return p_54717_.getFluidState().getType().isSame(getFluid());
	   }
       @Override
	   public RenderShape getRenderShape(BlockState p_54738_) {
	      return RenderShape.INVISIBLE;
	   }
       @Override
	   public List<ItemStack> getDrops(BlockState p_54720_, LootContext.Builder p_54721_) {
	      return Collections.emptyList();
	   }
       @Override
	   public VoxelShape getShape(BlockState p_54749_, BlockGetter p_54750_, BlockPos p_54751_, CollisionContext p_54752_) {
	      return Shapes.empty();
	   }
       @Override
	   public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) {
	      if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) {
	         p_54755_.getLiquidTicks().scheduleTick(p_54756_, p_54754_.getFluidState().getType(), getFluid().getTickDelay(p_54755_));
	      }

	   }
       @Override
	   public BlockState updateShape(BlockState p_54723_, Direction p_54724_, BlockState p_54725_, LevelAccessor p_54726_, BlockPos p_54727_, BlockPos p_54728_) {
	      if (p_54723_.getFluidState().isSource() || p_54725_.getFluidState().isSource()) {
	         p_54726_.getLiquidTicks().scheduleTick(p_54727_, p_54723_.getFluidState().getType(), getFluid().getTickDelay(p_54726_));
	      }

	      return null;
	   }
       @Override
	   public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) {
	      if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) {
	         p_54710_.getLiquidTicks().scheduleTick(p_54711_, p_54709_.getFluidState().getType(), getFluid().getTickDelay(p_54710_));
	      }

	   }
       
	   private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) {
	      if (getFluid().is(FluidTags.LAVA)) {
	         boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL);

	         for(Direction direction : POSSIBLE_FLOW_DIRECTIONS) {
	            BlockPos blockpos = p_54698_.relative(direction.getOpposite());
	            if (p_54697_.getFluidState(blockpos).is(FluidTags.WATER)) {
	               Block block = p_54697_.getFluidState(p_54698_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
	               p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.defaultBlockState()));
	               this.fizz(p_54697_, p_54698_);
	               return false;
	            }

	            if (flag && p_54697_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) {
	               p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, Blocks.BASALT.defaultBlockState()));
	               this.fizz(p_54697_, p_54698_);
	               return false;
	            }
	         }
	      }

	      return true;
	   }

	   private void fizz(LevelAccessor p_54701_, BlockPos p_54702_) {
	      p_54701_.levelEvent(1501, p_54702_, 0);
	   }
       @Override
	   protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_54730_) {
	      p_54730_.add(LEVEL);
	   }
       @Override
	   public ItemStack pickupBlock(LevelAccessor p_153772_, BlockPos p_153773_, BlockState p_153774_) {
	      if (p_153774_.getValue(LEVEL) == 0) {
	         p_153772_.setBlock(p_153773_, Blocks.AIR.defaultBlockState(), 11);
	         return new ItemStack(getFluid().getBucket());
	      } else {
	         return ItemStack.EMPTY;
	      }
	   }

	   // Forge start
	   private final java.util.function.Supplier<? extends net.minecraft.world.level.material.Fluid> supplier;
	   @Override
	   public FlowingFluid getFluid() {
	      return (FlowingFluid)supplier.get();
	   }

	   private boolean fluidStateCacheInitialized = false;
	   @Override
	   protected synchronized void initFluidStateCache() {
	      if (fluidStateCacheInitialized == false) {
	         this.stateCache.add(getFluid().getSource(false));

	         for (int i = 1; i < 8; ++i)
	            this.stateCache.add(getFluid().getFlowing(8 - i, false));

	         this.stateCache.add(getFluid().getFlowing(8, true));
	         fluidStateCacheInitialized = true;
	      }
	   }
	   @Override
	   public Optional<SoundEvent> getPickupSound() {
	      return getFluid().getPickupSound();
	   }
}

 

 

And the vanilla LiquidBlock

 

[removed vanilla code - diesieben07]

Edited by diesieben07
Link to comment
Share on other sites

5 minutes ago, furiusmax55 said:

If I use that, an error arises when putting the liquid on the ground

log using vanilla class with the not deprecated constructor 

 

Spoiler
---- Minecraft Crash Report ----
// There are four lights!

Time: 15/9/21 12:53
Description: Unexpected error

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.material.FlowingFluid.getTickDelay(net.minecraft.world.level.LevelReader)" because "this.fluid" is null
	at net.minecraft.world.level.block.LiquidBlock.updateShape(LiquidBlock.java:117) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateShape(BlockBehaviour.java:669) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateNeighbourShapes(BlockBehaviour.java:610) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.Level.markAndNotifyBlock(Level.java:246) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:213) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:177) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.item.BucketItem.emptyContents(BucketItem.java:146) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.world.item.BucketItem.use(BucketItem.java:90) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.world.item.ItemStack.use(ItemStack.java:243) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,xf:fml:forge:itemstack}
	at net.minecraft.client.multiplayer.MultiPlayerGameMode.useItem(MultiPlayerGameMode.java:337) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.startUseItem(Minecraft.java:1576) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.handleKeybinds(Minecraft.java:1829) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.tick(Minecraft.java:1647) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1015) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.53.jar%233!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at net.minecraft.world.level.block.LiquidBlock.updateShape(LiquidBlock.java:117) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateShape(BlockBehaviour.java:669) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateNeighbourShapes(BlockBehaviour.java:610) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.Level.markAndNotifyBlock(Level.java:246) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:213) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:177) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.item.BucketItem.emptyContents(BucketItem.java:146) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.world.item.BucketItem.use(BucketItem.java:90) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,xf:fml:forge:bucketitem}
	at net.minecraft.world.item.ItemStack.use(ItemStack.java:243) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,xf:fml:forge:itemstack}
	at net.minecraft.client.multiplayer.MultiPlayerGameMode.useItem(MultiPlayerGameMode.java:337) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.startUseItem(Minecraft.java:1576) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.handleKeybinds(Minecraft.java:1829) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
-- Affected level --
Details:
	All players: 1 total; [LocalPlayer['Dev'/43, l='ClientLevel', x=-35.50, y=4.00, z=132.50]]
	Chunk stats: 841, 529
	Level dimension: minecraft:overworld
	Level spawn location: World: (-32,4,128), Section: (at 0,4,0 in -2,0,8; chunk contains blocks -32,0,128 to -17,255,143), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
	Level time: 222 game time, 222 day time
	Server brand: forge
	Server type: Integrated singleplayer server
Stacktrace:
	at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:364) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2245) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:682) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.53.jar%233!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


-- Last reload --
Details:
	Reload number: 1
	Reload reason: initial
	Finished: Yes
	Packs: Default, Mod Resources

-- System Details --
Details:
	Minecraft Version: 1.17.1
	Minecraft Version ID: 1.17.1
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 16.0.1, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
	Memory: 396807240 bytes (378 MiB) / 1749024768 bytes (1668 MiB) up to 4276092928 bytes (4078 MiB)
	CPUs: 16
	Processor Vendor: AuthenticAMD
	Processor Name: AMD Ryzen 7 2700X Eight-Core Processor         
	Identifier: AuthenticAMD Family 23 Model 8 Stepping 2
	Microarchitecture: Zen+
	Frequency (GHz): 3,69
	Number of physical packages: 1
	Number of physical CPUs: 8
	Number of logical CPUs: 16
	Graphics card #0 name: NVIDIA GeForce GTX 1050 Ti
	Graphics card #0 vendor: NVIDIA (0x10de)
	Graphics card #0 VRAM (MB): 4095,00
	Graphics card #0 deviceId: 0x1c82
	Graphics card #0 versionInfo: DriverVersion=27.21.14.5671
	Memory slot #0 capacity (MB): 8192,00
	Memory slot #0 clockSpeed (GHz): 2,67
	Memory slot #0 type: DDR4
	Memory slot #1 capacity (MB): 8192,00
	Memory slot #1 clockSpeed (GHz): 2,67
	Memory slot #1 type: DDR4
	Virtual memory max (MB): 20912,76
	Virtual memory used (MB): 12202,20
	Swap memory total (MB): 4608,00
	Swap memory used (MB): 5,98
	JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -XX:+ShowCodeDetailsInExceptionMessages
	Launched Version: MOD_DEV
	Backend library: LWJGL version 3.2.2 SNAPSHOT
	Backend API: GeForce GTX 1050 Ti/PCIe/SSE2 GL version 3.2.0 NVIDIA 456.71, NVIDIA Corporation
	Window size: 854x480
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: 
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'forge'
	Type: Integrated Server (map_client.txt)
	Graphics mode: fast
	Resource Packs: 
	Current Language: English (US)
	CPU: 16x AMD Ryzen 7 2700X Eight-Core Processor 
	Player Count: 1 / 8; [ServerPlayer['Dev'/43, l='ServerLevel[New World]', x=-35.50, y=4.00, z=132.50]]
	Data Packs: vanilla, mod:arkanemagicka (incompatible), mod:forge
	ModLauncher: 9.0.7+91+master.8569cdf
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		 eventbus PLUGINSERVICE 
		 object_holder_definalize PLUGINSERVICE 
		 runtime_enum_extender PLUGINSERVICE 
		 capability_inject_definalize PLUGINSERVICE 
		 accesstransformer PLUGINSERVICE 
		 runtimedistcleaner PLUGINSERVICE 
		 fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		minecraft@1.0
		javafml@null
	Mod List: 
		forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp|Minecraft                     |minecraft                     |1.17.1              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		main                                              |Arkane Magicka                |arkanemagicka                 |0.0NONE             |DONE      |Manifest: NOSIGNATURE
		                                                  |Forge                         |forge                         |37.0.53             |DONE      |Manifest: NOSIGNATURE
	Crash Report UUID: a7bb91a3-332c-41d5-b6ce-429328998f4d
	FML: 37.0
	Forge: net.minecraftforge:37.0.53

 

 

Link to comment
Share on other sites

8 minutes ago, furiusmax55 said:

I'm going to try it

same error as at the beginning
 

Spoiler
---- Minecraft Crash Report ----
// You're mean.

Time: 15/9/21 13:07
Description: Exception while ticking

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.block.state.BlockState.isAir()" because "p_49910_" is null
	at net.minecraft.world.level.block.Block.updateOrDestroy(Block.java:158) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateNeighbourShapes(BlockBehaviour.java:611) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.Level.markAndNotifyBlock(Level.java:246) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:213) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:177) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.material.FlowingFluid.spreadTo(FlowingFluid.java:244) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spreadToSides(FlowingFluid.java:146) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spread(FlowingFluid.java:125) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.tick(FlowingFluid.java:410) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FluidState.tick(FluidState.java:73) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tickLiquid(ServerLevel.java:602) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.ServerTickList.tick(ServerTickList.java:78) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:341) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:882) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:818) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:85) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:683) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:258) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:831) [?:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
	at net.minecraft.world.level.block.Block.updateOrDestroy(Block.java:158) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.updateNeighbourShapes(BlockBehaviour.java:611) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.Level.markAndNotifyBlock(Level.java:246) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:213) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.Level.setBlock(Level.java:177) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.world.level.material.FlowingFluid.spreadTo(FlowingFluid.java:244) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spreadToSides(FlowingFluid.java:146) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.spread(FlowingFluid.java:125) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FlowingFluid.tick(FlowingFluid.java:410) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.world.level.material.FluidState.tick(FluidState.java:73) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tickLiquid(ServerLevel.java:602) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
-- Block being ticked --
Details:
	Block location: World: (1,4,83), Section: (at 1,4,3 in 0,0,5; chunk contains blocks 0,0,80 to 15,255,95), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Stacktrace:
	at net.minecraft.world.level.ServerTickList.tick(ServerTickList.java:78) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:341) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}


-- Affected level --
Details:
	All players: 1 total; [ServerPlayer['Dev'/1, l='ServerLevel[New World]', x=1.50, y=4.00, z=81.50]]
	Chunk stats: 2209
	Level dimension: minecraft:overworld
	Level spawn location: World: (0,4,80), Section: (at 0,4,0 in 0,0,5; chunk contains blocks 0,0,80 to 15,255,95), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Level time: 222 game time, 222 day time
	Level name: New World
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
	Level weather: Rain time: 55367 (now: false), thunder time: 96462 (now: false)
	Known server brands: forge
	Level was modded: true
	Level storage version: 0x04ABD - Anvil
Stacktrace:
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:882) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:818) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:85) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:683) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:258) ~[forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:831) [?:?] {}


-- System Details --
Details:
	Minecraft Version: 1.17.1
	Minecraft Version ID: 1.17.1
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 16.0.1, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
	Memory: 1601519504 bytes (1527 MiB) / 2080374784 bytes (1984 MiB) up to 4276092928 bytes (4078 MiB)
	CPUs: 16
	Processor Vendor: AuthenticAMD
	Processor Name: AMD Ryzen 7 2700X Eight-Core Processor         
	Identifier: AuthenticAMD Family 23 Model 8 Stepping 2
	Microarchitecture: Zen+
	Frequency (GHz): 3,69
	Number of physical packages: 1
	Number of physical CPUs: 8
	Number of logical CPUs: 16
	Graphics card #0 name: NVIDIA GeForce GTX 1050 Ti
	Graphics card #0 vendor: NVIDIA (0x10de)
	Graphics card #0 VRAM (MB): 4095,00
	Graphics card #0 deviceId: 0x1c82
	Graphics card #0 versionInfo: DriverVersion=27.21.14.5671
	Memory slot #0 capacity (MB): 8192,00
	Memory slot #0 clockSpeed (GHz): 2,67
	Memory slot #0 type: DDR4
	Memory slot #1 capacity (MB): 8192,00
	Memory slot #1 clockSpeed (GHz): 2,67
	Memory slot #1 type: DDR4
	Virtual memory max (MB): 20912,76
	Virtual memory used (MB): 12844,72
	Swap memory total (MB): 4608,00
	Swap memory used (MB): 31,44
	JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -XX:+ShowCodeDetailsInExceptionMessages
	Player Count: 1 / 8; [ServerPlayer['Dev'/1, l='ServerLevel[New World]', x=1.50, y=4.00, z=81.50]]
	Data Packs: vanilla, mod:arkanemagicka (incompatible), mod:forge
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'forge'
	ModLauncher: 9.0.7+91+master.8569cdf
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		 eventbus PLUGINSERVICE 
		 object_holder_definalize PLUGINSERVICE 
		 runtime_enum_extender PLUGINSERVICE 
		 capability_inject_definalize PLUGINSERVICE 
		 accesstransformer PLUGINSERVICE 
		 runtimedistcleaner PLUGINSERVICE 
		 fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		minecraft@1.0
		javafml@null
	Mod List: 
		forge-1.17.1-37.0.53_mapped_official_1.17.1-recomp|Minecraft                     |minecraft                     |1.17.1              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		main                                              |Arkane Magicka                |arkanemagicka                 |0.0NONE             |DONE      |Manifest: NOSIGNATURE
		                                                  |Forge                         |forge                         |37.0.53             |DONE      |Manifest: NOSIGNATURE
	Crash Report UUID: a564e65f-0b2e-4eba-b355-c1ac7008e8b5
	FML: 37.0
	Forge: net.minecraftforge:37.0.53

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • This sounds very much like a cheat. Inventories are not known client side unless the client is looking at them.
    • I am working in 1.17.1 and i am trying to read the contents of a chest from a client side mod. I have attempted to read the chest using  ((RandomizableContainerBlockEntity)Minecraft.getInstance().level.getBlockEntity(new BlockPos(1,1,1))).getItem(0); this returns null since it is reading from the client side. is there any way to get the inventory within a block without needing any server side code I was thinking of trying to catch the ClientboundContainerSetContentPacket but I have seen that is said not to be the best idea.   the overall project is to try to get the inventories within an area and then by sending packets to the server move the player in order to reequip with items from said chests.   here is my code so far I haven't implemented movement of the player yet i am just trying to move items between inventories.   ForgeEventHandeler.java @Mod.EventBusSubscriber public class ForgeEventHandler { private static ArrayList<BlockPos> homeBase = new ArrayList<BlockPos>(); private static Boolean pressed = false; public static final KeyMapping keyBinding = new KeyMapping("pam SETUP", 79, "PAM"); @SubscribeEvent public static void updatePlayer(TickEvent.PlayerTickEvent event) { if(event.player.canEat(false)){ for(ItemStack inventoryStack : event.player.getInventory().items){ if (inventoryStack.isEdible()) { ForgeEventFactory.onItemUseStart(event.player, inventoryStack, 0); ItemStack result = inventoryStack.getItem().finishUsingItem(inventoryStack, event.player.getCommandSenderWorld(), event.player); ForgeEventFactory.onItemUseFinish(event.player, inventoryStack, 0, result); if (!event.player.canEat(false)) { break; } } } } if (keyBinding.isDown() && !pressed) { pressed = true; openBlock(); if(homeBase.size()==2) { homeBase.clear(); } HitResult block = Minecraft.getInstance().player.pick(20.0D, 0.0F, false); if(block.getType() == BlockHitResult.Type.BLOCK){ BlockPos blockpos = ((BlockHitResult)block).getBlockPos(); homeBase.add(blockpos); Minecraft.getInstance().getConnection().send(new ServerboundChatPacket("position set")); } if(homeBase.size()==2) { int[] start ={(int)homeBase.get(0).get(Direction.Axis.X),(int)homeBase.get(0).get(Direction.Axis.Y),(int)homeBase.get(0).get(Direction.Axis.Z)}; int[] end ={ (int) homeBase.get(1).get(Direction.Axis.X),(int)homeBase.get(1).get(Direction.Axis.Y),(int)homeBase.get(1).get(Direction.Axis.Z)}; int[] diff = {end[0]-start[0],end[1]-start[1],end[2]-start[2]}; for (int i=start[0]; i!=(end[0]+Integer.signum(diff[0])); i+=Integer.signum(diff[0])){ for (int j=start[1]; j!=(end[1]+Integer.signum(diff[1])); j+=Integer.signum(diff[1])){ for (int k=start[2]; k!=(end[2]+Integer.signum(diff[2])); k+=Integer.signum(diff[2])){ System.out.println(i+","+j+","+k); BlockPos posTemp = new BlockPos(i,j,k); BlockEntity blockEntity = Minecraft.getInstance().level.getBlockEntity(posTemp); if (blockEntity != null && blockEntity instanceof RandomizableContainerBlockEntity) { /*add chest to a category of chests that best describes what is in it E.G tools, weapons, food*/ } } } } } } if (!keyBinding.isDown()) { pressed=false; } } @SubscribeEvent public static void setup(FMLClientSetupEvent event) { ClientRegistry.registerKeyBinding(keyBinding); } @SuppressWarnings("resource") private static void openBlock(){ BlockHitResult hit = (BlockHitResult) Minecraft.getInstance().player.pick(20.0D, 0.0F, false); Minecraft.getInstance().getConnection().send(new ServerboundUseItemOnPacket(InteractionHand.MAIN_HAND,hit)); } }   exampemod.java // The value here should match an entry in the META-INF/mods.toml file @Mod("examplemod") public class ExampleMod { // Directly reference a log4j logger. public ExampleMod() { } }  
    • Look at where the field is used. There is a function that lets you set it.
    • So I'm trying to make an addon for Mr. Crayfish's Gun mod, what I'm trying to achieve right now is to add a new gun, but I got this error while adding the max stack size property to the item and I don't know how to get around it: 'maxStackSize' has private access in 'net.minecraft.item.Item.Properties' The line of code is this one: public static final Item.Properties genericProperties = new Item.Properties().maxStackSize(1).group(MoGuns.GROUP); And the whole code is this: package ttv.alanormiga.moguns.core.registry; import ttv.alanormiga.moguns.core.MoGuns; import com.mrcrayfish.guns.item.GunItem; import net.minecraft.item.Item; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class ItemRegistry { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MoGuns.ID); public static final Item.Properties genericProperties = new Item.Properties().maxStackSize(1).group(MoGuns.GROUP); public static final RegistryObject<Item> SCAR = ITEMS.register("scar", () -> new GunItem(genericProperties)); } Also here is my github repo: https://github.com/AlanorMiga/MoGuns   Any help is greatly appreciated! Thanks in advance!
    • Reimport the gradle project into your IDE then regenerate run configs.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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