From 1e43a8d51953f61e91dac3f643c66cb55f39aa7f Mon Sep 17 00:00:00 2001
From: Luligabi1 <33578169+Luligabi1@users.noreply.github.com>
Date: Fri, 20 May 2022 14:17:36 -0300
Subject: [PATCH] Fix #1947, #1873: FabricBlockSettings#copy does not copy all
 settings, the sequel (#2119)

* Fix FabricMC#1947, FabricMC#1873

* Ordered import to follow checkstyle

* Removed broken 1.18 code on 1.18.2 branch

* Added note specyfing that FabricBlockSettings copies settings Block.Settings doesn't.

(cherry picked from commit 032c981de840126634f69c6799d32b08c502e98f)
---
 .../builder/v1/block/FabricBlockSettings.java | 10 +++++++++
 .../AbstractBlockSettingsAccessor.java        | 22 +++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java
index b8765a326..c2e9793c1 100644
--- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java
+++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java
@@ -35,6 +35,9 @@ import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor;
  * Fabric's version of Block.Settings. Adds additional methods and hooks
  * not found in the original class.
  *
+ * <p>Make note that this behaves slightly different from the
+ * vanilla counterpart, copying some settings that vanilla does not.
+ *
  * <p>To use it, simply replace Block.Settings.of() with
  * FabricBlockSettings.of().
  */
@@ -60,10 +63,17 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
 		this.sounds(otherAccessor.getSoundGroup());
 		this.slipperiness(otherAccessor.getSlipperiness());
 		this.velocityMultiplier(otherAccessor.getVelocityMultiplier());
+		this.jumpVelocityMultiplier(otherAccessor.getJumpVelocityMultiplier());
 		thisAccessor.setDynamicBounds(otherAccessor.getDynamicBounds());
 		thisAccessor.setOpaque(otherAccessor.getOpaque());
 		thisAccessor.setIsAir(otherAccessor.getIsAir());
 		thisAccessor.setToolRequired(otherAccessor.isToolRequired());
+		this.allowsSpawning(otherAccessor.getAllowsSpawningPredicate());
+		this.solidBlock(otherAccessor.getSolidBlockPredicate());
+		this.suffocates(otherAccessor.getSuffocationPredicate());
+		this.blockVision(otherAccessor.getBlockVisionPredicate());
+		this.postProcess(otherAccessor.getPostProcessPredicate());
+		this.emissiveLighting(otherAccessor.getEmissiveLightingPredicate());
 	}
 
 	public static FabricBlockSettings of(Material material) {
diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java
index 5aeeb04d7..e05686bf8 100644
--- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java
+++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java
@@ -28,6 +28,7 @@ import net.minecraft.block.Block;
 import net.minecraft.block.BlockState;
 import net.minecraft.block.MapColor;
 import net.minecraft.block.Material;
+import net.minecraft.entity.EntityType;
 import net.minecraft.sound.BlockSoundGroup;
 import net.minecraft.util.Identifier;
 
@@ -64,6 +65,9 @@ public interface AbstractBlockSettingsAccessor {
 	@Accessor
 	float getVelocityMultiplier();
 
+	@Accessor
+	float getJumpVelocityMultiplier();
+
 	@Accessor
 	boolean getDynamicBounds();
 
@@ -76,6 +80,24 @@ public interface AbstractBlockSettingsAccessor {
 	@Accessor
 	boolean isToolRequired();
 
+	@Accessor
+	AbstractBlock.TypedContextPredicate<EntityType<?>> getAllowsSpawningPredicate();
+
+	@Accessor
+	AbstractBlock.ContextPredicate getSolidBlockPredicate();
+
+	@Accessor
+	AbstractBlock.ContextPredicate getSuffocationPredicate();
+
+	@Accessor
+	AbstractBlock.ContextPredicate getBlockVisionPredicate();
+
+	@Accessor
+	AbstractBlock.ContextPredicate getPostProcessPredicate();
+
+	@Accessor
+	AbstractBlock.ContextPredicate getEmissiveLightingPredicate();
+
 	/* SETTERS */
 	@Accessor
 	void setMaterial(Material material);