use of net.minecraft.nbt.NBTTagString in project ct.js by ChatTriggers.
the class Book method setPage.
/**
* Sets a page of the book to the specified message.
*
* @param pageNumber the number of the page to set
* @param message the message to set the page to
* @return the current book to allow method chaining
*/
public Book setPage(int pageNumber, Message message) {
NBTTagList pages = (NBTTagList) bookData.getTag("pages");
pages.set(pageNumber, new NBTTagString(IChatComponent.Serializer.componentToJson(message.getChatMessage())));
updateBookScreen(pages);
return this;
}
use of net.minecraft.nbt.NBTTagString in project ImmersiveEngineering by BluSunrize.
the class TileEntityFeedthrough method getTileDrops.
@Override
public NonNullList<ItemStack> getTileDrops(@Nullable EntityPlayer player, IBlockState state) {
WireApi.FeedthroughModelInfo info = INFOS.get(reference);
if (info.canReplace()) {
if (offset == 0)
return Utils.getDrops(stateForMiddle);
else {
// If it's marked as replaceable it should have a state to replace with
assert info.conn != null;
return NonNullList.from(ItemStack.EMPTY, new ItemStack(info.conn.getBlock(), 1, info.conn.getBlock().getMetaFromState(info.conn)));
}
} else {
ItemStack stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
stack.setTagInfo(WIRE, new NBTTagString(reference.getUniqueName()));
NBTTagCompound stateNbt = new NBTTagCompound();
Utils.stateToNBT(stateNbt, stateForMiddle);
stack.setTagInfo(MIDDLE_STATE, stateNbt);
return NonNullList.from(ItemStack.EMPTY, stack);
}
}
use of net.minecraft.nbt.NBTTagString in project ImmersiveEngineering by BluSunrize.
the class TileEntityTurret method getTileDrop.
@Override
public ItemStack getTileDrop(EntityPlayer player, IBlockState state) {
ItemStack stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
TileEntityTurret turret = this;
if (dummy) {
TileEntity t = world.getTileEntity(getPos().down());
if (t instanceof TileEntityTurret)
turret = (TileEntityTurret) t;
else
return stack;
}
NBTTagCompound tag = new NBTTagCompound();
// Only writing values when they are different from defaults
if (turret.owner != null && (player == null || !player.getName().equalsIgnoreCase(turret.owner)))
tag.setString("owner", turret.owner);
if (turret.targetList.size() != 1 || !isListedName(turret.targetList, turret.owner)) {
NBTTagList list = new NBTTagList();
for (String s : turret.targetList) list.appendTag(new NBTTagString(s));
tag.setTag("targetList", list);
}
if (turret.whitelist)
tag.setBoolean("whitelist", turret.whitelist);
if (turret.attackAnimals)
tag.setBoolean("attackAnimals", turret.attackAnimals);
if (!turret.attackPlayers)
tag.setBoolean("attackPlayers", turret.attackPlayers);
if (turret.attackNeutrals)
tag.setBoolean("attackNeutrals", turret.attackNeutrals);
if (turret.redstoneControlInverted)
tag.setBoolean("redstoneControlInverted", turret.redstoneControlInverted);
if (!tag.isEmpty())
stack.setTagCompound(tag);
return stack;
}
use of net.minecraft.nbt.NBTTagString in project ImmersiveEngineering by BluSunrize.
the class IESaveData method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
Integer[] relDim = ImmersiveNetHandler.INSTANCE.getRelevantDimensions().toArray(new Integer[0]);
int[] savedDimensions = new int[relDim.length];
for (int ii = 0; ii < relDim.length; ii++) savedDimensions[ii] = relDim[ii];
nbt.setIntArray("savedDimensions", savedDimensions);
for (int dim : savedDimensions) {
NBTTagList connectionList = new NBTTagList();
for (Connection con : ImmersiveNetHandler.INSTANCE.getAllConnections(dim)) {
connectionList.appendTag(con.writeToNBT());
}
nbt.setTag("connectionList" + dim, connectionList);
}
NBTTagList proxies = new NBTTagList();
for (IICProxy iic : ImmersiveNetHandler.INSTANCE.proxies.values()) proxies.appendTag(iic.writeToNBT());
nbt.setTag("iicProxies", proxies);
NBTTagList mineralList = new NBTTagList();
for (Map.Entry<DimensionChunkCoords, MineralWorldInfo> e : ExcavatorHandler.mineralCache.entrySet()) if (e.getKey() != null && e.getValue() != null) {
NBTTagCompound tag = e.getKey().writeToNBT();
tag.setTag("info", e.getValue().writeToNBT());
mineralList.appendTag(tag);
}
nbt.setTag("mineralDepletion", mineralList);
NBTTagList receivedShaderList = new NBTTagList();
for (String player : ShaderRegistry.receivedShaders.keySet()) {
NBTTagCompound tag = new NBTTagCompound();
tag.setString("player", player);
NBTTagList playerReceived = new NBTTagList();
for (String shader : ShaderRegistry.receivedShaders.get(player)) if (shader != null && !shader.isEmpty())
playerReceived.appendTag(new NBTTagString(shader));
tag.setTag("received", playerReceived);
receivedShaderList.appendTag(tag);
}
nbt.setTag("receivedShaderList", receivedShaderList);
return nbt;
}
use of net.minecraft.nbt.NBTTagString in project RecurrentComplex by Ivorforce.
the class RCCommunicationAdapter method writeNBTStrings.
public static void writeNBTStrings(String id, Collection<String> strings, NBTTagCompound compound) {
if (strings != null) {
NBTTagList nbtTagList = new NBTTagList();
for (String s : strings) nbtTagList.appendTag(new NBTTagString(s));
compound.setTag(id, nbtTagList);
}
}
Aggregations