@SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { EntityPlayer player = event.getEntityPlayer(); String uuid = player.getUUID(player.getGameProfile()).toString(); if(player instanceof AbstractClientPlayer && UUIDS.contains(uuid) && !done.contains(player)) { AbstractClientPlayer clplayer = (AbstractClientPlayer) player; if(clplayer.hasPlayerInfo()) { NetworkPlayerInfo info = ReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clplayer, ObfuscatedNames.PLAYER_INFO); Map<MinecraftProfileTexture.Type, ResourceLocation> textures = ReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, info, ObfuscatedNames.PLAYER_TEXTURES); ResourceLocation loc = new ResourceLocation("proxyslib", "textures/whoknows/dev_cape.png"); textures.put(MinecraftProfileTexture.Type.CAPE, loc); textures.put(MinecraftProfileTexture.Type.ELYTRA, loc); done.add(player); } } }
/** * (abstract) Protected helper method to write subclass entity data to NBT. */ protected void writeEntityToNBT(NBTTagCompound tagCompound) { if (this.hasDisplayTile()) { tagCompound.setBoolean("CustomDisplayTile", true); IBlockState iblockstate = this.getDisplayTile(); ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(iblockstate.getBlock()); tagCompound.setString("DisplayTile", resourcelocation == null ? "" : resourcelocation.toString()); tagCompound.setInteger("DisplayData", iblockstate.getBlock().getMetaFromState(iblockstate)); tagCompound.setInteger("DisplayOffset", this.getDisplayTileOffset()); } if (this.entityName != null && this.entityName.length() > 0) { tagCompound.setString("CustomName", this.entityName); } }
private static int getTextureHeight(String p_getTextureHeight_0_, int p_getTextureHeight_1_) { try { InputStream inputstream = Config.getResourceStream(new ResourceLocation(p_getTextureHeight_0_)); if (inputstream == null) { return p_getTextureHeight_1_; } else { BufferedImage bufferedimage = ImageIO.read(inputstream); return bufferedimage == null ? p_getTextureHeight_1_ : bufferedimage.getHeight(); } } catch (IOException var4) { return p_getTextureHeight_1_; } }
private static RandomMobsProperties makeProperties(ResourceLocation p_makeProperties_0_) { String s = p_makeProperties_0_.getResourcePath(); ResourceLocation resourcelocation = getPropertyLocation(p_makeProperties_0_); if (resourcelocation != null) { RandomMobsProperties randommobsproperties = parseProperties(resourcelocation, p_makeProperties_0_); if (randommobsproperties != null) { return randommobsproperties; } } ResourceLocation[] aresourcelocation = getTextureVariants(p_makeProperties_0_); return new RandomMobsProperties(s, aresourcelocation); }
@Override public ResourceLocation getChestModel(ItemStack stack) { NBTTagCompound logNbt = stack.getTagCompound().getCompoundTag("WoodLog"); ItemStack log = new ItemStack(logNbt); if (log.getItem() == Item.getItemFromBlock(Blocks.LOG)) { return locationFromName("barrel_" + names[log.getItemDamage()]); } else if (log.getItem() == Item.getItemFromBlock(Blocks.LOG2)) { return locationFromName("barrel_" + names[log.getItemDamage() + 4]); } else if (log.getItem() == Item.getItemFromBlock(Blocks.BEDROCK)) { return locationFromName("barrel_creative"); } return locationFromName("barrel_oak"); }
@Nonnull @Override public Collection<MachineRecipe> createRecipesFor(ResourceLocation owningMachineName) { Map<ItemStack, ItemStack> inputOutputMap = FurnaceRecipes.instance().getSmeltingList(); List<MachineRecipe> smeltingRecipes = new ArrayList<>(inputOutputMap.size()); int incId = 0; for (Map.Entry<ItemStack, ItemStack> smelting : inputOutputMap.entrySet()) { MachineRecipe recipe = createRecipeShell( new ResourceLocation("minecraft", "smelting_recipe_" + incId), owningMachineName, 120, 0); recipe.addRequirement(new ComponentRequirement.RequirementItem(MachineComponent.IOType.INPUT, ItemUtils.copyStackWithSize(smelting.getKey(), smelting.getKey().getCount()))); recipe.addRequirement(new ComponentRequirement.RequirementItem(MachineComponent.IOType.OUTPUT, ItemUtils.copyStackWithSize(smelting.getValue(), smelting.getValue().getCount()))); recipe.addRequirement(new ComponentRequirement.RequirementEnergy(MachineComponent.IOType.INPUT, 20)); smeltingRecipes.add(recipe); incId++; } return smeltingRecipes; }
public List<IResource> getAllResources(ResourceLocation location) throws IOException { List<IResource> list = Lists.<IResource>newArrayList(); ResourceLocation resourcelocation = getLocationMcmeta(location); for (IResourcePack iresourcepack : this.resourcePacks) { if (iresourcepack.resourceExists(location)) { InputStream inputstream = iresourcepack.resourceExists(resourcelocation) ? this.getInputStream(resourcelocation, iresourcepack) : null; list.add(new SimpleResource(iresourcepack.getPackName(), location, this.getInputStream(location, iresourcepack), inputstream, this.frmMetadataSerializer)); } } if (list.isEmpty()) { throw new FileNotFoundException(location.toString()); } else { return list; } }
@Nullable /** * Tries to get an Item by it's name (e.g. minecraft:apple) or a String representation of a numerical ID. If both * fail, null is returned. */ public static Item getByNameOrId(String id) { Item item = (Item)REGISTRY.getObject(new ResourceLocation(id)); if (item == null) { try { return getItemById(Integer.parseInt(id)); } catch (NumberFormatException var3) { ; } } return item; }
public static ResourceLocation getResourceLocation(String basePath, String path, String extension) { if (!path.endsWith(extension)) { path = path + extension; } if (!path.contains("/")) { path = basePath + "/" + path; } else if (path.startsWith("./")) { path = basePath + "/" + path.substring(2); } else if (path.startsWith("~/")) { path = "optifine/" + path.substring(2); } return new ResourceLocation(path); }
public static <T extends LootFunction> void registerFunction(LootFunction.Serializer <? extends T > p_186582_0_) { ResourceLocation resourcelocation = p_186582_0_.getFunctionName(); Class<T> oclass = (Class<T>)p_186582_0_.getFunctionClass(); if (NAME_TO_SERIALIZER_MAP.containsKey(resourcelocation)) { throw new IllegalArgumentException("Can\'t re-register item function name " + resourcelocation); } else if (CLASS_TO_SERIALIZER_MAP.containsKey(oclass)) { throw new IllegalArgumentException("Can\'t re-register item function class " + oclass.getName()); } else { NAME_TO_SERIALIZER_MAP.put(resourcelocation, p_186582_0_); CLASS_TO_SERIALIZER_MAP.put(oclass, p_186582_0_); } }
public Tier(int tier, int width, int height, int guiGridX, int guiGridY, int guiResultX, int guiResultY, ResourceLocation guiTexture, int guiJeiStartX, int guiJeiStartY, ResourceLocation modelTexture, ResourceLocation obj, ResourceLocation smartModel, boolean areItemsFloating, String unlocalizedName) { this.tier = tier; this.width = width; this.height = height; this.guiGridX = guiGridX; this.guiGridY = guiGridY; this.guiResultX = guiResultX; this.guiResultY = guiResultY; this.guiTexture = guiTexture; this.guiJeiStartX = guiJeiStartX; this.guiJeiStartY = guiJeiStartY; this.modelTexture = modelTexture; this.obj = obj; this.smartModel = smartModel; this.areItemsFloating = areItemsFloating; this.unlocalizedName = unlocalizedName; }
public void serialize(JsonObject object, EnchantRandomly functionClazz, JsonSerializationContext serializationContext) { if (!functionClazz.enchantments.isEmpty()) { JsonArray jsonarray = new JsonArray(); for (Enchantment enchantment : functionClazz.enchantments) { ResourceLocation resourcelocation = (ResourceLocation)Enchantment.REGISTRY.getNameForObject(enchantment); if (resourcelocation == null) { throw new IllegalArgumentException("Don\'t know how to serialize enchantment " + enchantment); } jsonarray.add(new JsonPrimitive(resourcelocation.toString())); } object.add("enchantments", jsonarray); } }
private static String[] collectFilesFixed(IResourcePack p_collectFilesFixed_0_, String[] p_collectFilesFixed_1_) { if (p_collectFilesFixed_1_ == null) { return new String[0]; } else { List list = new ArrayList(); for (int i = 0; i < p_collectFilesFixed_1_.length; ++i) { String s = p_collectFilesFixed_1_[i]; ResourceLocation resourcelocation = new ResourceLocation(s); if (p_collectFilesFixed_0_.resourceExists(resourcelocation)) { list.add(s); } } String[] astring = (String[])((String[])list.toArray(new String[list.size()])); return astring; } }
public <T extends IRecipeWrapper> CraftingControl(IRecipeCategory<T> category, T wrapper, ResourceLocation border, int borderSize) { super(border, 2); this.title = category.getTitle(); off = DrawingTools.getStringHeight(title) + 2; IRecipeRegistry reg = PMJeiPlugin.RUNTIME.getRecipeRegistry(); IRecipeLayoutDrawable draw = reg.createRecipeLayoutDrawable(category, wrapper, reg.createFocus(IFocus.Mode.OUTPUT, new ItemStack(Items.STICK /*hack*/))); setWidth(category.getBackground().getWidth() + size * 2); setHeight(category.getBackground().getHeight() + size * 2); draw.setPosition(size, size); this.draw = draw; }
public static <T extends ICraftingRecipeWrapper> Supplied<CraftingControl> fromCrafting(String category, ResourceLocation id, ResourceLocation border, int borderSize) { return new Supplied<>(() -> { IRecipeCategory cat = PMJeiPlugin.RUNTIME.getRecipeRegistry().getRecipeCategory(category); List<T> lst = PMJeiPlugin.RUNTIME.getRecipeRegistry().getRecipeWrappers(cat); T rec = null; for (T wr : lst) { if (wr.getRegistryName().equals(id)) { rec = wr; break; } } return new CraftingControl(cat, rec, border, borderSize); }); }
public MissingMapping(GameRegistry.Type type, ResourceLocation name, int id) { this.type = type; this.name = name.toString(); this.id = id; this.resourceLocation = name; }
@Override @Nonnull public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity) { if (stack.getItem() != ModItems.sword) { return originalModel; } BakedSwordModel model = (BakedSwordModel) originalModel; String key = IBladeTool.getBladeMat(stack).getName() + "|" + ICrossguardTool.getCrossguardMat(stack).getName() + "|" + IHandleTool.getHandleMat(stack).getName() + "|" + IAdornedTool.getAdornmentMat(stack).getName(); if (!model.cache.containsKey(key)) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder.put("blade", IBladeTool.getBladeMat(stack).getName()); builder.put("crossguard", ICrossguardTool.getCrossguardMat(stack).getName()); builder.put("handle", IHandleTool.getHandleMat(stack).getName()); if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) { builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName()); } IModel parent = model.parent.retexture(builder.build()); Function<ResourceLocation, TextureAtlasSprite> textureGetter; textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() { public TextureAtlasSprite apply(ResourceLocation location) { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); } }; IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter); model.cache.put(key, bakedModel); return bakedModel; } return model.cache.get(key); }
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(new ResourceLocation("randores:textures/gui/craftinium_forge.png")); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); if (this.tileEntity.isBurning()) { int k = this.getBurnLeftScaled(13); this.drawTexturedModalRect(i + 56, j + 36 + 12 - k, 176, 12 - k, 14, k + 1); } int l = this.getCookProgressScaled(24); this.drawTexturedModalRect(i + 79, j + 34, 176, 14, l + 1, 16); }
/** * This adds a recipe to the list of crafting recipes. Cares about names. */ public static IRecipe addRecipe(String name, IRecipe rec) { if (rec.getRegistryName() == null) RECIPES.add(rec.setRegistryName(new ResourceLocation(MODID, name))); else RECIPES.add(rec); return rec; }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapedOreRecipe recipe = ShapedOreRecipe.factory(context, json); ShapedPrimer primer = new ShapedPrimer(); primer.width = recipe.getWidth(); primer.height = recipe.getHeight(); primer.mirrored = JsonUtils.getBoolean(json, "mirrored", true); primer.input = recipe.getIngredients(); return new InsertCartridgeRecipe(new ResourceLocation(MeeCreeps.MODID, "insert_cartridge_factory"), recipe.getRecipeOutput(), primer); }
protected void loadPlayerTextures() { synchronized (this) { if (!this.playerTexturesLoaded) { this.playerTexturesLoaded = true; Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback() { public void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) { switch (p_180521_1_) { case SKIN: NetworkPlayerInfo.this.locationSkin = location; NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model"); if (NetworkPlayerInfo.this.skinType == null) { NetworkPlayerInfo.this.skinType = "default"; } break; case CAPE: NetworkPlayerInfo.this.locationCape = location; } } }, true); } } }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { //String s = this.entity.getDisplayName().getUnformattedText(); //this.fontRendererObj.drawString(s, 88 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); //#404040 //this.fontRendererObj.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, 72, 4210752); //#404040 int rfBarX = 231; int rfBarY = 20; int rfBarHeight = 88; int rfBarWidth = 14; int usedHeight = (int)(this.entity.getEnergyStored(EnumFacing.DOWN) / (double)this.entity.getMaxEnergyStored(EnumFacing.DOWN) * rfBarHeight); Gui.drawRect(rfBarX, rfBarY, rfBarX + rfBarWidth, rfBarY + rfBarHeight - usedHeight, 0xFF000000); Operation<BundlerEntity> op = this.entity.getCurrentOperation(); String statusStr; if (op != null) { int width = (int)(32 * op.getPercentage() / (double)100); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(new ResourceLocation("rezolve:textures/gui/container/arrow.png")); GlStateManager.enableBlend(); this.drawModalRectWithCustomSizedTexture(133, 54, 0, 0, width, 32, 32, 32); statusStr = "Operation: "+op.getPercentage()+"%"; } else { statusStr = "Idle."; } this.fontRendererObj.drawString(statusStr, 7, 102, 0xFF000000); }
@Override public void registerRecipes() { if (Item.REGISTRY.getObject(new ResourceLocation("enderio:itemAlloy")) != null) { RezolveMod.addRecipe( new ItemStack(this.itemBlock), "VSV", "CMC", "VFV", 'V', "item|enderio:itemAlloy|2", 'S', "block|minecraft:sticky_piston", 'C', "block|minecraft:chest", 'M', "item|enderio:itemMachinePart|0", 'F', "item|enderio:itemBasicFilterUpgrade" ); } else { RezolveMod.addRecipe( new ItemStack(this.itemBlock), "IMI", "CSC", "IHI", 'I', "item|minecraft:iron_block", 'M', "item|minecraft:minecart", 'C', "item|minecraft:chest", 'S', "item|minecraft:sticky_piston", 'H', "item|minecraft:hopper" ); } }
@Override public void registerRecipes() { if (Item.REGISTRY.getObject(new ResourceLocation("enderio:itemAlloy")) != null) { RezolveMod.addRecipe( new ItemStack(this.itemBlock), "BCB", "EME", "BcB", 'B', RezolveMod.BUNDLE_PATTERN_ITEM.blank(), 'C', "block|enderio:blockCapBank", 'E', "item|enderio:itemMagnet", 'M', "item|enderio:itemMachinePart|0", 'c', "item|enderio:itemItemConduit" ); } else { RezolveMod.addRecipe( new ItemStack(this.itemBlock), "PcP", "CpC", "PHP", 'P', RezolveMod.BUNDLE_PATTERN_ITEM.blank(), 'c', Blocks.CRAFTING_TABLE, 'C', Blocks.CHEST, 'p', Blocks.PISTON, 'H', Blocks.HOPPER ); } }
public boolean setFxaaShader(int p_setFxaaShader_1_) { if (!OpenGlHelper.isFramebufferEnabled()) { return false; } else if (this.theShaderGroup != null && this.theShaderGroup != this.fxaaShaders[2] && this.theShaderGroup != this.fxaaShaders[4]) { return true; } else if (p_setFxaaShader_1_ != 2 && p_setFxaaShader_1_ != 4) { if (this.theShaderGroup == null) { return true; } else { this.theShaderGroup.deleteShaderGroup(); this.theShaderGroup = null; return true; } } else if (this.theShaderGroup != null && this.theShaderGroup == this.fxaaShaders[p_setFxaaShader_1_]) { return true; } else if (this.mc.world == null) { return true; } else { this.loadShader(new ResourceLocation("shaders/post/fxaa_of_" + p_setFxaaShader_1_ + "x.json")); this.fxaaShaders[p_setFxaaShader_1_] = this.theShaderGroup; return this.useShader; } }
public static void addMeatCompressionRecipe(IForgeRegistry<IRecipe> registry, EnumEdibleMeat meat, boolean cooked, ItemStack ingredient) { ResourceLocation group = new ResourceLocation("thermionics_world", "compress.meat"); Ingredient input = Ingredient.fromStacks(ingredient); ShapedRecipes recipe = new ShapedRecipes(group.toString(), 3, 3, NonNullList.withSize(3*3, input), new ItemStack(TWBlocks.MEAT_EDIBLE, 1, BlockMeatEdible.getMetaFromValue(meat, cooked)) ); recipe.setRegistryName(new ResourceLocation("thermionics_world", meat.getName()+((cooked)?".cooked":".raw")+"_CompressToBlock")); registry.register(recipe); }
private static RandomMobsProperties parseProperties(ResourceLocation p_parseProperties_0_, ResourceLocation p_parseProperties_1_) { try { String s = p_parseProperties_0_.getResourcePath(); Config.dbg("RandomMobs: " + p_parseProperties_1_.getResourcePath() + ", variants: " + s); InputStream inputstream = Config.getResourceStream(p_parseProperties_0_); if (inputstream == null) { Config.warn("RandomMobs properties not found: " + s); return null; } else { Properties properties = new Properties(); properties.load(inputstream); inputstream.close(); RandomMobsProperties randommobsproperties = new RandomMobsProperties(properties, s, p_parseProperties_1_); return !randommobsproperties.isValid(s) ? null : randommobsproperties; } } catch (FileNotFoundException var6) { Config.warn("RandomMobs file not found: " + p_parseProperties_1_.getResourcePath()); return null; } catch (IOException ioexception) { ioexception.printStackTrace(); return null; } }
@Nullable private static Potion getRegisteredMobEffect(String id) { Potion potion = (Potion)Potion.REGISTRY.getObject(new ResourceLocation(id)); if (potion == null) { throw new IllegalStateException("Invalid MobEffect requested: " + id); } else { return potion; } }
private void loadVariantItemModels() { this.loadVariants(this.blockModelShapes.getBlockStateMapper().putAllStateModelLocations().values()); this.variants.put(MODEL_MISSING, new ModelBlockDefinition.Variants(MODEL_MISSING.getVariant(), Lists.newArrayList(new ModelBlockDefinition.Variant[] {new ModelBlockDefinition.Variant(new ResourceLocation(MODEL_MISSING.getResourcePath()), ModelRotation.X0_Y0, false, 1)}))); ResourceLocation resourcelocation = new ResourceLocation("item_frame"); ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation); this.registerVariant(modelblockdefinition, new ModelResourceLocation(resourcelocation, "normal")); this.registerVariant(modelblockdefinition, new ModelResourceLocation(resourcelocation, "map")); this.loadVariantModels(); this.loadItemModels(); }
public ModelBlock deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException { JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); List<BlockPart> list = this.getModelElements(p_deserialize_3_, jsonobject); String s = this.getParent(jsonobject); boolean flag = StringUtils.isEmpty(s); boolean flag1 = list.isEmpty(); if (flag1 && flag) { throw new JsonParseException("BlockModel requires either elements or parent, found neither"); } else if (!flag && !flag1) { throw new JsonParseException("BlockModel requires either elements or parent, found both"); } else { Map<String, String> map = this.getTextures(jsonobject); boolean flag2 = this.getAmbientOcclusionEnabled(jsonobject); ItemCameraTransforms itemcameratransforms = ItemCameraTransforms.DEFAULT; if (jsonobject.has("display")) { JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "display"); itemcameratransforms = (ItemCameraTransforms)p_deserialize_3_.deserialize(jsonobject1, ItemCameraTransforms.class); } return flag1 ? new ModelBlock(new ResourceLocation(s), map, flag2, true, itemcameratransforms) : new ModelBlock(list, map, flag2, true, itemcameratransforms); } }
private void drawEnergyBar() { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); this.mc.getTextureManager().bindTexture(new ResourceLocation(ModInfo.MODID, "textures/gui/gui_bar.png")); float percent = 0; if (energy != 0 && maxEnergy != 0) { percent = ((float) energy / (float) maxEnergy); } int fh = (int) (percent * (float) progH) + 1; int fy = progY - (int) (percent * (float) progH) + progH; drawTexturedModalRect(progX, fy, 0, progH - fh + 1, progW, (percent == 0) ? 0 : fh); addToolTips(progX - 1, progY - 1, progW + 3, progH + 3); }
private void drawIcons(List<String> actions, int offset, int q) { PlayerWheelConfiguration config = PlayerProperties.getWheelConfig(MinecraftTools.getPlayer(mc)); Map<String, Integer> hotkeys = config.getHotkeys(); for (int i = 0; i < getActionSize(actions); i++) { String id = actions.get(i + page * 8); IWheelAction action = InteractionWheel.registry.get(id); if (action != null) { WheelActionElement element = action.createElement(); mc.getTextureManager().bindTexture(new ResourceLocation(element.getTexture())); int txtw = element.getTxtw(); int txth = element.getTxth(); boolean selected = q == i; int u = selected ? element.getUhigh() : element.getUlow(); int v = selected ? element.getVhigh() : element.getVlow(); int offs = (i - offset + 8) % 8; int ox = guiLeft + iconOffsets.get(offs).getLeft(); int oy = guiTop + iconOffsets.get(offs).getRight(); RenderHelper.drawTexturedModalRect(ox, oy, u, v, 31, 31, txtw, txth); if (selected && hotkeys.containsKey(id)) { double angle = Math.PI * 2.0 * offs / 8 - Math.PI / 2.0 + Math.PI / 8.0; int tx = (int) (guiLeft + 80 + 86 * Math.cos(angle)); int ty = (int) (guiTop + 80 + 86 * Math.sin(angle)); String keyName = Keyboard.getKeyName(hotkeys.get(id)); RenderHelper.renderText(mc, tx - mc.fontRenderer.getCharWidth(keyName.charAt(0)) / 2, ty - mc.fontRenderer.FONT_HEIGHT / 2, keyName); } } } }
void addRecipe() { if (damage.length == 0) damage = new int[items.size()]; Class<DamageableShapelessOreRecipe> recipeClass = JEICompatRegistry.getShapelessCraftingRecipeClass(recipeList); Constructor<DamageableShapelessOreRecipe> constructor = ReflectionHelper.getConstructor(recipeClass, ResourceLocation.class, int[].class, ItemStack.class, Object[].class); DamageableShapelessOreRecipe recipe = ReflectionHelper.newInstance(constructor, null, damage, result.getItemStack(), getInputForRecipe()); if (recipe != null) { CraftingManagerCS4.addRecipe(recipeList, recipe); } }
public static FrameSpriteResource load(Location location, String name, int rows, int columns) { if(rows <= 0 || columns <= 0) { Solar.LOG.fatal("[SpriteLoader] Your sprite can't have 0 rows or columns" + location.toString()); } ResourceLocation resource = ResourceLibrary.getTexture(location, name); FrameSpriteResource bind = new FrameSpriteResource(resource, rows, columns); SPRITE_RESOURCE_MAP.put(resource, bind); return bind; }
private static ResourceLocation makeResourceLocation(String p_makeResourceLocation_0_) { int i = p_makeResourceLocation_0_.indexOf(58); if (i < 0) { return new ResourceLocation(p_makeResourceLocation_0_); } else { String s = p_makeResourceLocation_0_.substring(0, i); String s1 = p_makeResourceLocation_0_.substring(i + 1); return new ResourceLocation(s, s1); } }
public BlockCable() { super(Material.ROCK); setRegistryName(new ResourceLocation(TRConstants.MOD_ID, "cable")); setCreativeTab(TechRebornCreativeTab.TECHREBORN); setUnlocalizedName(getRegistryName().toString()); setDefaultState(getDefaultState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(UP, false).withProperty(DOWN, false)); TechReborn.blockModelsToRegister.add(this); }
/** * Registers a new biome into the registry. */ public static void registerBiome(int id, String name, Biome biome) { REGISTRY.register(id, new ResourceLocation(name), biome); if (biome.isMutation()) { MUTATION_TO_BASE_ID_MAP.put(biome, getIdForBiome((Biome)REGISTRY.getObject(new ResourceLocation(biome.baseBiomeRegName)))); } }
public boolean setFxaaShader(int p_setFxaaShader_1_) { if (!OpenGlHelper.isFramebufferEnabled()) { return false; } else if (this.theShaderGroup != null && this.theShaderGroup != this.fxaaShaders[2] && this.theShaderGroup != this.fxaaShaders[4]) { return true; } else if (p_setFxaaShader_1_ != 2 && p_setFxaaShader_1_ != 4) { if (this.theShaderGroup == null) { return true; } else { this.theShaderGroup.deleteShaderGroup(); this.theShaderGroup = null; return true; } } else if (this.theShaderGroup != null && this.theShaderGroup == this.fxaaShaders[p_setFxaaShader_1_]) { return true; } else if (this.mc.theWorld == null) { return true; } else { this.loadShader(new ResourceLocation("shaders/post/fxaa_of_" + p_setFxaaShader_1_ + "x.json")); this.fxaaShaders[p_setFxaaShader_1_] = this.theShaderGroup; return this.useShader; } }
@Override public void readNBT(Capability<CapabilityDivination> capability, CapabilityDivination instance, EnumFacing side, NBTBase nbt) { NBTTagCompound tag = (NBTTagCompound) nbt; if (tag.hasKey("fortune")) { instance.setFortune(Fortune.REGISTRY.getValue(new ResourceLocation(tag.getString("fortune")))); if (tag.getBoolean("active")) instance.setActive(); if (tag.getBoolean("removable")) instance.setRemovable(); ; } }
public AnimationWrapper(ResourceLocation resource, int priority, boolean loops, float transitionTime) { try { animation = AnimationRegistry.loadAnimation(resource); } catch (IOException e) { System.out.println("Unable to load animation from " + resource.getResourceDomain() + " " + resource.getResourcePath()); e.printStackTrace(); animation = null; } this.priority = priority; this.loops = loops; this.transitionTime = transitionTime; }