@Override public String valueToString( EnumFacing value ) { return value.getName(); }
protected String getSideText(EnumFacing side) { return side.getName().toLowerCase(Locale.ENGLISH); }
@Nonnull @Override public Set<String> getTransferLocations(@Nonnull ICapabilityProvider object) { HashSet<String> items = new HashSet<>(6); for (EnumFacing item : EnumFacing.VALUES) { items.add(item.getName() + "_side"); } return items; } }
public TransferSidedCapability() { Map<String, EnumFacing> mappings = this.mappings = Maps.newHashMap(); mappings.put("bottom_side", EnumFacing.DOWN); mappings.put("top_side", EnumFacing.UP); for (EnumFacing facing : EnumFacing.VALUES) { mappings.put(facing.getName() + "_side", facing); } }
public TransferTileEntity() { Map<String, EnumFacing> mappings = this.mappings = Maps.newHashMap(); mappings.put("below", EnumFacing.DOWN); mappings.put("above", EnumFacing.UP); for (EnumFacing facing : EnumFacing.VALUES) { mappings.put(facing.getName(), facing); } }
@Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); labelText = compound.getString("label"); labelTimer = compound.getInteger("labelt"); for (EnumFacing f : EnumFacing.values()) { mapIncomingItems.put(f, compound.getInteger(f.getName() + "_incoming")); mapIncomingFluid.put(f, compound.getInteger(f.getName() + "_incfluid")); mapIncomingEnergy.put(f, compound.getInteger(f.getName() + "_incenergy")); mapBlacklist.put(f, compound.getBoolean(f.getName() + "_blocked")); } }
private ModelResourceLocation getModelLocation(ResourceLocation resource, EnumFacing facing, Oyster oyster) { return new ModelResourceLocation(resource, String.format("facing=%s,oyster=%s", facing.getName(), oyster.getName())); } }
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { writeStackWrappers(stacksWrapped, compound); for (EnumFacing f : EnumFacing.values()) { compound.setInteger(f.getName() + "_incoming", mapIncoming.get(f)); compound.setInteger(f.getName() + "_toggle", allowEverything.get(f)); compound.setInteger(f.getName() + "_damage", ignoreDamageIfOne.get(f)); } compound.setString("label", labelText); compound.setInteger("labelt", labelTimer); return super.writeToNBT(compound); }
@Override public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { String translate = "enumfacing." + accessor.getBlockState().getValue(BlockTunnel.MACHINE_SIDE).getName(); currenttip.add(TextFormatting.YELLOW + I18n.format(translate) + TextFormatting.RESET); return currenttip; } }
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); for (EnumFacing f : EnumFacing.values()) { compound.setBoolean(f.getName() + "_blocked", mapBlacklist.get(f)); } return compound; }
@Override public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { String translate = "enumfacing." + accessor.getBlockState().getValue(BlockRedstoneTunnel.MACHINE_SIDE).getName(); currenttip.add(TextFormatting.YELLOW + I18n.format(translate) + TextFormatting.RESET); return currenttip; } }
@Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); for (EnumFacing f : EnumFacing.values()) { mapBlacklist.put(f, compound.getBoolean(f.getName() + "_blocked")); } }
@Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); power = compound.getInteger("power"); if (power <= 0) { power = 1000; } poweredSides = new HashMap<EnumFacing, Boolean>(); for (EnumFacing f : EnumFacing.values()) { poweredSides.put(f, compound.getBoolean(f.getName())); } } }
@Nonnull @Override public Map<IBlockState, ModelResourceLocation> getStateModelLocations() { Map<IBlockState, ModelResourceLocation> locationMap = new HashMap<>(); for (EnumFacing facing : FACING.getAllowedValues()) { locationMap.put(getDefaultState().withProperty(FACING, facing), new ModelResourceLocation(getRegistryName(), "facing=" + facing.getName())); } return locationMap; } }
/** * Write the given part type to nbt. * @param partTag The tag to write to. * @param side The side to write. * @param partType The part type to write. */ public static void writePartTypeToNBT(NBTTagCompound partTag, EnumFacing side, IPartType partType) { partTag.setString("__partType", partType.getName()); partTag.setString("__side", side.getName()); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setInteger("power", power); for (EnumFacing f : EnumFacing.values()) { compound.setBoolean(f.getName(), poweredSides.get(f)); } return super.writeToNBT(compound); }
public String getStringRepresentation() { EnumFacing facing = getSide(); String s = facing == null ? "" : StringUtils.left(facing.getName().toUpperCase(), 1); if (getNodeName() == null) { return s; } else { return StringUtils.left(getNodeName(), 7) + " " + s; } }
public static String blockSideToString(BlockSide bc) { String s; if (bc.getSide() == null) { s = "*"; } else { s = StringUtils.left(bc.getSide().getName().toUpperCase(), 1); } if (bc.getNodeName() == null) { return s; } else { return bc.getNodeName() + " " + s; } }
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { compound.setInteger("off", timeOff); compound.setInteger("on", timeOn); compound.setInteger("power", power); compound.setInteger(NBT_REDST, needsRedstone); for (EnumFacing f : EnumFacing.values()) { compound.setBoolean(f.getName(), poweredSides.get(f)); } return super.writeToNBT(compound); }