mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-30 20:39:10 +00:00
fixed requests of jhqwqmc
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
package net.momirealms.craftengine.core.entity.furniture;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||
import net.momirealms.craftengine.core.registry.BuiltInRegistries;
|
||||
import net.momirealms.craftengine.core.registry.Holder;
|
||||
@@ -11,6 +8,9 @@ import net.momirealms.craftengine.core.registry.WritableRegistry;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import net.momirealms.craftengine.core.util.ResourceKey;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class HitBoxTypes {
|
||||
public static final Key INTERACTION = Key.of("minecraft:interaction");
|
||||
public static final Key SHULKER = Key.of("minecraft:shulker");
|
||||
@@ -31,4 +31,4 @@ public class HitBoxTypes {
|
||||
}
|
||||
return factory.create(arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,14 +26,14 @@ public class RemoveFurnitureFunction<CTX extends Context> extends AbstractCondit
|
||||
public void runInternal(CTX ctx) {
|
||||
Optional<WorldPosition> optionalWorldPosition = ctx.getOptionalParameter(DirectContextParameters.POSITION);
|
||||
if (optionalWorldPosition.isPresent()) {
|
||||
// Buscar muebles en el contexto
|
||||
// Search for furniture in the context
|
||||
Optional<Furniture> optionalFurniture = ctx.getOptionalParameter(DirectContextParameters.FURNITURE);
|
||||
if (optionalFurniture.isPresent()) {
|
||||
Furniture furniture = optionalFurniture.get();
|
||||
if (furniture.isValid()) {
|
||||
furniture.destroy();
|
||||
// TODO: Implementar lógica para dropear loot y reproducir sonidos
|
||||
// usando this.dropLoot y this.playSound cuando sea necesario
|
||||
// TODO: Implement logic to drop loot and play sounds
|
||||
// using this.dropLoot and this.playSound when necessary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ReplaceFurnitureFunction<CTX extends Context> extends AbstractCondi
|
||||
if (optionalWorldPosition.isPresent() && optionalOldFurniture.isPresent()) {
|
||||
Furniture oldFurniture = optionalOldFurniture.get();
|
||||
|
||||
// Obtener la nueva posición o usar la actual del mueble
|
||||
// Get the new position or use the current furniture position
|
||||
double xPos = this.x.getDouble(ctx);
|
||||
double yPos = this.y.getDouble(ctx);
|
||||
double zPos = this.z.getDouble(ctx);
|
||||
@@ -61,19 +61,18 @@ public class ReplaceFurnitureFunction<CTX extends Context> extends AbstractCondi
|
||||
|
||||
WorldPosition newPosition = new WorldPosition(optionalWorldPosition.get().world(), xPos, yPos, zPos, pitchValue, yawValue);
|
||||
|
||||
// Obtener el nuevo mueble
|
||||
// Get the new furniture
|
||||
Optional<CustomFurniture> optionalNewFurniture = CraftEngine.instance().furnitureManager().furnitureById(this.newFurnitureId);
|
||||
if (optionalNewFurniture.isPresent()) {
|
||||
CustomFurniture newFurniture = optionalNewFurniture.get();
|
||||
AnchorType anchor = this.anchorType != null ? this.anchorType : newFurniture.getAnyAnchorType();
|
||||
|
||||
// Remover el mueble antiguo
|
||||
// Remove the old furniture
|
||||
if (oldFurniture.isValid()) {
|
||||
oldFurniture.destroy();
|
||||
// TODO: Implementar lógica para dropear loot usando this.dropLoot
|
||||
}
|
||||
|
||||
// Colocar el nuevo mueble
|
||||
// Place the new furniture
|
||||
FurnitureExtraData extraData = FurnitureExtraData.builder().anchorType(anchor).build();
|
||||
CraftEngine.instance().furnitureManager().place(newPosition, newFurniture, extraData, this.playSound);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public class FurnitureParameterProvider implements ChainParameterProvider<Furnit
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.X, furniture -> furniture.position().x());
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.Y, furniture -> furniture.position().y());
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.Z, furniture -> furniture.position().z());
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.PITCH, furniture -> furniture.pitch());
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.YAW, furniture -> furniture.yaw());
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.PITCH, furniture -> furniture.position().xRot());
|
||||
CONTEXT_FUNCTIONS.put(DirectContextParameters.YAW, furniture -> furniture.position().yRot());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
Reference in New Issue
Block a user