use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class MaterialAbsorberBlock method getWailaBody.
@SideOnly(Side.CLIENT)
@Override
@Optional.Method(modid = "waila")
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
super.getWailaBody(itemStack, currenttip, accessor, config);
MaterialAbsorberTileEntity tileEntity = (MaterialAbsorberTileEntity) accessor.getTileEntity();
if (tileEntity != null && tileEntity.getBlockState() != null) {
Block block = tileEntity.getBlockState().getBlock();
int meta = block.getMetaFromState(tileEntity.getBlockState());
int absorbing = tileEntity.getAbsorbing();
int pct = ((DimletConstructionConfiguration.maxBlockAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxBlockAbsorbtion;
currenttip.add(TextFormatting.GREEN + "Block: " + new ItemStack(block, 1, meta).getDisplayName() + " (" + pct + "%)");
}
return currenttip;
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class MaterialAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null && tagCompound.hasKey("block")) {
Block block = Block.REGISTRY.getObject(new ResourceLocation(tagCompound.getString("block")));
if (block != null) {
int meta = tagCompound.getInteger("meta");
if (Item.getItemFromBlock(block) == null) {
list.add(TextFormatting.RED + "Block: ERROR");
} else {
list.add(TextFormatting.GREEN + "Block: " + new ItemStack(block, 1, meta).getDisplayName());
}
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxBlockAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxBlockAbsorbtion;
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block on top of another block and it will");
list.add(TextFormatting.WHITE + "gradually absorb all identical blocks in the area.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class TerrainAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null && tagCompound.hasKey("terrain")) {
String terrainName = tagCompound.getString("terrain");
list.add(TextFormatting.GREEN + "Terrain: " + terrainName);
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxTerrainAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTerrainAbsorbtion;
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block in an area and it will");
list.add(TextFormatting.WHITE + "gradually absorb the essence of the terrain it is in.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class TimeAbsorberBlock method addInformation.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
super.addInformation(itemStack, player, list, whatIsThis);
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null) {
if (tagCompound.hasKey("angle") && tagCompound.getFloat("angle") > -0.001f) {
float angle = tagCompound.getFloat("angle");
DimletKey key = TimeAbsorberTileEntity.findBestTimeDimlet(angle);
String name = KnownDimletConfiguration.getDisplayName(key);
if (name == null) {
name = "<unknown>";
}
list.add(TextFormatting.GREEN + "Dimlet: " + name + " (" + angle + ")");
int absorbing = tagCompound.getInteger("absorbing");
int pct = ((DimletConstructionConfiguration.maxTimeAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxTimeAbsorbtion;
list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
int timeout = tagCompound.getInteger("registerTimeout");
list.add(TextFormatting.GREEN + "Timeout: " + timeout);
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
list.add(TextFormatting.WHITE + "Place this block outside and give it a redstone");
list.add(TextFormatting.WHITE + "signal around the time that you want to absorb.");
list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class RfToolsDimensionManager method syncFromServer.
@SideOnly(Side.CLIENT)
public void syncFromServer(Map<Integer, DimensionDescriptor> dims, Map<Integer, DimensionInformation> dimInfo) {
for (Map.Entry<Integer, DimensionDescriptor> entry : dims.entrySet()) {
int id = entry.getKey();
DimensionDescriptor descriptor = entry.getValue();
if (dimensions.containsKey(id)) {
dimensionToID.remove(dimensions.get(id));
}
dimensions.put(id, descriptor);
dimensionToID.put(descriptor, id);
}
WorldClient world = Minecraft.getMinecraft().world;
GenericWorldProvider provider = (world != null && world.provider instanceof GenericWorldProvider) ? (GenericWorldProvider) world.provider : null;
for (Map.Entry<Integer, DimensionInformation> entry : dimInfo.entrySet()) {
int id = entry.getKey();
DimensionInformation info = entry.getValue();
dimensionInformation.put(id, info);
if (provider != null && provider.getDimension() == id) {
provider.setDimensionInformation(info);
}
}
}
Aggregations