mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 23:53:41 +01:00
Movement behaviour registration changes
- buffering SeatMovementBehaviour - changed visibility of AllMovementBehaviours.addMovementBehaviour(ResourceLocation, MovementBehaviour) to public for easier mod compat - added console warn message when something tries to register more than one movement behaviour per block
This commit is contained in:
parent
2675d6ae2f
commit
348409a0a4
2 changed files with 5 additions and 2 deletions
|
@ -669,9 +669,10 @@ public class AllBlocks {
|
||||||
static {
|
static {
|
||||||
for (DyeColor colour : DyeColor.values()) {
|
for (DyeColor colour : DyeColor.values()) {
|
||||||
String colourName = colour.getName();
|
String colourName = colour.getName();
|
||||||
|
SeatMovementBehaviour movementBehaviour = new SeatMovementBehaviour();
|
||||||
REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED))
|
REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED))
|
||||||
.initialProperties(SharedProperties::wooden)
|
.initialProperties(SharedProperties::wooden)
|
||||||
.onRegister(AllMovementBehaviours.addMovementBehaviour(new SeatMovementBehaviour()))
|
.onRegister(AllMovementBehaviours.addMovementBehaviour(movementBehaviour))
|
||||||
.blockstate((c, p) -> {
|
.blockstate((c, p) -> {
|
||||||
p.simpleBlock(c.get(), p.models()
|
p.simpleBlock(c.get(), p.models()
|
||||||
.withExistingParent(colourName + "_seat", p.modLoc("block/seat"))
|
.withExistingParent(colourName + "_seat", p.modLoc("block/seat"))
|
||||||
|
|
|
@ -16,7 +16,9 @@ import net.minecraft.util.ResourceLocation;
|
||||||
public class AllMovementBehaviours {
|
public class AllMovementBehaviours {
|
||||||
private static final HashMap<ResourceLocation, MovementBehaviour> movementBehaviours = new HashMap<>();
|
private static final HashMap<ResourceLocation, MovementBehaviour> movementBehaviours = new HashMap<>();
|
||||||
|
|
||||||
private static void addMovementBehaviour(ResourceLocation resourceLocation, MovementBehaviour movementBehaviour) {
|
public static void addMovementBehaviour(ResourceLocation resourceLocation, MovementBehaviour movementBehaviour) {
|
||||||
|
if (movementBehaviours.containsKey(resourceLocation))
|
||||||
|
Create.logger.warn("Movement behaviour for " + resourceLocation.toString() + " was overridden");
|
||||||
movementBehaviours.put(resourceLocation, movementBehaviour);
|
movementBehaviours.put(resourceLocation, movementBehaviour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue