mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
fix gadget infinity create
This commit is contained in:
@@ -351,6 +351,16 @@ public class SceneScriptManager {
|
||||
}
|
||||
|
||||
public EntityGadget createGadget(int groupId, int blockId, SceneGadget g) {
|
||||
if(g.isOneoff){
|
||||
var hasEntity = getScene().getEntities().values().stream()
|
||||
.filter(e -> e instanceof EntityGadget)
|
||||
.filter(e -> e.getGroupId() == g.group.id)
|
||||
.filter(e -> e.getConfigId() == g.config_id)
|
||||
.findFirst();
|
||||
if(hasEntity.isPresent()){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
EntityGadget entity = new EntityGadget(getScene(), g.gadget_id, g.pos);
|
||||
|
||||
if (entity.getGadgetData() == null){
|
||||
|
||||
Reference in New Issue
Block a user