use of com.mraof.minestuck.entity.EntityDecoy in project Minestuck by mraof.
the class ServerEditHandler method newServerEditor.
public static void newServerEditor(EntityPlayerMP player, PlayerIdentifier computerOwner, PlayerIdentifier computerTarget) {
if (player.isRiding())
// Don't want to bother making the decoy able to ride anything right now.
return;
SburbConnection c = SkaianetHandler.getClientConnection(computerTarget);
if (c != null && c.getServerIdentifier().equals(computerOwner) && getData(c) == null && getData(player) == null) {
Debug.info("Activating edit mode on player \"" + player.getName() + "\", target player: \"" + computerTarget + "\".");
EntityDecoy decoy = new EntityDecoy((WorldServer) player.world, player);
EditData data = new EditData(decoy, player, c);
if (!c.enteredGame()) {
c.centerX = c.getClientData().getX();
c.centerZ = c.getClientData().getZ();
}
if (!setPlayerStats(player, c)) {
player.sendMessage(new TextComponentString(TextFormatting.RED + "Failed to activate edit mode."));
return;
}
if (c.inventory != null)
player.inventory.readFromNBT(c.inventory);
decoy.world.spawnEntity(decoy);
list.add(data);
MinestuckPacket packet = MinestuckPacket.makePacket(Type.SERVER_EDIT, computerTarget, c.centerX, c.centerZ, c.givenItems());
MinestuckChannelHandler.sendToPlayer(packet, player);
MinestuckPlayerTracker.updateGristCache(c.getClientIdentifier());
}
}
use of com.mraof.minestuck.entity.EntityDecoy in project Minestuck by mraof.
the class ClientProxy method preInit.
@Override
public void preInit() {
RenderingRegistry.registerEntityRenderingHandler(EntityNakagator.class, RenderEntityMinestuck.getFactory(new ModelNakagator(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntitySalamander.class, RenderEntityMinestuck.getFactory(new ModelSalamander(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityIguana.class, RenderEntityMinestuck.getFactory(new ModelIguana(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityTurtle.class, RenderEntityMinestuck.getFactory(new ModelTurtle(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityImp.class, RenderEntityMinestuck.getFactory(new ModelImp(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityOgre.class, RenderEntityMinestuck.getFactory(new ModelOgre(), 2.8F));
RenderingRegistry.registerEntityRenderingHandler(EntityBasilisk.class, RenderEntityMinestuck.getFactory(new ModelBasilisk(), 2.8F));
RenderingRegistry.registerEntityRenderingHandler(EntityLich.class, RenderEntityMinestuck.getFactory(new ModelLich(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityGiclops.class, RenderEntityMinestuck.getFactory(new ModelGiclops(), 7.6F));
RenderingRegistry.registerEntityRenderingHandler(EntityBishop.class, RenderEntityMinestuck.getFactory(new ModelBishop(), 1.8F));
RenderingRegistry.registerEntityRenderingHandler(EntityRook.class, RenderEntityMinestuck.getFactory(new ModelRook(), 2.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityUnderlingPart.class, new IRenderFactory<EntityUnderlingPart>() {
@Override
public Render<EntityUnderlingPart> createRenderFor(RenderManager manager) {
return new RenderShadow(manager, 2.8F);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityBigPart.class, new IRenderFactory<EntityBigPart>() {
@Override
public Render<EntityBigPart> createRenderFor(RenderManager manager) {
return new RenderShadow(manager, 0F);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityPawn.class, new IRenderFactory<EntityPawn>() {
@Override
public Render<EntityPawn> createRenderFor(RenderManager manager) {
return new RenderPawn(manager, new ModelBiped(), 0.5F);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityGrist.class, new IRenderFactory<EntityGrist>() {
@Override
public Render<EntityGrist> createRenderFor(RenderManager manager) {
return new RenderGrist(manager);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityVitalityGel.class, new IRenderFactory<EntityVitalityGel>() {
@Override
public Render<EntityVitalityGel> createRenderFor(RenderManager manager) {
return new RenderVitalityGel(manager);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityDecoy.class, new IRenderFactory<EntityDecoy>() {
@Override
public Render<EntityDecoy> createRenderFor(RenderManager manager) {
return new RenderDecoy(manager);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityMetalBoat.class, new IRenderFactory<EntityBoat>() {
@Override
public Render<EntityBoat> createRenderFor(RenderManager manager) {
return new RenderMetalBoat(manager);
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityCrewPoster.class, new IRenderFactory<EntityCrewPoster>() {
@Override
public Render<EntityCrewPoster> createRenderFor(RenderManager manager) {
return new RenderHangingArt<>(manager, "midnight_poster");
}
});
RenderingRegistry.registerEntityRenderingHandler(EntitySbahjPoster.class, new IRenderFactory<EntitySbahjPoster>() {
@Override
public Render<EntitySbahjPoster> createRenderFor(RenderManager manager) {
return new RenderHangingArt<>(manager, "sbahj_poster");
}
});
MinecraftForge.EVENT_BUS.register(new MinestuckKeyHandler());
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
MinecraftForge.EVENT_BUS.register(MinestuckModelManager.class);
}
use of com.mraof.minestuck.entity.EntityDecoy in project Minestuck by mraof.
the class ServerEditHandler method reset.
/**
* Called when the server stops editing the clients house.
* @param damageSource If the process was cancelled by the decoy taking damage, this parameter will be the damage source. Else null.
* @param damage If the damageSource isn't null, this is the damage taken, else this parameter is ignored.
* @param data editdata to identify the editmode session
*/
public static void reset(DamageSource damageSource, float damage, EditData data) {
if (data == null)
return;
list.remove(data);
EntityPlayerMP player = data.player;
player.closeScreen();
EntityDecoy decoy = data.decoy;
if (player.dimension != decoy.dimension)
if (!Teleport.teleportEntity(player, decoy.dimension, null)) {
list.add(data);
throw new IllegalStateException("Was not able to reset editmode player for " + player.getName() + "! Likely caused by mod collision.");
}
data.connection.useCoordinates = true;
data.connection.posX = player.posX;
data.connection.posZ = player.posZ;
player.setGameType(decoy.gameType);
player.connection.setPlayerLocation(decoy.posX, decoy.posY, decoy.posZ, decoy.rotationYaw, decoy.rotationPitch);
player.capabilities.readCapabilitiesFromNBT(decoy.capabilities);
player.sendPlayerAbilities();
player.fallDistance = 0;
player.setHealth(decoy.getHealth());
NBTTagCompound nbt = new NBTTagCompound();
decoy.foodStats.writeNBT(nbt);
player.getFoodStats().readNBT(nbt);
data.connection.inventory = player.inventory.writeToNBT(new NBTTagList());
player.inventory.copyInventory(decoy.inventory);
decoy.markedForDespawn = true;
MinestuckPacket packet = MinestuckPacket.makePacket(Type.SERVER_EDIT);
MinestuckChannelHandler.sendToPlayer(packet, player);
if (damageSource != null && damageSource.getImmediateSource() != player)
player.attackEntityFrom(damageSource, damage);
}
Aggregations