From 5ce8d4a492b6e00964e7278584b3d396c8dd1413 Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 12 Sep 2018 22:37:06 +0200 Subject: [PATCH] Fixed networking, npe when ticking players, fixed various abilities, fixed values not being syncronised between the client and server, re-added the various apples --- .../com/minelittlepony/unicopia/Race.java | 25 ++-- .../com/minelittlepony/unicopia/UClient.java | 2 +- .../com/minelittlepony/unicopia/UItems.java | 10 +- .../com/minelittlepony/unicopia/Unicopia.java | 52 +++++---- .../unicopia/client/particle/Particles.java | 3 +- .../unicopia/command/CommandSpecies.java | 8 +- .../unicopia/network/MsgPlayerAbility.java | 16 ++- .../network/MsgPlayerCapabilities.java | 55 ++++++++- .../network/MsgRequestCapabilities.java | 30 +++++ .../unicopia/player/DefaultPlayerSpecies.java | 7 +- .../unicopia/player/IPlayer.java | 8 +- .../player/PlayerAbilityDelegate.java | 2 +- .../unicopia/player/PlayerCapabilities.java | 107 ++++++++++++++---- .../player/PlayerGravityDelegate.java | 89 +++++++++++++-- .../unicopia/player/PlayerSpeciesList.java | 27 +---- .../minelittlepony/unicopia/power/IPower.java | 26 ++--- .../unicopia/power/PowerFeed.java | 2 + .../unicopia/power/PowerGrow.java | 18 ++- .../unicopia/power/PowerMagic.java | 6 +- .../unicopia/power/PowerStomp.java | 13 ++- .../unicopia/power/PowerTeleport.java | 11 +- .../unicopia/spell/ICaster.java | 2 +- .../unicopia/spell/SpellRegistry.java | 3 - .../unicopia/spell/SpellShield.java | 25 ++-- ...faultPlayerCapabilitiesProxyContainer.java | 23 ++-- .../unicopia/forgebullshit/FBS.java | 6 +- .../IPlayerCapabilitiesProxyContainer.java | 4 + .../forgebullshit/NoNameSpacedResource.java | 35 ++++++ .../unicopia/forgebullshit/Provider.java | 13 ++- .../unicopia/forgebullshit/Storage.java | 6 +- .../resources/assets/unicopia/lang/en_US.lang | 7 ++ .../assets/unicopia/models/item/apple.json | 6 + .../unicopia/models/item/apple_green.json | 6 + .../unicopia/models/item/apple_rotten.json | 6 + .../unicopia/models/item/apple_sweet.json | 6 + .../unicopia/models/item/apple_zap.json | 6 + .../models/item/apple_zap_cooked.json | 6 + .../assets/unicopia/models/item/cloud.json | 18 --- .../unicopia/models/item/cloud_large.json | 27 ----- .../unicopia/models/item/cloud_matter.json | 18 --- .../unicopia/models/item/cloud_med.json | 16 --- .../unicopia/models/item/cloud_small.json | 16 --- .../unicopia/models/item/cloud_stairs.json | 13 --- .../unicopia/models/item/enchanted_cloud.json | 10 -- .../models/item/enchanted_cloud_slab.json | 10 -- .../unicopia/models/item/normal_cloud.json | 10 -- .../models/item/normal_cloud_slab.json | 10 -- .../unicopia/models/item/packed_cloud.json | 10 -- .../models/item/packed_cloud_slab.json | 10 -- .../assets/unicopia/models/item/spell.json | 19 ---- .../unicopia/models/item/spellbook.json | 18 --- 51 files changed, 490 insertions(+), 392 deletions(-) create mode 100644 src/main/java/com/minelittlepony/unicopia/network/MsgRequestCapabilities.java create mode 100644 src/main/java/come/minelittlepony/unicopia/forgebullshit/NoNameSpacedResource.java create mode 100644 src/main/resources/assets/unicopia/models/item/apple.json create mode 100644 src/main/resources/assets/unicopia/models/item/apple_green.json create mode 100644 src/main/resources/assets/unicopia/models/item/apple_rotten.json create mode 100644 src/main/resources/assets/unicopia/models/item/apple_sweet.json create mode 100644 src/main/resources/assets/unicopia/models/item/apple_zap.json create mode 100644 src/main/resources/assets/unicopia/models/item/apple_zap_cooked.json delete mode 100644 src/main/resources/assets/unicopia/models/item/cloud.json delete mode 100644 src/main/resources/assets/unicopia/models/item/cloud_large.json delete mode 100644 src/main/resources/assets/unicopia/models/item/cloud_matter.json delete mode 100644 src/main/resources/assets/unicopia/models/item/cloud_med.json delete mode 100644 src/main/resources/assets/unicopia/models/item/cloud_small.json delete mode 100644 src/main/resources/assets/unicopia/models/item/cloud_stairs.json delete mode 100644 src/main/resources/assets/unicopia/models/item/enchanted_cloud.json delete mode 100644 src/main/resources/assets/unicopia/models/item/enchanted_cloud_slab.json delete mode 100644 src/main/resources/assets/unicopia/models/item/normal_cloud.json delete mode 100644 src/main/resources/assets/unicopia/models/item/normal_cloud_slab.json delete mode 100644 src/main/resources/assets/unicopia/models/item/packed_cloud.json delete mode 100644 src/main/resources/assets/unicopia/models/item/packed_cloud_slab.json delete mode 100644 src/main/resources/assets/unicopia/models/item/spell.json delete mode 100644 src/main/resources/assets/unicopia/models/item/spellbook.json diff --git a/src/main/java/com/minelittlepony/unicopia/Race.java b/src/main/java/com/minelittlepony/unicopia/Race.java index c3190f8a..19970abc 100644 --- a/src/main/java/com/minelittlepony/unicopia/Race.java +++ b/src/main/java/com/minelittlepony/unicopia/Race.java @@ -1,5 +1,8 @@ package com.minelittlepony.unicopia; +import java.util.HashMap; +import java.util.Map; + import com.google.common.base.Strings; import net.minecraft.client.resources.I18n; @@ -16,6 +19,13 @@ public enum Race { private final boolean flight; private final boolean earth; + private final static Map raceIdMap = new HashMap<>(); + static { + for (Race race : values()) { + raceIdMap.put(race.ordinal(), race); + } + } + Race(boolean magic, boolean flight, boolean earth) { this.magic = magic; this.flight = flight; @@ -43,7 +53,7 @@ public enum Race { } public String getTranslationString() { - return String.format("unicopia.race.%s", name()); + return String.format("unicopia.race.%s", name().toLowerCase()); } public boolean isSameAs(String s) { @@ -59,19 +69,14 @@ public enum Race { } } - return fromId(s); - } - - public static Race fromId(String s) { try { - int id = Integer.parseInt(s); - Race[] values = values(); - if (id >= 0 || id < values.length) { - return values[id]; - } + return fromId(Integer.parseInt(s)); } catch (NumberFormatException e) { } return HUMAN; } + public static Race fromId(int id) { + return raceIdMap.getOrDefault(id, HUMAN); + } } diff --git a/src/main/java/com/minelittlepony/unicopia/UClient.java b/src/main/java/com/minelittlepony/unicopia/UClient.java index a29d3cbb..a1e85dcc 100644 --- a/src/main/java/com/minelittlepony/unicopia/UClient.java +++ b/src/main/java/com/minelittlepony/unicopia/UClient.java @@ -4,6 +4,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler; public interface UClient { static boolean isClientSide() { - return FMLCommonHandler.instance().getSide().isServer(); + return FMLCommonHandler.instance().getSide().isClient(); } } diff --git a/src/main/java/com/minelittlepony/unicopia/UItems.java b/src/main/java/com/minelittlepony/unicopia/UItems.java index 2662c2a4..64defff0 100644 --- a/src/main/java/com/minelittlepony/unicopia/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/UItems.java @@ -4,6 +4,7 @@ import com.minelittlepony.unicopia.item.ItemApple; import come.minelittlepony.unicopia.forgebullshit.RegistryLockSpinner; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; @@ -18,16 +19,17 @@ public class UItems { static void registerItems() { RegistryLockSpinner.unlock(Item.REGISTRY); - Item.REGISTRY.register(260, new ResourceLocation("minecraft", "apple"), apple); + ResourceLocation res = new ResourceLocation("apple"); + + Item.REGISTRY.register(Item.getIdFromItem(Items.APPLE), res, apple); if (UClient.isClientSide()) { String[] variants = apple.getVariants(); - ResourceLocation app = new ResourceLocation("minecraft", "apple"); - for (int i = 0; i < variants.length; i++) { - ModelLoader.setCustomModelResourceLocation(apple, i, new ModelResourceLocation(app, variants[i])); + ModelLoader.setCustomModelResourceLocation(apple, i, new ModelResourceLocation("unicopia:" + variants[i])); } + // ModelBakery.registerItemVariants(apple, NoNameSpacedResource.ofAllDomained("unicopia", apple.getVariants())); } RegistryLockSpinner.lock(Item.REGISTRY); diff --git a/src/main/java/com/minelittlepony/unicopia/Unicopia.java b/src/main/java/com/minelittlepony/unicopia/Unicopia.java index 0a3e045e..8f265e7f 100644 --- a/src/main/java/com/minelittlepony/unicopia/Unicopia.java +++ b/src/main/java/com/minelittlepony/unicopia/Unicopia.java @@ -1,11 +1,13 @@ package com.minelittlepony.unicopia; +import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @@ -14,7 +16,6 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.relauncher.Side; @@ -22,12 +23,14 @@ import net.minecraftforge.fml.relauncher.SideOnly; import com.minelittlepony.jumpingcastle.api.IChannel; import com.minelittlepony.jumpingcastle.api.JumpingCastle; +import com.minelittlepony.jumpingcastle.api.Target; import com.minelittlepony.unicopia.client.particle.EntityMagicFX; import com.minelittlepony.unicopia.client.particle.Particles; import com.minelittlepony.unicopia.command.Commands; import com.minelittlepony.unicopia.input.Keyboard; import com.minelittlepony.unicopia.network.MsgPlayerAbility; import com.minelittlepony.unicopia.network.MsgPlayerCapabilities; +import com.minelittlepony.unicopia.network.MsgRequestCapabilities; import com.minelittlepony.unicopia.player.PlayerSpeciesList; import com.minelittlepony.unicopia.power.PowersRegistry; @@ -51,13 +54,17 @@ public class Unicopia { @EventHandler public void init(FMLInitializationEvent event) { - channel = JumpingCastle.listen(MODID) - .consume(MsgPlayerCapabilities.class, (msg, channel) -> { - PlayerSpeciesList.instance().handleSpeciesChange(msg.senderId, msg.newRace); + channel = JumpingCastle.listen(MODID, () -> { + channel.send(new MsgRequestCapabilities(Minecraft.getMinecraft().player), Target.SERVER); }) - .consume(MsgPlayerAbility.class, (msg, channel) -> { - msg.applyServerAbility(); - }); + // client ------> server + .consume(MsgRequestCapabilities.class) + + // client <------ server + .consume(MsgPlayerCapabilities.class) + + // client ------> server + .consume(MsgPlayerAbility.class); MAGIC_PARTICLE = Particles.instance().registerParticle(new EntityMagicFX.Factory()); @@ -68,15 +75,9 @@ public class Unicopia { @SubscribeEvent public static void registerItemsStatic(RegistryEvent.Register event) { - // Why won't you run!? UItems.registerItems(); } - @SubscribeEvent - public static void onPlayerJoin(PlayerLoggedInEvent event) { - PlayerSpeciesList.instance().sendCapabilities(event.player.getGameProfile().getId()); - } - @SideOnly(Side.CLIENT) @SubscribeEvent public static void onGameTick(TickEvent.ClientTickEvent event) { @@ -86,29 +87,38 @@ public class Unicopia { } @SubscribeEvent - public static void onPlyerTick(TickEvent.PlayerTickEvent event) { + public static void onPlayerTick(TickEvent.PlayerTickEvent event) { if (event.phase == Phase.END) { - PlayerSpeciesList.instance().getPlayer(event.player).onUpdate(event.player); + PlayerSpeciesList.instance() + .getPlayer(event.player) + .onUpdate(event.player); } } + @SubscribeEvent + public static void onPlayerFall(PlayerFlyableFallEvent event) { + PlayerSpeciesList.instance() + .getPlayer(event.getEntityPlayer()) + .onFall(event.getDistance(), event.getMultiplier()); + } + @EventHandler public void onServerStarted(FMLServerStartingEvent event) { Commands.init(event); } - @EventHandler - public void onPlayerRightClick(PlayerInteractEvent.RightClickItem event) { + @SubscribeEvent + public static void onPlayerRightClick(PlayerInteractEvent.RightClickItem event) { // Why won't you run!? - if (!event.isCanceled() - && event.getItemStack().getItemUseAction() == EnumAction.EAT) { - PlayerSpeciesList.instance().getPlayer(event.getEntityPlayer()).onEntityEat(); + if (!event.isCanceled() && event.getItemStack().getItemUseAction() == EnumAction.EAT) { + PlayerSpeciesList.instance() + .getPlayer(event.getEntityPlayer()) + .onEntityEat(); } } @SubscribeEvent public static void attachCapabilities(AttachCapabilitiesEvent event) { - // Why won't you run!? FBS.attach(event); } diff --git a/src/main/java/com/minelittlepony/unicopia/client/particle/Particles.java b/src/main/java/com/minelittlepony/unicopia/client/particle/Particles.java index 6a044d67..53328054 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/particle/Particles.java +++ b/src/main/java/com/minelittlepony/unicopia/client/particle/Particles.java @@ -23,7 +23,7 @@ public class Particles { public int registerParticle(IParticleFactory factory) { int id = registeredParticles.size(); registeredParticles.add(factory); - return -id; + return -id - 1; } public Particle spawnParticle(int particleId, boolean ignoreDistance, double posX, double posY, double posZ, double speedX, double speedY, double speedZ, int ...pars) { @@ -51,6 +51,7 @@ public class Particles { return mc.effectRenderer.spawnEffectParticle(particleId, posX, posY, posZ, speedX, speedY, speedZ, pars); } + particleId ++; IParticleFactory iparticlefactory = registeredParticles.get(-particleId); diff --git a/src/main/java/com/minelittlepony/unicopia/command/CommandSpecies.java b/src/main/java/com/minelittlepony/unicopia/command/CommandSpecies.java index 7507bcc5..3be823ef 100644 --- a/src/main/java/com/minelittlepony/unicopia/command/CommandSpecies.java +++ b/src/main/java/com/minelittlepony/unicopia/command/CommandSpecies.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import com.minelittlepony.unicopia.Race; -import com.minelittlepony.unicopia.player.IPlayer; import com.minelittlepony.unicopia.player.PlayerSpeciesList; import net.minecraft.command.CommandBase; @@ -72,10 +71,7 @@ class CommandSpecies extends CommandBase { player.sendMessage(new TextComponentTranslation("commands.race.fail", args[1].toUpperCase())); } else { if (PlayerSpeciesList.instance().speciesPermitted(species)) { - IPlayer iplayer = PlayerSpeciesList.instance().getPlayer(player); - - iplayer.setPlayerSpecies(species); - iplayer.sendCapabilities(); + PlayerSpeciesList.instance().getPlayer(player).setPlayerSpecies(species); TextComponentTranslation formattedName = new TextComponentTranslation(species.name().toLowerCase()); @@ -96,7 +92,7 @@ class CommandSpecies extends CommandBase { String name = "commands.race.tell."; name += player == sender ? "self" : "other"; - ITextComponent race = new TextComponentString(spec.getTranslationString()); + ITextComponent race = new TextComponentTranslation(spec.getTranslationString()); TextComponentTranslation message = new TextComponentTranslation(name); diff --git a/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerAbility.java b/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerAbility.java index 69aab133..78a51a66 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerAbility.java +++ b/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerAbility.java @@ -5,7 +5,9 @@ import java.util.UUID; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.annotations.Expose; +import com.minelittlepony.jumpingcastle.api.IChannel; import com.minelittlepony.jumpingcastle.api.IMessage; +import com.minelittlepony.jumpingcastle.api.IMessageHandler; import com.minelittlepony.unicopia.player.IPlayer; import com.minelittlepony.unicopia.power.IData; import com.minelittlepony.unicopia.power.IPower; @@ -14,7 +16,7 @@ import com.minelittlepony.unicopia.power.PowersRegistry; import net.minecraft.entity.player.EntityPlayer; @IMessage.Id(2) -public class MsgPlayerAbility implements IMessage { +public class MsgPlayerAbility implements IMessage, IMessageHandler { private static final Gson gson = new GsonBuilder() .excludeFieldsWithoutExposeAnnotation() @@ -29,15 +31,12 @@ public class MsgPlayerAbility implements IMessage { @Expose private String abilityJson; - public MsgPlayerAbility(IPower power, IData data) { + public MsgPlayerAbility(EntityPlayer player, IPower power, IData data) { + senderId = player.getGameProfile().getId(); powerIdentifier = power.getKeyName(); abilityJson = gson.toJson(data, power.getPackageType()); } - public void applyServerAbility() { - PowersRegistry.instance().getPowerFromName(powerIdentifier).ifPresent(this::apply); - } - private void apply(IPower power) { EntityPlayer player = IPlayer.getPlayerEntity(senderId); if (player == null) { @@ -48,4 +47,9 @@ public class MsgPlayerAbility implements IMessage { power.apply(player, data); } + + @Override + public void onPayload(MsgPlayerAbility message, IChannel channel) { + PowersRegistry.instance().getPowerFromName(powerIdentifier).ifPresent(this::apply); + } } diff --git a/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java b/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java index f92fe9b1..4ecd144d 100644 --- a/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java +++ b/src/main/java/com/minelittlepony/unicopia/network/MsgPlayerCapabilities.java @@ -1,28 +1,75 @@ package com.minelittlepony.unicopia.network; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; import java.util.UUID; import com.google.gson.annotations.Expose; +import com.minelittlepony.jumpingcastle.api.IChannel; import com.minelittlepony.jumpingcastle.api.IMessage; +import com.minelittlepony.jumpingcastle.api.IMessageHandler; import com.minelittlepony.unicopia.Race; +import com.minelittlepony.unicopia.player.IPlayer; +import com.minelittlepony.unicopia.player.PlayerSpeciesList; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; @IMessage.Id(1) -public class MsgPlayerCapabilities implements IMessage { +public class MsgPlayerCapabilities implements IMessage, IMessageHandler { @Expose public Race newRace; @Expose - public UUID senderId; + UUID senderId; + + @Expose + byte[] compoundTag; public MsgPlayerCapabilities(Race race, EntityPlayer player) { - newRace = race; - senderId = player.getGameProfile().getId(); + this(race, player.getGameProfile().getId()); + } + + public MsgPlayerCapabilities(IPlayer player) { + newRace = player.getPlayerSpecies(); + senderId = player.getOwner().getGameProfile().getId(); + + try (ByteArrayOutputStream bytes = new ByteArrayOutputStream()) { + NBTTagCompound nbt = player.toNBT(); + + CompressedStreamTools.write(nbt, new DataOutputStream(bytes)); + + compoundTag = bytes.toByteArray(); + } catch (IOException e) { + } } public MsgPlayerCapabilities(Race race, UUID playerId) { newRace = race; senderId = playerId; + compoundTag = new byte[0]; + } + + @Override + public void onPayload(MsgPlayerCapabilities message, IChannel channel) { + System.out.println("[CLIENT] Got capabilities for player id " + senderId + " I am " + + Minecraft.getMinecraft().player.getGameProfile().getId()); + IPlayer player = PlayerSpeciesList.instance().getPlayer(Minecraft.getMinecraft().player); + + if (compoundTag.length > 0) { + try (ByteArrayInputStream input = new ByteArrayInputStream(compoundTag)) { + NBTTagCompound nbt = CompressedStreamTools.read(new DataInputStream(input)); + + player.readFromNBT(nbt); + } catch (IOException e) { + } + } else { + player.setPlayerSpecies(newRace); + } } } diff --git a/src/main/java/com/minelittlepony/unicopia/network/MsgRequestCapabilities.java b/src/main/java/com/minelittlepony/unicopia/network/MsgRequestCapabilities.java new file mode 100644 index 00000000..38b5c689 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/network/MsgRequestCapabilities.java @@ -0,0 +1,30 @@ +package com.minelittlepony.unicopia.network; + +import java.util.UUID; + +import com.google.gson.annotations.Expose; +import com.minelittlepony.jumpingcastle.api.IChannel; +import com.minelittlepony.jumpingcastle.api.IMessage; +import com.minelittlepony.jumpingcastle.api.IMessageHandler; +import com.minelittlepony.unicopia.player.IPlayer; +import com.minelittlepony.unicopia.player.PlayerSpeciesList; + +import net.minecraft.entity.player.EntityPlayer; + +@IMessage.Id(0) +public class MsgRequestCapabilities implements IMessage, IMessageHandler { + @Expose + public UUID senderId; + + public MsgRequestCapabilities(EntityPlayer player) { + senderId = player.getGameProfile().getId(); + } + + @Override + public void onPayload(MsgRequestCapabilities message, IChannel channel) { + System.out.println("[SERVER] Sending capabilities to player id " + senderId); + IPlayer player = PlayerSpeciesList.instance().getPlayer(senderId); + + channel.respond(new MsgPlayerCapabilities(player.getPlayerSpecies(), senderId), senderId); + } +} diff --git a/src/main/java/com/minelittlepony/unicopia/player/DefaultPlayerSpecies.java b/src/main/java/com/minelittlepony/unicopia/player/DefaultPlayerSpecies.java index c1ef200c..fa966a32 100644 --- a/src/main/java/com/minelittlepony/unicopia/player/DefaultPlayerSpecies.java +++ b/src/main/java/com/minelittlepony/unicopia/player/DefaultPlayerSpecies.java @@ -23,7 +23,7 @@ final class DefaultPlayerSpecies implements IPlayer, IAbilityReceiver { } @Override - public void sendCapabilities() { + public void sendCapabilities(boolean full) { } @@ -71,4 +71,9 @@ final class DefaultPlayerSpecies implements IPlayer, IAbilityReceiver { public EntityPlayer getOwner() { return null; } + + @Override + public void copyFrom(IPlayer oldPlayer) { + + } } diff --git a/src/main/java/com/minelittlepony/unicopia/player/IPlayer.java b/src/main/java/com/minelittlepony/unicopia/player/IPlayer.java index df6fcb43..4d868eca 100644 --- a/src/main/java/com/minelittlepony/unicopia/player/IPlayer.java +++ b/src/main/java/com/minelittlepony/unicopia/player/IPlayer.java @@ -15,16 +15,22 @@ public interface IPlayer extends ICaster, InbtSerialisable, IUpdat void setPlayerSpecies(Race race); - void sendCapabilities(); + void sendCapabilities(boolean full); IAbilityReceiver getAbilities(); boolean isClientPlayer(); + void copyFrom(IPlayer oldPlayer); + default void onEntityEat() { } + default void onFall(float distance, float damageMultiplier) { + + } + static EntityPlayer getPlayerEntity(UUID playerId) { EntityPlayer player = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerByUUID(playerId); diff --git a/src/main/java/com/minelittlepony/unicopia/player/PlayerAbilityDelegate.java b/src/main/java/com/minelittlepony/unicopia/player/PlayerAbilityDelegate.java index 4e794e21..59c03ff1 100644 --- a/src/main/java/com/minelittlepony/unicopia/player/PlayerAbilityDelegate.java +++ b/src/main/java/com/minelittlepony/unicopia/player/PlayerAbilityDelegate.java @@ -111,7 +111,7 @@ class PlayerAbilityDelegate implements IAbilityReceiver, IUpdatable, InbtSeriali IData data = activeAbility.tryActivate(entity, entity.getEntityWorld()); if (data != null) { - Unicopia.channel.send(new MsgPlayerAbility(activeAbility, data), Target.SERVER); + Unicopia.channel.send(new MsgPlayerAbility(entity, activeAbility, data), Target.SERVER); } return data != null; diff --git a/src/main/java/com/minelittlepony/unicopia/player/PlayerCapabilities.java b/src/main/java/com/minelittlepony/unicopia/player/PlayerCapabilities.java index 41b7547f..14f40bf2 100644 --- a/src/main/java/com/minelittlepony/unicopia/player/PlayerCapabilities.java +++ b/src/main/java/com/minelittlepony/unicopia/player/PlayerCapabilities.java @@ -2,8 +2,13 @@ package com.minelittlepony.unicopia.player; import java.util.UUID; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.UClient; +import com.minelittlepony.unicopia.Unicopia; +import com.minelittlepony.unicopia.network.MsgPlayerCapabilities; import com.minelittlepony.unicopia.spell.ICaster; import com.minelittlepony.unicopia.spell.IMagicEffect; import com.minelittlepony.unicopia.spell.SpellRegistry; @@ -12,11 +17,18 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.StatList; class PlayerCapabilities implements IPlayer, ICaster { - private Race playerSpecies = Race.HUMAN; + private static final Logger logger = LogManager.getLogger(); + + private static final DataParameter PLAYER_RACE = EntityDataManager + .createKey(EntityPlayer.class, DataSerializers.VARINT); private final PlayerAbilityDelegate powers = new PlayerAbilityDelegate(this); @@ -25,31 +37,46 @@ class PlayerCapabilities implements IPlayer, ICaster { private IMagicEffect effect; private EntityPlayer entity; + private UUID playerId; - PlayerCapabilities(UUID playerId) { + PlayerCapabilities(EntityPlayer player) { + setOwner(player); + player.getDataManager().register(PLAYER_RACE, Race.HUMAN.ordinal()); } @Override public Race getPlayerSpecies() { - return playerSpecies; + if (getOwner() == null) { + return Race.HUMAN; + } + return Race.fromId(getOwner().getDataManager().get(PLAYER_RACE)); } @Override public void setPlayerSpecies(Race race) { - playerSpecies = race; - EntityPlayer self = getOwner(); - self.capabilities.allowFlying = race.canFly(); - gravity.updateFlightStat(self, self.capabilities.isFlying); + if (self != null) { + getOwner().getDataManager().set(PLAYER_RACE, race.ordinal()); - self.sendPlayerAbilities(); + self.capabilities.allowFlying = race.canFly(); + gravity.updateFlightStat(self, self.capabilities.isFlying); + + self.sendPlayerAbilities(); + sendCapabilities(false); + } } @Override - public void sendCapabilities() { - PlayerSpeciesList.instance().sendCapabilities(getOwner().getGameProfile().getId()); + public void sendCapabilities(boolean full) { + if (!getOwner().getEntityWorld().isRemote) { + if (full) { + Unicopia.channel.broadcast(new MsgPlayerCapabilities(this)); + } else { + Unicopia.channel.broadcast(new MsgPlayerCapabilities(getPlayerSpecies(), getOwner().getGameProfile().getId())); + } + } } @Override @@ -65,22 +92,33 @@ class PlayerCapabilities implements IPlayer, ICaster { @Override public void onUpdate(EntityPlayer entity) { - this.entity = entity; - powers.onUpdate(entity); gravity.onUpdate(entity); - if (!getPlayerSpecies().canCast()) { - effect = null; - } - if (effect != null) { - if (entity.getEntityWorld().isRemote && entity.getEntityWorld().getWorldTime() % 10 == 0) { - effect.render(entity); - } + if (!getPlayerSpecies().canCast()) { + setEffect(null); + } else { + if (entity.getEntityWorld().isRemote) { // && entity.getEntityWorld().getWorldTime() % 10 == 0 + effect.render(entity); + } - if (!effect.update(entity)) { - effect = null; + if (!effect.update(entity)) { + setEffect(null); + } + } + } + } + + @Override + public void onFall(float distance, float damageMultiplier) { + if (!entity.getEntityWorld().isRemote) { + if (getPlayerSpecies().canFly()) { + if (entity.fallDistance > 2) { + entity.addStat(StatList.FALL_ONE_CM, (int)Math.round(distance * 100)); + } + + gravity.landHard(entity, distance, damageMultiplier); } } } @@ -96,7 +134,7 @@ class PlayerCapabilities implements IPlayer, ICaster { @Override public void writeToNBT(NBTTagCompound compound) { - compound.setString("playerSpecies", playerSpecies.name()); + compound.setString("playerSpecies", getPlayerSpecies().name()); compound.setTag("powers", powers.toNBT()); compound.setTag("gravity", gravity.toNBT()); @@ -108,12 +146,13 @@ class PlayerCapabilities implements IPlayer, ICaster { @Override public void readFromNBT(NBTTagCompound compound) { - playerSpecies = Race.fromName(compound.getString("playerSpecies")); + setPlayerSpecies(Race.fromName(compound.getString("playerSpecies"))); powers.readFromNBT(compound.getCompoundTag("powers")); gravity.readFromNBT(compound.getCompoundTag("gravity")); + effect = null; + if (compound.hasKey("effect_id") && compound.hasKey("effect")) { - effect = null; SpellRegistry.instance().getSpellFromName(compound.getString("effect_id")).ifPresent(f -> { effect = f; effect.readFromNBT(compound.getCompoundTag("effect")); @@ -121,9 +160,17 @@ class PlayerCapabilities implements IPlayer, ICaster { } } + @Override + public void copyFrom(IPlayer oldPlayer) { + setEffect(oldPlayer.getEffect()); + setPlayerSpecies(oldPlayer.getPlayerSpecies()); + } + @Override public void setEffect(IMagicEffect effect) { this.effect = effect; + + sendCapabilities(true); } @Override @@ -131,8 +178,20 @@ class PlayerCapabilities implements IPlayer, ICaster { return effect; } + @Override + public void setOwner(EntityPlayer owner) { + entity = owner; + playerId = owner.getGameProfile().getId(); + } + @Override public EntityPlayer getOwner() { + if (entity == null) { + entity = IPlayer.getPlayerEntity(playerId); + if (entity == null) { + logger.error("Capabilities without player! Mismatched id was" + playerId); + } + } return entity; } } diff --git a/src/main/java/com/minelittlepony/unicopia/player/PlayerGravityDelegate.java b/src/main/java/com/minelittlepony/unicopia/player/PlayerGravityDelegate.java index d0b33cbe..7f76593e 100644 --- a/src/main/java/com/minelittlepony/unicopia/player/PlayerGravityDelegate.java +++ b/src/main/java/com/minelittlepony/unicopia/player/PlayerGravityDelegate.java @@ -2,14 +2,28 @@ package com.minelittlepony.unicopia.player; import com.minelittlepony.unicopia.InbtSerialisable; +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; class PlayerGravityDelegate implements IUpdatable, InbtSerialisable { private final IPlayer player; - private int ticksSinceLanding = 0; + private static final float MAXIMUM_FLIGHT_EXPERIENCE = 100; + + private int ticksInAir = 0; + private float flightExperience = 0; public boolean isFlying = false; @@ -19,20 +33,69 @@ class PlayerGravityDelegate implements IUpdatable, InbtSerialisable { @Override public void onUpdate(EntityPlayer entity) { - if (!entity.capabilities.isCreativeMode) { - if (player.getPlayerSpecies().canFly()) { - if (ticksSinceLanding < 2) { - ticksSinceLanding++; + entity.capabilities.allowFlying = entity.capabilities.isCreativeMode || player.getPlayerSpecies().canFly(); + entity.capabilities.isFlying |= entity.capabilities.allowFlying && isFlying; + + if (!entity.capabilities.isCreativeMode && !entity.isElytraFlying()) { + if (entity.capabilities.isFlying && !entity.isRiding()) { + + entity.fallDistance = 0; + + float exhaustion = (0.2F * ticksInAir++) / 100; + if (entity.isSprinting()) { + exhaustion *= 3.11F; } - entity.capabilities.allowFlying = player.getPlayerSpecies().canFly(); - entity.capabilities.isFlying = false; + entity.addExhaustion(exhaustion * (1 - flightExperience)); + + if (entity.ticksExisted % 20000 == 0) { + addFlightExperience(entity); + } + } else { + ticksInAir = 0; } } + } - if (entity.capabilities.isFlying) { - entity.fallDistance = 0; + public void landHard(EntityPlayer player, float distance, float damageMultiplier) { + if (distance <= 0) { + return; } + + PotionEffect potioneffect = player.getActivePotionEffect(MobEffects.JUMP_BOOST); + float potion = potioneffect != null ? potioneffect.getAmplifier() + 1 : 0; + int i = MathHelper.ceil((distance - 8.0F - potion) * damageMultiplier); + + if (i > 0) { + int j = MathHelper.floor(player.posX); + int k = MathHelper.floor(player.posY - 0.20000000298023224D); + int l = MathHelper.floor(player.posZ); + + BlockPos pos = new BlockPos(j, k, l); + + IBlockState state = player.world.getBlockState(pos); + Block block = state.getBlock(); + + if (state.getMaterial() != Material.AIR) { + + player.playSound(getFallSound(i), 1, 1); + player.attackEntityFrom(DamageSource.FALL, i); + + SoundType soundtype = block.getSoundType(state, player.getEntityWorld(), pos, player); + + player.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.5f, soundtype.getPitch() * 0.75f); + } + } + } + + protected SoundEvent getFallSound(int distance) { + return distance > 4 ? SoundEvents.ENTITY_PLAYER_BIG_FALL : SoundEvents.ENTITY_PLAYER_SMALL_FALL; + } + + private void addFlightExperience(EntityPlayer entity) { + entity.addExperience(1); + + flightExperience += (flightExperience - MAXIMUM_FLIGHT_EXPERIENCE) / 20; } public void updateFlightStat(EntityPlayer entity, boolean flying) { @@ -45,7 +108,7 @@ class PlayerGravityDelegate implements IUpdatable, InbtSerialisable { isFlying = entity.capabilities.isFlying; if (isFlying) { - ticksSinceLanding = 0; + ticksInAir = 0; } } else { @@ -57,13 +120,15 @@ class PlayerGravityDelegate implements IUpdatable, InbtSerialisable { @Override public void writeToNBT(NBTTagCompound compound) { - compound.setInteger("ticksOnGround", ticksSinceLanding); + compound.setInteger("flightDuration", ticksInAir); + compound.setFloat("flightExperience", flightExperience); compound.setBoolean("isFlying", isFlying); } @Override public void readFromNBT(NBTTagCompound compound) { - ticksSinceLanding = compound.getInteger("ticksOnGround"); + ticksInAir = compound.getInteger("flightDuration"); + flightExperience = compound.getFloat("flightExperience"); isFlying = compound.getBoolean("isFlying"); } } diff --git a/src/main/java/com/minelittlepony/unicopia/player/PlayerSpeciesList.java b/src/main/java/com/minelittlepony/unicopia/player/PlayerSpeciesList.java index e643a76f..321226fc 100644 --- a/src/main/java/com/minelittlepony/unicopia/player/PlayerSpeciesList.java +++ b/src/main/java/com/minelittlepony/unicopia/player/PlayerSpeciesList.java @@ -4,13 +4,9 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import com.minelittlepony.jumpingcastle.api.Target; import com.minelittlepony.unicopia.Race; -import com.minelittlepony.unicopia.Unicopia; -import com.minelittlepony.unicopia.network.MsgPlayerCapabilities; import come.minelittlepony.unicopia.forgebullshit.FBS; -import come.minelittlepony.unicopia.forgebullshit.IPlayerCapabilitiesProxyContainer; import net.minecraft.entity.player.EntityPlayer; public class PlayerSpeciesList { @@ -27,16 +23,8 @@ public class PlayerSpeciesList { return race.isDefault() || serverPermittedRaces.isEmpty() || serverPermittedRaces.contains(race); } - public void sendCapabilities(UUID playerId) { - Unicopia.channel.send(new MsgPlayerCapabilities(getPlayer(playerId).getPlayerSpecies(), playerId), playerId); - } - - public void handleSpeciesChange(UUID playerId, Race race) { - getPlayer(playerId).setPlayerSpecies(race); - } - - public IPlayer emptyPlayer(UUID playerId) { - return new PlayerCapabilities(playerId); + public IPlayer emptyPlayer(EntityPlayer player) { + return new PlayerCapabilities(player); } public IPlayer getPlayer(EntityPlayer player) { @@ -44,16 +32,7 @@ public class PlayerSpeciesList { return DefaultPlayerSpecies.INSTANCE; } - IPlayerCapabilitiesProxyContainer container = FBS.of(player); - - IPlayer ply = container.getPlayer(); - if (ply == null) { - ply = emptyPlayer(player.getGameProfile().getId()); - - container.setPlayer(ply); - } - - return ply; + return FBS.of(player).getPlayer(); } public IPlayer getPlayer(UUID playerId) { diff --git a/src/main/java/com/minelittlepony/unicopia/power/IPower.java b/src/main/java/com/minelittlepony/unicopia/power/IPower.java index 2f6e3016..2aa9094f 100644 --- a/src/main/java/com/minelittlepony/unicopia/power/IPower.java +++ b/src/main/java/com/minelittlepony/unicopia/power/IPower.java @@ -1,17 +1,16 @@ package com.minelittlepony.unicopia.power; -import java.util.Random; - import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.client.particle.Particles; import com.minelittlepony.unicopia.input.IKeyBind; import com.minelittlepony.unicopia.player.IPlayer; +import com.minelittlepony.util.shape.IShape; +import com.minelittlepony.util.shape.Sphere; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public interface IPower extends IKeyBind { @@ -41,20 +40,20 @@ public interface IPower extends IKeyBind { } static void spawnParticles(int particleId, EntityPlayer player, int count) { + double halfDist = player.getEyeHeight() / 1.5; double middle = player.getEntityBoundingBox().minY + halfDist; - Random rand = player.getEntityWorld().rand; + IShape shape = new Sphere(false, (float)halfDist); + for (int i = 0; i < count; i++) { - double x = (rand.nextFloat() * halfDist) - halfDist; - double y = (rand.nextFloat() * halfDist) - halfDist; - double z = (rand.nextFloat() * halfDist) - halfDist; + Vec3d point = shape.computePoint(player.world.rand); Particles.instance().spawnParticle(particleId, false, - player.posX + x, - middle + y, - player.posZ + z, - 0, 0, 0); + player.posX + point.x, + middle + point.y, + player.posZ + point.z, + 0, 0, 0); } } @@ -109,21 +108,18 @@ public interface IPower extends IKeyBind { * @param player The player that triggered the ability * @param data Data previously sent from the client */ - @SideOnly(Side.SERVER) void apply(EntityPlayer player, T data); /** * Called just before the ability is activated. * @param player The current player */ - @SideOnly(Side.CLIENT) void preApply(EntityPlayer player); /** * Called every tick until the cooldown timer runs out. * @param player The current player */ - @SideOnly(Side.CLIENT) void postApply(EntityPlayer player); } diff --git a/src/main/java/com/minelittlepony/unicopia/power/PowerFeed.java b/src/main/java/com/minelittlepony/unicopia/power/PowerFeed.java index 919efcb1..ac07f4d1 100644 --- a/src/main/java/com/minelittlepony/unicopia/power/PowerFeed.java +++ b/src/main/java/com/minelittlepony/unicopia/power/PowerFeed.java @@ -15,6 +15,7 @@ import com.minelittlepony.util.vector.VecHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; @@ -66,6 +67,7 @@ public class PowerFeed implements IPower { return e instanceof EntityCow || e instanceof EntityVillager || e instanceof EntityPlayer + || e instanceof EntitySheep || EnumCreatureType.MONSTER.getCreatureClass().isAssignableFrom(e.getClass()); } diff --git a/src/main/java/com/minelittlepony/unicopia/power/PowerGrow.java b/src/main/java/com/minelittlepony/unicopia/power/PowerGrow.java index 4085cbc1..6cf1fa4a 100644 --- a/src/main/java/com/minelittlepony/unicopia/power/PowerGrow.java +++ b/src/main/java/com/minelittlepony/unicopia/power/PowerGrow.java @@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.power; import org.lwjgl.input.Keyboard; import com.minelittlepony.unicopia.Race; +import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.player.IPlayer; import com.minelittlepony.unicopia.power.data.Location; import com.minelittlepony.util.vector.VecHelper; @@ -84,18 +85,13 @@ public class PowerGrow implements IPower { IGrowable g = ((IGrowable)state.getBlock()); if (g.canGrow(w, pos, state, w.isRemote) && g.canUseBonemeal(w, w.rand, pos, state)) { - do { - if (ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1), w, pos)) { - w.playEvent(2005, pos, 0); + if (ItemDye.applyBonemeal(new ItemStack(Items.DYE, 1), w, pos)) { + w.playEvent(2005, pos, 0); - if (g instanceof BlockDoublePlant) { - w.playEvent(2005, pos.up(), 0); - } + if (g instanceof BlockDoublePlant) { + w.playEvent(2005, pos.up(), 0); } - - state = w.getBlockState(pos); - g = ((IGrowable)state.getBlock()); - } while (g.canGrow(w, pos, state, w.isRemote)); + } return 1; } @@ -105,7 +101,7 @@ public class PowerGrow implements IPower { @Override public void preApply(EntityPlayer player) { - IPower.spawnParticles(com.minelittlepony.unicopia.Unicopia.MAGIC_PARTICLE, player, 1); + IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 1); } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/power/PowerMagic.java b/src/main/java/com/minelittlepony/unicopia/power/PowerMagic.java index 55fb6e10..dcc5a7cf 100644 --- a/src/main/java/com/minelittlepony/unicopia/power/PowerMagic.java +++ b/src/main/java/com/minelittlepony/unicopia/power/PowerMagic.java @@ -25,9 +25,9 @@ public class PowerMagic implements IPower { @Override public int getWarmupTime(IPlayer player) { - if (player.hasEffect() && "shield".contentEquals(player.getEffect().getName())) { - return 0; - } + // if (player.hasEffect() && "shield".contentEquals(player.getEffect().getName())) { + // return 0; + // } return 20; } diff --git a/src/main/java/com/minelittlepony/unicopia/power/PowerStomp.java b/src/main/java/com/minelittlepony/unicopia/power/PowerStomp.java index 5de9e3b4..fcab6a87 100644 --- a/src/main/java/com/minelittlepony/unicopia/power/PowerStomp.java +++ b/src/main/java/com/minelittlepony/unicopia/power/PowerStomp.java @@ -6,6 +6,7 @@ import java.util.Map.Entry; import org.lwjgl.input.Keyboard; +import com.google.gson.annotations.Expose; import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.UItems; import com.minelittlepony.unicopia.client.particle.Particles; @@ -95,7 +96,11 @@ public class PowerStomp implements IPower { @Override public void apply(EntityPlayer player, Data data) { + double rad = 4; + + data.hitType = 1; + if (data.hitType == 0) { player.addVelocity(0, -6, 0); BlockPos pos = player.getPosition(); @@ -115,22 +120,28 @@ public class PowerStomp implements IPower { i.attackEntityFrom(damage, amount); } } + Iterable area = BlockPos.getAllInBox(pos.add(-rad, -rad, -rad), pos.add(rad, rad, rad)); for (BlockPos i : area) { if (i.distanceSqToCenter(player.posX, player.posY, player.posZ) <= rad*rad) { spawnEffect(player.world, i); } } + for (int i = 1; i < 202; i+= 2) { spawnParticleRing(player, i); } + IPower.takeFromPlayer(player, 4); + } else if (data.hitType == 1) { + if (player.world.rand.nextInt(30) == 0) { removeTree(player.world, new BlockPos(data.x, data.y, data.z)); } else { dropApples(player.world, new BlockPos(data.x, data.y, data.z)); } + IPower.takeFromPlayer(player, 1); } } @@ -394,7 +405,7 @@ public class PowerStomp implements IPower { } protected static class Data extends Location { - + @Expose public int hitType; public Data(int x, int y, int z, int hit) { diff --git a/src/main/java/com/minelittlepony/unicopia/power/PowerTeleport.java b/src/main/java/com/minelittlepony/unicopia/power/PowerTeleport.java index 6c971c0d..6f572951 100644 --- a/src/main/java/com/minelittlepony/unicopia/power/PowerTeleport.java +++ b/src/main/java/com/minelittlepony/unicopia/power/PowerTeleport.java @@ -107,15 +107,17 @@ public class PowerTeleport implements IPower { @Override public void apply(EntityPlayer player, Location data) { - player.world.playSound(player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 1, 1, true); + player.world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 1, 1); double distance = player.getDistance(data.x, data.y, data.z) / 10; player.dismountRidingEntity(); player.setPositionAndUpdate(data.x + (player.posX - Math.floor(player.posX)), data.y, data.z + (player.posZ - Math.floor(player.posZ))); IPower.takeFromPlayer(player, distance); + player.fallDistance /= distance; - player.world.playSound(data.x, data.y, data.z, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 1, 1, true); + + player.world.playSound(null, data.x, data.y, data.z, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 1, 1); } private boolean enterable(World w, BlockPos pos) { @@ -141,12 +143,11 @@ public class PowerTeleport implements IPower { @Override public void preApply(EntityPlayer player) { - postApply(player); + IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 5); } @Override public void postApply(EntityPlayer player) { - IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 1); + IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 5); } - } diff --git a/src/main/java/com/minelittlepony/unicopia/spell/ICaster.java b/src/main/java/com/minelittlepony/unicopia/spell/ICaster.java index b64cc3f1..dcb2d34b 100644 --- a/src/main/java/com/minelittlepony/unicopia/spell/ICaster.java +++ b/src/main/java/com/minelittlepony/unicopia/spell/ICaster.java @@ -12,7 +12,7 @@ public interface ICaster { return getEffect() != null; } - default void setOwner(EntityLivingBase owner) { + default void setOwner(E owner) { } diff --git a/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java b/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java index aada1e61..b03b8e55 100644 --- a/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java +++ b/src/main/java/com/minelittlepony/unicopia/spell/SpellRegistry.java @@ -16,9 +16,6 @@ public class SpellRegistry { private final Map> factories = new HashMap<>(); private SpellRegistry() { - } - - public void init() { registerSpell("shield", SpellShield::new); } diff --git a/src/main/java/com/minelittlepony/unicopia/spell/SpellShield.java b/src/main/java/com/minelittlepony/unicopia/spell/SpellShield.java index 22dfe54b..972a12eb 100644 --- a/src/main/java/com/minelittlepony/unicopia/spell/SpellShield.java +++ b/src/main/java/com/minelittlepony/unicopia/spell/SpellShield.java @@ -1,7 +1,6 @@ package com.minelittlepony.unicopia.spell; import com.minelittlepony.unicopia.Race; -import com.minelittlepony.unicopia.UClient; import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.client.particle.Particles; import com.minelittlepony.unicopia.player.PlayerSpeciesList; @@ -46,37 +45,37 @@ public class SpellShield extends AbstractSpell { @Override public void render(Entity source) { - if (UClient.isClientSide()) { - spawnParticles(source.getEntityWorld(), source.posX, source.posY, source.posZ, 4 + (strength * 2)); - } + spawnParticles(source.getEntityWorld(), source.posX, source.posY, source.posZ, 4 + (strength * 2)); } public void renderAt(ICaster source, World w, double x, double y, double z, int level) { - if (UClient.isClientSide()) { - if (w.rand.nextInt(4 + level * 4) == 0) { - spawnParticles(w, x, y, z, 4 + (level * 2)); - } + if (w.rand.nextInt(4 + level * 4) == 0) { + spawnParticles(w, x, y, z, 4 + (level * 2)); } } protected void spawnParticles(World w, double x, double y, double z, int strength) { IShape sphere = new Sphere(true, strength); - Vec3d pos = sphere.computePoint(w.rand); - Particles.instance().spawnParticle(Unicopia.MAGIC_PARTICLE, false, - pos.x + x, pos.y + y, pos.z + z, - 0, 0, 0); + for (int i = 0; i < strength; i++) { + Vec3d pos = sphere.computePoint(w.rand); + Particles.instance().spawnParticle(Unicopia.MAGIC_PARTICLE, false, + pos.x + x, pos.y + y, pos.z + z, + 0, 0, 0); + } } @Override public boolean update(Entity source) { applyEntities(null, source, source.getEntityWorld(), source.posX, source.posY, source.posZ, strength); + if (source.getEntityWorld().getWorldTime() % 50 == 0) { double radius = 4 + (strength * 2); if (!IPower.takeFromPlayer((EntityPlayer)source, radius/4)) { setDead(); } } + return !isDead; } @@ -90,7 +89,7 @@ public class SpellShield extends AbstractSpell { AxisAlignedBB bb = new AxisAlignedBB(x - radius, y - radius, z - radius, x + radius, y + radius, z + radius); - for (Entity i : w.getEntitiesWithinAABBExcludingEntity(source.getEntity(), bb)) { + for (Entity i : w.getEntitiesWithinAABBExcludingEntity(source == null ? null : source.getEntity(), bb)) { if ((!i.equals(owner) || (owner instanceof EntityPlayer && !PlayerSpeciesList.instance().getPlayer((EntityPlayer)owner).getPlayerSpecies().canCast()))) { diff --git a/src/main/java/come/minelittlepony/unicopia/forgebullshit/DefaultPlayerCapabilitiesProxyContainer.java b/src/main/java/come/minelittlepony/unicopia/forgebullshit/DefaultPlayerCapabilitiesProxyContainer.java index 19a1fb2b..62a60b6b 100644 --- a/src/main/java/come/minelittlepony/unicopia/forgebullshit/DefaultPlayerCapabilitiesProxyContainer.java +++ b/src/main/java/come/minelittlepony/unicopia/forgebullshit/DefaultPlayerCapabilitiesProxyContainer.java @@ -3,6 +3,7 @@ package come.minelittlepony.unicopia.forgebullshit; import com.minelittlepony.unicopia.player.IPlayer; import com.minelittlepony.unicopia.player.PlayerSpeciesList; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; @@ -16,6 +17,10 @@ class DefaultPlayerCapabilitiesProxyContainer implements IPlayerCapabilitiesProx @Override public IPlayer getPlayer() { + if (player == null) { + player = PlayerSpeciesList.instance().emptyPlayer(null); + } + return player; } @@ -25,18 +30,20 @@ class DefaultPlayerCapabilitiesProxyContainer implements IPlayerCapabilitiesProx } public void writeToNBT(NBTTagCompound compound) { - if (player == null) { - return; - } - - player.writeToNBT(compound); + getPlayer().writeToNBT(compound); } public void readFromNBT(NBTTagCompound compound) { - if (player == null) { - player = PlayerSpeciesList.instance().emptyPlayer(null); + getPlayer().readFromNBT(compound); + } + + public IPlayerCapabilitiesProxyContainer withEntity(EntityPlayer player) { + if (this.player == null) { + this.player = PlayerSpeciesList.instance().emptyPlayer(player); + } else { + getPlayer().setOwner(player); } - player.readFromNBT(compound); + return this; } } diff --git a/src/main/java/come/minelittlepony/unicopia/forgebullshit/FBS.java b/src/main/java/come/minelittlepony/unicopia/forgebullshit/FBS.java index 27653832..cf7cd078 100644 --- a/src/main/java/come/minelittlepony/unicopia/forgebullshit/FBS.java +++ b/src/main/java/come/minelittlepony/unicopia/forgebullshit/FBS.java @@ -17,7 +17,7 @@ public class FBS { public static void attach(AttachCapabilitiesEvent event) { if (event.getObject() instanceof EntityPlayer) { - event.addCapability(new ResourceLocation("unicopia", "race"), new Provider()); + event.addCapability(new ResourceLocation("unicopia", "race"), new Provider((EntityPlayer)event.getObject())); } } @@ -30,12 +30,12 @@ public class FBS { final IPlayerCapabilitiesProxyContainer clone = of(event.getEntity()); - clone.setPlayer(original.getPlayer()); + clone.getPlayer().copyFrom(original.getPlayer()); } public static IPlayerCapabilitiesProxyContainer of(Entity entity) { if (entity.hasCapability(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, EnumFacing.DOWN)) { - return entity.getCapability(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, EnumFacing.DOWN); + return entity.getCapability(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, EnumFacing.DOWN).withEntity((EntityPlayer)entity); } return null; diff --git a/src/main/java/come/minelittlepony/unicopia/forgebullshit/IPlayerCapabilitiesProxyContainer.java b/src/main/java/come/minelittlepony/unicopia/forgebullshit/IPlayerCapabilitiesProxyContainer.java index 5a064632..0350007a 100644 --- a/src/main/java/come/minelittlepony/unicopia/forgebullshit/IPlayerCapabilitiesProxyContainer.java +++ b/src/main/java/come/minelittlepony/unicopia/forgebullshit/IPlayerCapabilitiesProxyContainer.java @@ -3,8 +3,12 @@ package come.minelittlepony.unicopia.forgebullshit; import com.minelittlepony.unicopia.InbtSerialisable; import com.minelittlepony.unicopia.player.IPlayer; +import net.minecraft.entity.player.EntityPlayer; + public interface IPlayerCapabilitiesProxyContainer extends InbtSerialisable { IPlayer getPlayer(); void setPlayer(IPlayer player); + + IPlayerCapabilitiesProxyContainer withEntity(EntityPlayer player); } diff --git a/src/main/java/come/minelittlepony/unicopia/forgebullshit/NoNameSpacedResource.java b/src/main/java/come/minelittlepony/unicopia/forgebullshit/NoNameSpacedResource.java new file mode 100644 index 00000000..b3663d51 --- /dev/null +++ b/src/main/java/come/minelittlepony/unicopia/forgebullshit/NoNameSpacedResource.java @@ -0,0 +1,35 @@ +package come.minelittlepony.unicopia.forgebullshit; + +import net.minecraft.util.ResourceLocation; + +public class NoNameSpacedResource extends ResourceLocation { + + public static ResourceLocation[] ofAll(String...strings) { + ResourceLocation[] resources = new ResourceLocation[strings.length]; + + for (int i = 0; i < strings.length; i++) { + resources[i] = new NoNameSpacedResource(strings[i]); + } + + return resources; + } + + public static ResourceLocation[] ofAllDomained(String domain, String...strings) { + ResourceLocation[] resources = new ResourceLocation[strings.length]; + + for (int i = 0; i < strings.length; i++) { + resources[i] = new ResourceLocation(domain, strings[i]); + } + + return resources; + } + + public NoNameSpacedResource(String path) { + super(path); + } + + @Override + public String toString() { + return getPath(); + } +} diff --git a/src/main/java/come/minelittlepony/unicopia/forgebullshit/Provider.java b/src/main/java/come/minelittlepony/unicopia/forgebullshit/Provider.java index 90bf06f0..0cc0b361 100644 --- a/src/main/java/come/minelittlepony/unicopia/forgebullshit/Provider.java +++ b/src/main/java/come/minelittlepony/unicopia/forgebullshit/Provider.java @@ -1,5 +1,6 @@ package come.minelittlepony.unicopia.forgebullshit; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; @@ -8,6 +9,12 @@ import net.minecraftforge.common.capabilities.ICapabilitySerializable; class Provider implements ICapabilitySerializable { DefaultPlayerCapabilitiesProxyContainer instance = (DefaultPlayerCapabilitiesProxyContainer) DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.getDefaultInstance(); + private final EntityPlayer entity; + + Provider(EntityPlayer entity) { + this.entity = entity; + } + @Override public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == DefaultPlayerCapabilitiesProxyContainer.CAPABILITY; @@ -16,7 +23,7 @@ class Provider implements ICapabilitySerializable { @Override public T getCapability(Capability capability, EnumFacing facing) { if (hasCapability(capability, facing)) { - return DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.cast(instance); + return DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.cast(instance.withEntity(entity)); } return null; @@ -25,12 +32,12 @@ class Provider implements ICapabilitySerializable { @Override public NBTTagCompound serializeNBT() { return (NBTTagCompound) DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.getStorage() - .writeNBT(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, instance, null); + .writeNBT(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, instance.withEntity(entity), null); } @Override public void deserializeNBT(NBTTagCompound nbt) { DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.getStorage() - .readNBT(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, instance, null, nbt); + .readNBT(DefaultPlayerCapabilitiesProxyContainer.CAPABILITY, instance.withEntity(entity), null, nbt); } } diff --git a/src/main/java/come/minelittlepony/unicopia/forgebullshit/Storage.java b/src/main/java/come/minelittlepony/unicopia/forgebullshit/Storage.java index 3a6b3546..c888646a 100644 --- a/src/main/java/come/minelittlepony/unicopia/forgebullshit/Storage.java +++ b/src/main/java/come/minelittlepony/unicopia/forgebullshit/Storage.java @@ -10,11 +10,7 @@ class Storage implements IStorage { @Override public NBTBase writeNBT(Capability capability, IPlayerCapabilitiesProxyContainer instance, EnumFacing side) { - NBTTagCompound compound = new NBTTagCompound(); - - instance.writeToNBT(compound); - - return compound; + return instance.toNBT(); } @Override diff --git a/src/main/resources/assets/unicopia/lang/en_US.lang b/src/main/resources/assets/unicopia/lang/en_US.lang index 6ebec2b3..7082898f 100644 --- a/src/main/resources/assets/unicopia/lang/en_US.lang +++ b/src/main/resources/assets/unicopia/lang/en_US.lang @@ -50,6 +50,13 @@ commands.race.tell.other.alt=%s is an commands.decloud.success=%s clouds removed commands.decloud.usage=/decloud +unicopia.race.human=Human +unicopia.race.earth=Earth Pony +unicopia.race.unicorn=Unicorn +unicopia.race.pegasus=Pegasus +unicopia.race.alicorn=Alicorn +unicopia.race.changeling=Changeling + unicopia.category.name=Pony Abilities unicopia.power.grow=Earth Pony (Primary) diff --git a/src/main/resources/assets/unicopia/models/item/apple.json b/src/main/resources/assets/unicopia/models/item/apple.json new file mode 100644 index 00000000..1546c02f --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/apple.json @@ -0,0 +1,6 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "minecraft:items/apple" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/apple_green.json b/src/main/resources/assets/unicopia/models/item/apple_green.json new file mode 100644 index 00000000..5d51eec6 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/apple_green.json @@ -0,0 +1,6 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "unicopia:items/apple_green" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/apple_rotten.json b/src/main/resources/assets/unicopia/models/item/apple_rotten.json new file mode 100644 index 00000000..d906c506 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/apple_rotten.json @@ -0,0 +1,6 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "unicopia:items/apple_rotten" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/apple_sweet.json b/src/main/resources/assets/unicopia/models/item/apple_sweet.json new file mode 100644 index 00000000..47b47750 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/apple_sweet.json @@ -0,0 +1,6 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "unicopia:items/apple_sweet" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/apple_zap.json b/src/main/resources/assets/unicopia/models/item/apple_zap.json new file mode 100644 index 00000000..bf37d6da --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/apple_zap.json @@ -0,0 +1,6 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "unicopia:items/apple_zap" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/apple_zap_cooked.json b/src/main/resources/assets/unicopia/models/item/apple_zap_cooked.json new file mode 100644 index 00000000..a080ddc6 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/apple_zap_cooked.json @@ -0,0 +1,6 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "unicopia:items/apple_zap_cooked" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/cloud.json b/src/main/resources/assets/unicopia/models/item/cloud.json deleted file mode 100644 index cd6cd2b7..00000000 --- a/src/main/resources/assets/unicopia/models/item/cloud.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "unicopia:items/cloud" - }, - "display": { - "thirdperson": { - "rotation": [ -90, 0, 0 ], - "translation": [ 0, 1, -3 ], - "scale": [ 0.55, 0.55, 0.55 ] - }, - "firstperson": { - "rotation": [ 0, -135, 25 ], - "translation": [ 0, 4, 2 ], - "scale": [ 1.7, 1.7, 1.7 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/cloud_large.json b/src/main/resources/assets/unicopia/models/item/cloud_large.json deleted file mode 100644 index 8caf074c..00000000 --- a/src/main/resources/assets/unicopia/models/item/cloud_large.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "textures": { - "top": "unicopia:blocks/cloud_normal", - "bottom": "unicopia:blocks/cloud_normal", - "side": "unicopia:blocks/cloud_normal" - }, - "elements": [ - { "from": [ 0, 0, 0 ], - "to": [ 16, 8, 16 ], - "faces": { - "down": { "uv": [ 1, 1, 15, 15 ], "texture": "#bottom", "cullface": "down" }, - "up": { "uv": [ 1, 1, 15, 15 ], "texture": "#top" }, - "north": { "uv": [ 0, 4, 16, 12 ], "texture": "#side", "cullface": "north" }, - "south": { "uv": [ 0, 4, 16, 12 ], "texture": "#side", "cullface": "south" }, - "west": { "uv": [ 0, 4, 16, 12 ], "texture": "#side", "cullface": "west" }, - "east": { "uv": [ 0, 4, 16, 12 ], "texture": "#side", "cullface": "east" } - } - } - ], - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/cloud_matter.json b/src/main/resources/assets/unicopia/models/item/cloud_matter.json deleted file mode 100644 index 3d8fed7e..00000000 --- a/src/main/resources/assets/unicopia/models/item/cloud_matter.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "unicopia:items/cloud_matter" - }, - "display": { - "thirdperson": { - "rotation": [ -90, 0, 0 ], - "translation": [ 0, 1, -3 ], - "scale": [ 0.55, 0.55, 0.55 ] - }, - "firstperson": { - "rotation": [ 0, -135, 25 ], - "translation": [ 0, 4, 2 ], - "scale": [ 1.7, 1.7, 1.7 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/cloud_med.json b/src/main/resources/assets/unicopia/models/item/cloud_med.json deleted file mode 100644 index d35bfb5c..00000000 --- a/src/main/resources/assets/unicopia/models/item/cloud_med.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "parent": "unicopia:item/cloud_large", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.25, 0.25, 0.25 ] - }, - "firstperson": { - "scale": [ 0.7, 0.7, 0.7 ] - }, - "gui": { - "scale": [ 0.7, 0.7, 0.7 ] - } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/item/cloud_small.json b/src/main/resources/assets/unicopia/models/item/cloud_small.json deleted file mode 100644 index 47fd3b7f..00000000 --- a/src/main/resources/assets/unicopia/models/item/cloud_small.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "parent": "unicopia:item/cloud_large", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.15, 0.15, 0.15 ] - }, - "firstperson": { - "scale": [ 0.5, 0.5, 0.5 ] - }, - "gui": { - "scale": [ 0.5, 0.5, 0.5 ] - } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/unicopia/models/item/cloud_stairs.json b/src/main/resources/assets/unicopia/models/item/cloud_stairs.json deleted file mode 100644 index 6ef53b10..00000000 --- a/src/main/resources/assets/unicopia/models/item/cloud_stairs.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "parent": "unicopia:block/cloud_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/enchanted_cloud.json b/src/main/resources/assets/unicopia/models/item/enchanted_cloud.json deleted file mode 100644 index 6f24bde5..00000000 --- a/src/main/resources/assets/unicopia/models/item/enchanted_cloud.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "unicopia:block/enchanted_cloud", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/enchanted_cloud_slab.json b/src/main/resources/assets/unicopia/models/item/enchanted_cloud_slab.json deleted file mode 100644 index 52913f8c..00000000 --- a/src/main/resources/assets/unicopia/models/item/enchanted_cloud_slab.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "unicopia:block/half_slab_enchanted_cloud", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/normal_cloud.json b/src/main/resources/assets/unicopia/models/item/normal_cloud.json deleted file mode 100644 index 222bbd06..00000000 --- a/src/main/resources/assets/unicopia/models/item/normal_cloud.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "unicopia:block/normal_cloud", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/normal_cloud_slab.json b/src/main/resources/assets/unicopia/models/item/normal_cloud_slab.json deleted file mode 100644 index 5e9d4e1b..00000000 --- a/src/main/resources/assets/unicopia/models/item/normal_cloud_slab.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "unicopia:block/half_slab_normal_cloud", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/packed_cloud.json b/src/main/resources/assets/unicopia/models/item/packed_cloud.json deleted file mode 100644 index 49bc498d..00000000 --- a/src/main/resources/assets/unicopia/models/item/packed_cloud.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "unicopia:block/packed_cloud", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/packed_cloud_slab.json b/src/main/resources/assets/unicopia/models/item/packed_cloud_slab.json deleted file mode 100644 index 2d1617b5..00000000 --- a/src/main/resources/assets/unicopia/models/item/packed_cloud_slab.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parent": "unicopia:block/half_slab_packed_cloud", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/spell.json b/src/main/resources/assets/unicopia/models/item/spell.json deleted file mode 100644 index b50f90a1..00000000 --- a/src/main/resources/assets/unicopia/models/item/spell.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "unicopia:items/gem", - "layer1": "unicopia:items/gem_overlay" - }, - "display": { - "thirdperson": { - "rotation": [ -90, 0, 0 ], - "translation": [ 0, 1, -3 ], - "scale": [ 0.55, 0.55, 0.55 ] - }, - "firstperson": { - "rotation": [ 0, -135, 25 ], - "translation": [ 0, 4, 2 ], - "scale": [ 1.7, 1.7, 1.7 ] - } - } -} diff --git a/src/main/resources/assets/unicopia/models/item/spellbook.json b/src/main/resources/assets/unicopia/models/item/spellbook.json deleted file mode 100644 index 82e46601..00000000 --- a/src/main/resources/assets/unicopia/models/item/spellbook.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "parent": "builtin/generated", - "textures": { - "layer0": "unicopia:items/spellbook" - }, - "display": { - "thirdperson": { - "rotation": [ -90, 0, 0 ], - "translation": [ 0, 1, -3 ], - "scale": [ 0.55, 0.55, 0.55 ] - }, - "firstperson": { - "rotation": [ 0, -135, 25 ], - "translation": [ 0, 4, 2 ], - "scale": [ 1.7, 1.7, 1.7 ] - } - } -}