mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-03 22:26:16 +00:00
添加摩擦力,跳跃、移动系数
This commit is contained in:
@@ -38,6 +38,9 @@ public class BlockSettings {
|
||||
LazyReference<Set<Key>> correctTools = LazyReference.lazyReference(Set::of);
|
||||
String name;
|
||||
String supportShapeBlockState;
|
||||
float friction = 0.6f;
|
||||
float speedFactor = 1f;
|
||||
float jumpFactor = 1f;
|
||||
|
||||
private BlockSettings() {}
|
||||
|
||||
@@ -101,6 +104,9 @@ public class BlockSettings {
|
||||
newSettings.supportShapeBlockState = settings.supportShapeBlockState;
|
||||
newSettings.propagatesSkylightDown = settings.propagatesSkylightDown;
|
||||
newSettings.useShapeForLightOcclusion = settings.useShapeForLightOcclusion;
|
||||
newSettings.speedFactor = settings.speedFactor;
|
||||
newSettings.jumpFactor = settings.jumpFactor;
|
||||
newSettings.friction = settings.friction;
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
@@ -140,6 +146,18 @@ public class BlockSettings {
|
||||
return hardness;
|
||||
}
|
||||
|
||||
public float friction() {
|
||||
return friction;
|
||||
}
|
||||
|
||||
public float jumpFactor() {
|
||||
return jumpFactor;
|
||||
}
|
||||
|
||||
public float speedFactor() {
|
||||
return speedFactor;
|
||||
}
|
||||
|
||||
public Tristate canOcclude() {
|
||||
return canOcclude;
|
||||
}
|
||||
@@ -236,6 +254,21 @@ public class BlockSettings {
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockSettings friction(float friction) {
|
||||
this.friction = friction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockSettings speedFactor(float speedFactor) {
|
||||
this.speedFactor = speedFactor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockSettings jumpFactor(float jumpFactor) {
|
||||
this.jumpFactor = jumpFactor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BlockSettings tags(Set<Key> tags) {
|
||||
this.tags = tags;
|
||||
return this;
|
||||
@@ -384,6 +417,18 @@ public class BlockSettings {
|
||||
float floatValue = ResourceConfigUtils.getAsFloat(value, "hardness");
|
||||
return settings -> settings.hardness(floatValue);
|
||||
}));
|
||||
registerFactory("friction", (value -> {
|
||||
float floatValue = ResourceConfigUtils.getAsFloat(value, "friction");
|
||||
return settings -> settings.friction(floatValue);
|
||||
}));
|
||||
registerFactory("speed-factor", (value -> {
|
||||
float floatValue = ResourceConfigUtils.getAsFloat(value, "speed-factor");
|
||||
return settings -> settings.speedFactor(floatValue);
|
||||
}));
|
||||
registerFactory("jump-factor", (value -> {
|
||||
float floatValue = ResourceConfigUtils.getAsFloat(value, "jump-factor");
|
||||
return settings -> settings.jumpFactor(floatValue);
|
||||
}));
|
||||
registerFactory("resistance", (value -> {
|
||||
float floatValue = ResourceConfigUtils.getAsFloat(value, "resistance");
|
||||
return settings -> settings.resistance(floatValue);
|
||||
|
||||
Reference in New Issue
Block a user