mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-01 01:30:00 -04:00
* 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 032c981de8
)
This commit is contained in:
parent
55043e695a
commit
1e43a8d519
2 changed files with 32 additions and 0 deletions
fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric
api/object/builder/v1/block
mixin/object/builder
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue