mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2026-01-06 15:51:50 +00:00
Balloon work
This commit is contained in:
@@ -14,8 +14,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
||||
import org.spongepowered.configurate.serialize.SerializationException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CosmeticBackpackType extends Cosmetic {
|
||||
|
||||
private ItemStack backpackItem;
|
||||
@@ -29,7 +27,6 @@ public class CosmeticBackpackType extends Cosmetic {
|
||||
@Override
|
||||
public void update(CosmeticUser user) {
|
||||
Player player = Bukkit.getPlayer(user.getUniqueId());
|
||||
List<Player> sendTo = PlayerUtils.getNearbyPlayers(player.getLocation());
|
||||
Location loc = player.getLocation().clone();
|
||||
|
||||
user.getBackpackEntity().getBukkitLivingEntity().setRotation(loc.getYaw(), loc.getPitch());
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.hibiscusmc.hmccosmetics.cosmetic.types;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.util.PlayerUtils;
|
||||
import com.ticxo.modelengine.api.ModelEngineAPI;
|
||||
import com.ticxo.modelengine.api.generator.model.ModelBlueprint;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -17,19 +18,31 @@ public class CosmeticBalloonType extends Cosmetic {
|
||||
private ModelBlueprint model;
|
||||
public CosmeticBalloonType(String id, ConfigurationNode config) {
|
||||
super(id, config);
|
||||
|
||||
String modelId = config.node("model").getString();
|
||||
|
||||
HMCCosmeticsPlugin.getInstance().getLogger().info("Attempting Spawning");
|
||||
if (ModelEngineAPI.api.getModelRegistry().getBlueprint(modelId) == null) {
|
||||
HMCCosmeticsPlugin.getInstance().getLogger().warning("Invalid Model Engine Blueprint " + id);
|
||||
HMCCosmeticsPlugin.getInstance().getLogger().warning("Possible Blueprints" + ModelEngineAPI.api.getModelRegistry().getAllBlueprintId());
|
||||
return;
|
||||
}
|
||||
this.model = ModelEngineAPI.api.getModelRegistry().getBlueprint(modelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(CosmeticUser user) {
|
||||
Player player = Bukkit.getPlayer(user.getUniqueId());
|
||||
List<Player> sendTo = PlayerUtils.getNearbyPlayers(player.getLocation());
|
||||
Location loc = player.getLocation().clone();
|
||||
|
||||
// TODO: Offsets
|
||||
loc.add(Settings.getBalloonOffset());
|
||||
user.getBalloonEntity().setLocation(loc);
|
||||
|
||||
//user.getBackpackEntity().getBukkitLivingEntity().setRotation(loc.getYaw(), loc.getPitch());
|
||||
|
||||
}
|
||||
|
||||
public ModelBlueprint getModel() {
|
||||
return this.model;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user