fixed jei being unable to get the spring's color

Closes #226
This commit is contained in:
Ell 2021-12-23 13:13:34 +01:00
parent 5bf5b14fa8
commit 75948872b7

View file

@ -47,6 +47,8 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
@Override @Override
public int getColor(ItemStack stack, int i) { public int getColor(ItemStack stack, int i) {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
if (player == null)
return 0;
return BiomeColors.getAverageWaterColor(player.level, player.blockPosition()); return BiomeColors.getAverageWaterColor(player.level, player.blockPosition());
} }
}; };
@ -57,7 +59,6 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
} }
@Override @Override
public Supplier<RenderType> getRenderType() { public Supplier<RenderType> getRenderType() {
return RenderType::translucent; return RenderType::translucent;
@ -68,7 +69,8 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
var tile = levelIn.getBlockEntity(pos); var tile = levelIn.getBlockEntity(pos);
if (tile instanceof BlockEntitySpring) if (tile instanceof BlockEntitySpring)
((BlockEntitySpring) tile).consumeAura(2500); ((BlockEntitySpring) tile).consumeAura(2500);
return new ItemStack(Items.WATER_BUCKET); } return new ItemStack(Items.WATER_BUCKET);
}
@Override @Override
public Optional<SoundEvent> getPickupSound() { public Optional<SoundEvent> getPickupSound() {