mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed networking, npe when ticking players, fixed various abilities, fixed values not being syncronised between the client and server, re-added the various apples
This commit is contained in:
parent
c36402b4d9
commit
5ce8d4a492
51 changed files with 490 additions and 392 deletions
|
@ -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<Integer, Race> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Item> 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<Entity> event) {
|
||||
// Why won't you run!?
|
||||
FBS.attach(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<MsgPlayerAbility> {
|
||||
|
||||
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 <T extends IData> void apply(IPower<T> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<MsgPlayerCapabilities> {
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<MsgRequestCapabilities> {
|
||||
@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);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,22 @@ public interface IPlayer extends ICaster<EntityPlayer>, 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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<EntityPlayer> {
|
||||
|
||||
private Race playerSpecies = Race.HUMAN;
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
private static final DataParameter<Integer> PLAYER_RACE = EntityDataManager
|
||||
.createKey(EntityPlayer.class, DataSerializers.VARINT);
|
||||
|
||||
private final PlayerAbilityDelegate powers = new PlayerAbilityDelegate(this);
|
||||
|
||||
|
@ -25,31 +37,46 @@ class PlayerCapabilities implements IPlayer, ICaster<EntityPlayer> {
|
|||
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();
|
||||
|
||||
if (self != null) {
|
||||
getOwner().getDataManager().set(PLAYER_RACE, race.ordinal());
|
||||
|
||||
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<EntityPlayer> {
|
|||
|
||||
@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) {
|
||||
if (!getPlayerSpecies().canCast()) {
|
||||
setEffect(null);
|
||||
} else {
|
||||
if (entity.getEntityWorld().isRemote) { // && entity.getEntityWorld().getWorldTime() % 10 == 0
|
||||
effect.render(entity);
|
||||
}
|
||||
|
||||
if (!effect.update(entity)) {
|
||||
effect = null;
|
||||
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<EntityPlayer> {
|
|||
|
||||
@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<EntityPlayer> {
|
|||
|
||||
@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"));
|
||||
|
||||
if (compound.hasKey("effect_id") && compound.hasKey("effect")) {
|
||||
effect = null;
|
||||
|
||||
if (compound.hasKey("effect_id") && compound.hasKey("effect")) {
|
||||
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<EntityPlayer> {
|
|||
}
|
||||
}
|
||||
|
||||
@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<EntityPlayer> {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
entity.capabilities.allowFlying = player.getPlayerSpecies().canFly();
|
||||
entity.capabilities.isFlying = false;
|
||||
}
|
||||
}
|
||||
if (!entity.capabilities.isCreativeMode && !entity.isElytraFlying()) {
|
||||
if (entity.capabilities.isFlying && !entity.isRiding()) {
|
||||
|
||||
if (entity.capabilities.isFlying) {
|
||||
entity.fallDistance = 0;
|
||||
|
||||
float exhaustion = (0.2F * ticksInAir++) / 100;
|
||||
if (entity.isSprinting()) {
|
||||
exhaustion *= 3.11F;
|
||||
}
|
||||
|
||||
entity.addExhaustion(exhaustion * (1 - flightExperience));
|
||||
|
||||
if (entity.ticksExisted % 20000 == 0) {
|
||||
addFlightExperience(entity);
|
||||
}
|
||||
} else {
|
||||
ticksInAir = 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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<T extends IData> extends IKeyBind {
|
||||
|
||||
|
@ -41,19 +40,19 @@ public interface IPower<T extends IData> 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,
|
||||
player.posX + point.x,
|
||||
middle + point.y,
|
||||
player.posZ + point.z,
|
||||
0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -109,21 +108,18 @@ public interface IPower<T extends IData> 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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Hit> {
|
|||
return e instanceof EntityCow
|
||||
|| e instanceof EntityVillager
|
||||
|| e instanceof EntityPlayer
|
||||
|| e instanceof EntitySheep
|
||||
|| EnumCreatureType.MONSTER.getCreatureClass().isAssignableFrom(e.getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -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,7 +85,6 @@ public class PowerGrow implements IPower<Location> {
|
|||
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);
|
||||
|
||||
|
@ -93,10 +93,6 @@ public class PowerGrow implements IPower<Location> {
|
|||
}
|
||||
}
|
||||
|
||||
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<Location> {
|
|||
|
||||
@Override
|
||||
public void preApply(EntityPlayer player) {
|
||||
IPower.spawnParticles(com.minelittlepony.unicopia.Unicopia.MAGIC_PARTICLE, player, 1);
|
||||
IPower.spawnParticles(Unicopia.MAGIC_PARTICLE, player, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,9 +25,9 @@ public class PowerMagic implements IPower<PowerMagic.Magic> {
|
|||
|
||||
@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;
|
||||
}
|
||||
|
|
|
@ -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<PowerStomp.Data> {
|
|||
|
||||
@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<PowerStomp.Data> {
|
|||
i.attackEntityFrom(damage, amount);
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<BlockPos> 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<PowerStomp.Data> {
|
|||
}
|
||||
|
||||
protected static class Data extends Location {
|
||||
|
||||
@Expose
|
||||
public int hitType;
|
||||
|
||||
public Data(int x, int y, int z, int hit) {
|
||||
|
|
|
@ -107,15 +107,17 @@ public class PowerTeleport implements IPower<Location> {
|
|||
|
||||
@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<Location> {
|
|||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public interface ICaster<E extends EntityLivingBase> {
|
|||
return getEffect() != null;
|
||||
}
|
||||
|
||||
default void setOwner(EntityLivingBase owner) {
|
||||
default void setOwner(E owner) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@ public class SpellRegistry {
|
|||
private final Map<String, Callable<IMagicEffect>> factories = new HashMap<>();
|
||||
|
||||
private SpellRegistry() {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
registerSpell("shield", SpellShield::new);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void spawnParticles(World w, double x, double y, double z, int strength) {
|
||||
IShape sphere = new Sphere(true, strength);
|
||||
|
||||
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()))) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
player.readFromNBT(compound);
|
||||
public IPlayerCapabilitiesProxyContainer withEntity(EntityPlayer player) {
|
||||
if (this.player == null) {
|
||||
this.player = PlayerSpeciesList.instance().emptyPlayer(player);
|
||||
} else {
|
||||
getPlayer().setOwner(player);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class FBS {
|
|||
|
||||
public static void attach(AttachCapabilitiesEvent<Entity> 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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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<NBTTagCompound> {
|
||||
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<NBTTagCompound> {
|
|||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if (hasCapability(capability, facing)) {
|
||||
return DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.<T>cast(instance);
|
||||
return DefaultPlayerCapabilitiesProxyContainer.CAPABILITY.<T>cast(instance.withEntity(entity));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -25,12 +32,12 @@ class Provider implements ICapabilitySerializable<NBTTagCompound> {
|
|||
@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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,7 @@ class Storage implements IStorage<IPlayerCapabilitiesProxyContainer> {
|
|||
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability<IPlayerCapabilitiesProxyContainer> capability, IPlayerCapabilitiesProxyContainer instance, EnumFacing side) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
instance.writeToNBT(compound);
|
||||
|
||||
return compound;
|
||||
return instance.toNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,6 +50,13 @@ commands.race.tell.other.alt=%s is an
|
|||
commands.decloud.success=%s clouds removed
|
||||
commands.decloud.usage=/decloud <all>
|
||||
|
||||
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)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "minecraft:items/apple"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/apple_green"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/apple_rotten"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/apple_sweet"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/apple_zap"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"textures": {
|
||||
"layer0": "unicopia:items/apple_zap_cooked"
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue