use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class DimensionMonitorItem method initModel.
@Override
@SideOnly(Side.CLIENT)
public void initModel() {
for (int i = 0; i <= 8; i++) {
ResourceLocation registryName = getRegistryName();
registryName = new ResourceLocation(registryName.getResourceDomain(), registryName.getResourcePath() + i);
ModelBakery.registerItemVariants(this, new ModelResourceLocation(registryName, "inventory"));
// ModelBakery.addVariantName(this, getRegistryName() + i);
}
ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
WorldClient world = MinecraftTools.getWorld(Minecraft.getMinecraft());
int id = world.provider.getDimension();
DimensionStorage storage = DimensionStorage.getDimensionStorage(world);
int energyLevel = storage.getEnergyLevel(id);
int level = (9 * energyLevel) / PowerConfiguration.MAX_DIMENSION_POWER;
if (level < 0) {
level = 0;
} else if (level > 8) {
level = 8;
}
ResourceLocation registryName = getRegistryName();
registryName = new ResourceLocation(registryName.getResourceDomain(), registryName.getResourcePath() + (8 - level));
return new ModelResourceLocation(registryName, "inventory");
}
});
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class KnownDimlet method addInformation.
// @todo
// @Override
// public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
// if (world.isRemote) {
// return stack;
// }
//
// DimletKey key = KnownDimletConfiguration.getDimletKey(stack, world);
// DimletEntry entry = KnownDimletConfiguration.getEntry(key);
// if (entry != null) {
// if (isSeedDimlet(entry)) {
// NBTTagCompound tagCompound = stack.getTagCompound();
// if (tagCompound == null) {
// tagCompound = new NBTTagCompound();
// }
//
// boolean locked = tagCompound.getBoolean("locked");
// if (locked) {
// Logging.message(player, TextFormatting.YELLOW + "This seed dimlet is locked. You cannot modify it!");
// return stack;
// }
//
// long forcedSeed = tagCompound.getLong("forcedSeed");
// if (player.isSneaking()) {
// if (forcedSeed == 0) {
// Logging.message(player, TextFormatting.YELLOW + "This dimlet has no seed. You cannot lock it!");
// return stack;
// }
// tagCompound.setBoolean("locked", true);
// Logging.message(player, "Dimlet locked!");
// } else {
// long seed = world.getSeed();
// tagCompound.setLong("forcedSeed", seed);
// Logging.message(player, "Seed set to: " + seed);
// }
//
// stack.setTagCompound(tagCompound);
// }
// }
//
// return stack;
// }
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean showExtended) {
super.addInformation(itemStack, player, list, showExtended);
DimletKey key = KnownDimletConfiguration.getDimletKey(itemStack);
Settings settings = KnownDimletConfiguration.getSettings(key);
if (showExtended) {
list.add(TextFormatting.GOLD + "Key: " + key.getId());
}
if (settings == null) {
list.add(TextFormatting.WHITE + "Dimlet " + key.getType().dimletType.getName() + "." + key.getId());
list.add(TextFormatting.RED + "This dimlet is blacklisted!");
return;
}
list.add(TextFormatting.BLUE + "Rarity: " + settings.getRarity() + (KnownDimletConfiguration.isCraftable(key) ? " (craftable)" : ""));
list.add(TextFormatting.YELLOW + "Create cost: " + settings.getCreateCost() + " RF/tick");
int maintainCost = settings.getMaintainCost();
if (maintainCost < 0) {
list.add(TextFormatting.YELLOW + "Maintain cost: " + maintainCost + "% RF/tick");
} else {
list.add(TextFormatting.YELLOW + "Maintain cost: " + maintainCost + " RF/tick");
}
list.add(TextFormatting.YELLOW + "Tick cost: " + settings.getTickCost() + " ticks");
if (KnownDimletConfiguration.isSeedDimlet(key)) {
NBTTagCompound tagCompound = itemStack.getTagCompound();
if (tagCompound != null && tagCompound.getLong("forcedSeed") != 0) {
long forcedSeed = tagCompound.getLong("forcedSeed");
boolean locked = tagCompound.getBoolean("locked");
list.add(TextFormatting.BLUE + "Forced seed: " + forcedSeed + (locked ? " [LOCKED]" : ""));
} else {
list.add(TextFormatting.BLUE + "Right click to copy seed from dimension.");
list.add(TextFormatting.BLUE + "Shift-Right click to lock copied seed.");
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
for (String info : key.getType().dimletType.getInformation()) {
list.add(TextFormatting.WHITE + info);
}
// @todo
// List<String> extra = KnownDimletConfiguration.idToExtraInformation.get(entry.getKey());
// if (extra != null) {
// for (String info : extra) {
// list.add(TextFormatting.YELLOW + info);
// }
// }
} else {
list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
}
}
use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.
the class DimletEnergyModuleItem method initModel.
@Override
@SideOnly(Side.CLIENT)
public void initModel() {
ModelResourceLocation[] models = new ModelResourceLocation[3];
for (int i = 0; i < 3; i++) {
ResourceLocation registryName = getRegistryName();
registryName = new ResourceLocation(registryName.getResourceDomain(), registryName.getResourcePath() + i);
models[i] = new ModelResourceLocation(registryName, "inventory");
ModelBakery.registerItemVariants(this, models[i]);
}
ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return models[stack.getItemDamage()];
}
});
}
use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.
the class AttainedDropsHelper method init.
@Override
public void init() {
Block blockPlant = Block.REGISTRY.getObject(new ResourceLocation("attaineddrops:plant"));
final Item itemSeed = Item.REGISTRY.getObject(new ResourceLocation("attaineddrops:itemseed"));
if (blockPlant == null || itemSeed == null)
return;
final IBlockState blockstatePlant = blockPlant.getDefaultState();
IProperty propertyAge = null;
for (IProperty prop : blockstatePlant.getPropertyNames()) if ("age".equals(prop.getName()) && prop instanceof PropertyInteger)
propertyAge = prop;
final IProperty propertyAge_final = propertyAge;
addType("slimeball", new ItemStack(Items.SLIME_BALL));
addType("bone", new ItemStack(Items.BONE));
addType("string", new ItemStack(Items.STRING));
addType("rottenflesh", new ItemStack(Items.ROTTEN_FLESH));
addType("ghasttear", new ItemStack(Items.GHAST_TEAR));
addType("spidereye", new ItemStack(Items.SPIDER_EYE));
addType("prismarine", new ItemStack(Items.PRISMARINE_SHARD));
addType("blaze", new ItemStack(Items.BLAZE_ROD));
addType("gunpowder", new ItemStack(Items.GUNPOWDER));
addType("witherskull", new ItemStack(Items.SKULL, 1, 1));
addType("enderpearl", new ItemStack(Items.ENDER_PEARL));
BelljarHandler.registerHandler(new IPlantHandler() {
@Override
public boolean isCorrectSoil(ItemStack seed, ItemStack soil) {
return soil != null && soilOutputMap.containsKey(new ComparableItemStack(soil));
}
@Override
public float getGrowthStep(ItemStack seed, ItemStack soil, float growth, TileEntity tile, float fertilizer, boolean render) {
return (growth < .5 ? .003125f : .0015625f) * fertilizer;
}
@Override
public float resetGrowth(ItemStack seed, ItemStack soil, float growth, TileEntity tile, boolean render) {
return .5f;
}
@Override
public ItemStack[] getOutput(ItemStack seed, ItemStack soil, TileEntity tile) {
ItemStack[] out = soilOutputMap.get(new ComparableItemStack(soil));
if (out == null)
return new ItemStack[0];
return out;
}
@Override
public boolean isValid(ItemStack seed) {
return seed != null && seed.getItem() == itemSeed;
}
@Override
@SideOnly(Side.CLIENT)
public IBlockState[] getRenderedPlant(ItemStack seed, ItemStack soil, float growth, TileEntity tile) {
return new IBlockState[0];
}
@Override
@SideOnly(Side.CLIENT)
public float getRenderSize(ItemStack seed, ItemStack soil, float growth, TileEntity tile) {
return .875f;
}
@Override
@SideOnly(Side.CLIENT)
public boolean overrideRender(ItemStack seed, ItemStack soil, float growth, TileEntity tile, BlockRendererDispatcher blockRenderer) {
IBlockState state = blockstatePlant.withProperty(propertyAge_final, growth >= .5 ? 7 : Math.min(7, Math.round(7 * growth * 2)));
IBakedModel model = blockRenderer.getModelForState(state);
GlStateManager.pushMatrix();
blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, 1, true);
GlStateManager.popMatrix();
if (growth >= .5) {
state = bulbMap.get(new ComparableItemStack(soil));
model = blockRenderer.getModelForState(state);
GlStateManager.pushMatrix();
float scale = (growth - .5f) * 2f;
GlStateManager.translate(.5 - scale / 2, 1, -.5 + scale / 2);
GlStateManager.scale(scale, scale, scale);
blockRenderer.getBlockModelRenderer().renderModelBrightness(model, state, 1, true);
GlStateManager.popMatrix();
}
return true;
}
});
}
use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.
the class BotaniaHelper method onPotatoRender.
@SubscribeEvent()
@SideOnly(Side.CLIENT)
public void onPotatoRender(TinyPotatoRenderEvent event) {
if (event.tile.getWorld() == null)
return;
if (revolverEntity == null) {
revolverEntity = new EntityItem(event.tile.getWorld(), 0.0D, 0.0D, 0.0D, new ItemStack(IEContent.itemRevolver));
revolverEntity.hoverStart = 0;
}
try {
String formattedName = event.name.replace("_", " ");
ItemRevolver.SpecialRevolver special = null;
if (formattedName.equalsIgnoreCase("Mr Damien Hazard") || formattedName.equalsIgnoreCase("Mr Hazard"))
special = ItemRevolver.specialRevolversByTag.get("dev");
else if (event.name.equalsIgnoreCase("BluSunrize"))
special = ItemRevolver.specialRevolversByTag.get("fenrir");
else {
if (nameToSpecial.containsKey(event.name.toLowerCase(Locale.ENGLISH))) {
List<SpecialRevolver> list = nameToSpecial.get(event.name.toLowerCase(Locale.ENGLISH));
if (list != null && list.size() > 0) {
long ticks = event.tile.getWorld() != null ? event.tile.getWorld().getTotalWorldTime() / 100 : 0;
special = list.get((int) (ticks % list.size()));
}
}
}
if (special != null) {
GlStateManager.pushMatrix();
((ItemRevolver) IEContent.itemRevolver).applySpecialCrafting(revolverEntity.getEntityItem(), special);
GlStateManager.translate(-.16, 1.45, -.2);
GlStateManager.rotate(-90, 0, 1, 0);
GlStateManager.rotate(15, 0, 0, 1);
GlStateManager.rotate(180, 1, 0, 0);
GlStateManager.scale(.625f, .625f, .625f);
ClientUtils.mc().getRenderManager().doRenderEntity(revolverEntity, 0, 0, 0, 0, 0, false);
GlStateManager.popMatrix();
}
} catch (Exception e) {
}
}
Aggregations