use of net.minecraftforge.fml.relauncher.SideOnly in project MinecraftForge by MinecraftForge.
the class UniversalBucket method getSubItems.
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(@Nonnull Item itemIn, @Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems) {
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
if (fluid != FluidRegistry.WATER && fluid != FluidRegistry.LAVA && !fluid.getName().equals("milk")) {
// add all fluids that the bucket can be filled with
FluidStack fs = new FluidStack(fluid, getCapacity());
ItemStack stack = new ItemStack(this);
IFluidHandlerItem fluidHandler = new FluidBucketWrapper(stack);
if (fluidHandler.fill(fs, true) == fs.amount) {
ItemStack filled = fluidHandler.getContainer();
subItems.add(filled);
}
}
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project MinecraftForge by MinecraftForge.
the class AnimationStateMachine method load.
/**
* Load a new instance if AnimationStateMachine at specified location, with specified custom parameters.
*/
@SideOnly(Side.CLIENT)
public static IAnimationStateMachine load(IResourceManager manager, ResourceLocation location, ImmutableMap<String, ITimeValue> customParameters) {
try {
ClipResolver clipResolver = new ClipResolver();
ParameterResolver parameterResolver = new ParameterResolver(customParameters);
Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(clipResolver);
TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(parameterResolver);
IResource resource = manager.getResource(location);
AnimationStateMachine asm = asmGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), AnimationStateMachine.class);
clipResolver.asm = asm;
parameterResolver.asm = asm;
asm.initialize();
//System.out.println(location + ": " + json);
return asm;
} catch (IOException e) {
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location);
return missing;
} catch (JsonParseException e) {
FMLLog.log(Level.ERROR, e, "Exception loading Animation State Machine %s, skipping", location);
return missing;
} finally {
Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(null);
TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(null);
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project MinecraftForge by MinecraftForge.
the class ForgeNetworkHandler method addClientHandlers.
@SideOnly(Side.CLIENT)
private static void addClientHandlers() {
FMLEmbeddedChannel clientChannel = channelPair.get(Side.CLIENT);
String handlerName = clientChannel.findChannelHandlerNameForType(ForgeRuntimeCodec.class);
clientChannel.pipeline().addAfter(handlerName, "DimensionHandler", new DimensionMessageHandler());
clientChannel.pipeline().addAfter(handlerName, "FluidIdRegistryHandler", new FluidIdRegistryMessageHandler());
}
use of net.minecraftforge.fml.relauncher.SideOnly in project Witchworks by Um-Mitternacht.
the class BrewUtils method addPotionTooltip.
@SideOnly(Side.CLIENT)
public static void addPotionTooltip(ItemStack itemIn, List<String> tooltip, float durationFactor) {
List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemIn);
List<Tuple<String, AttributeModifier>> attributes = Lists.newArrayList();
if (list.isEmpty()) {
String empty = I18n.format("effect.none").trim();
tooltip.add(TextFormatting.GRAY + empty);
} else {
for (PotionEffect effect : list) {
StringBuilder string = new StringBuilder();
string.append(I18n.format(effect.getEffectName()).trim());
Potion potion = effect.getPotion();
Map<IAttribute, AttributeModifier> map = potion.getAttributeModifierMap();
if (!map.isEmpty()) {
for (Map.Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
AttributeModifier attribute = entry.getValue();
attribute = new AttributeModifier(attribute.getName(), potion.getAttributeModifierAmount(effect.getAmplifier(), attribute), attribute.getOperation());
attributes.add(new Tuple<>(entry.getKey().getName(), attribute));
}
}
if (effect.getAmplifier() > 0) {
string.append(" ").append(RomanNumber.getRoman(effect.getAmplifier()));
}
if (effect.getDuration() > 20) {
string.append(" (").append(Potion.getPotionDurationString(effect, durationFactor)).append(")");
}
if (potion.isBadEffect()) {
tooltip.add(TextFormatting.DARK_RED + string.toString());
} else {
tooltip.add(TextFormatting.DARK_BLUE + string.toString());
}
}
}
if (!attributes.isEmpty()) {
tooltip.add("");
tooltip.add(TextFormatting.DARK_PURPLE + I18n.format("potion.whenDrank"));
for (Tuple<String, AttributeModifier> tuple : attributes) {
AttributeModifier modifier = tuple.getSecond();
double amount = modifier.getAmount();
double newAmount;
if (modifier.getOperation() != 1 && modifier.getOperation() != 2) {
newAmount = modifier.getAmount();
} else {
newAmount = modifier.getAmount() * 100.0D;
}
if (amount > 0.0D) {
tooltip.add(TextFormatting.BLUE + I18n.format("attribute.modifier.plus." + modifier.getOperation(), ItemStack.DECIMALFORMAT.format(newAmount), I18n.format("attribute.name." + (String) tuple.getFirst())));
} else if (amount < 0.0D) {
newAmount = newAmount * -1.0D;
tooltip.add(TextFormatting.RED + I18n.format("attribute.modifier.take." + modifier.getOperation(), ItemStack.DECIMALFORMAT.format(newAmount), I18n.format("attribute.name." + (String) tuple.getFirst())));
}
}
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class KeyHandler method playerTick.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void playerTick(PlayerTickEvent event) {
if (event.side == Side.SERVER)
return;
if (event.phase == Phase.START) {
if (ClientPilotingManager.isPlayerPilotingShip()) {
// if(airshipDismount.isKeyDown()){
// PilotShipManager.dismountPlayer();
// }else{
Entity player = Minecraft.getMinecraft().thePlayer;
// player.setPosition(player.posX, player.posY, player.posZ);
ClientPilotingManager.sendPilotKeysToServer();
// }
}
}
}
Aggregations