public static RefineryRecipe removeRecipePotion(FluidStack input) { if (input == null) { return null; } return recipeMapPotion.remove(FluidHelper.getFluidHash(input)); }
public static RefineryRecipe removeRecipe(FluidStack input) { if (input == null) { return null; } return recipeMap.remove(FluidHelper.getFluidHash(input)); }
public static RefineryRecipe getRecipe(FluidStack input) { return input == null ? null : recipeMap.get(FluidHelper.getFluidHash(input)); }
public static RefineryRecipe getRecipePotion(FluidStack input) { return input == null ? null : recipeMapPotion.get(FluidHelper.getFluidHash(input)); }
public static BrewerRecipe removeRecipe(ItemStack input, FluidStack fluid) { return recipeMap.remove(asList(convertInput(input).hashCode(), FluidHelper.getFluidHash(fluid))); }
public static TransposerRecipe removeFillRecipe(ItemStack input, FluidStack fluid) { return recipeMapFill.remove(asList(convertInput(input).hashCode(), FluidHelper.getFluidHash(fluid))); }
public static void refresh() { Map<List<Integer>, BrewerRecipe> tempMap = new Object2ObjectOpenHashMap<>(recipeMap.size()); Set<ComparableItemStackValidatedNBT> tempSet = new ObjectOpenHashSet<>(); BrewerRecipe tempRecipe; for (Entry<List<Integer>, BrewerRecipe> entry : recipeMap.entrySet()) { tempRecipe = entry.getValue(); ComparableItemStackValidatedNBT input = convertInput(tempRecipe.input); tempMap.put(asList(input.hashCode(), FluidHelper.getFluidHash(tempRecipe.inputFluid)), tempRecipe); tempSet.add(input); } recipeMap.clear(); recipeMap = tempMap; validationSet.clear(); validationSet = tempSet; }
public static TransposerRecipe getFillRecipe(ItemStack input, FluidStack fluid) { return input.isEmpty() || fluid == null ? null : recipeMapFill.get(asList(convertInput(input).hashCode(), FluidHelper.getFluidHash(fluid))); }
public static BrewerRecipe getRecipe(ItemStack input, FluidStack fluid) { return input.isEmpty() || fluid == null ? null : recipeMap.get(asList(convertInput(input).hashCode(), FluidHelper.getFluidHash(fluid))); }
tempRecipe = entry.getValue(); ComparableItemStackValidatedNBT input = convertInput(tempRecipe.input); tempFill.put(asList(input.hashCode(), FluidHelper.getFluidHash(tempRecipe.fluid)), tempRecipe); tempSet.add(input);
public static RefineryRecipe addRecipePotion(int energy, FluidStack input, FluidStack outputFluid) { if (input == null || outputFluid == null || energy <= 0 || recipeExistsPotion(input)) { return null; } RefineryRecipe recipe = new RefineryRecipe(input, outputFluid, ItemStack.EMPTY, energy, 0); recipeMapPotion.put(FluidHelper.getFluidHash(input), recipe); return recipe; }
public static BrewerRecipe addRecipe(int energy, ItemStack input, FluidStack inputFluid, FluidStack outputFluid) { if (input.isEmpty() || inputFluid == null || outputFluid == null || energy <= 0 || recipeExists(input, inputFluid)) { return null; } BrewerRecipe recipe = new BrewerRecipe(input, inputFluid, outputFluid, energy); recipeMap.put(asList(convertInput(input).hashCode(), FluidHelper.getFluidHash(inputFluid)), recipe); validationSet.add(convertInput(input)); validationFluids.add(inputFluid.getFluid().getName()); return recipe; }
public static RefineryRecipe addRecipe(int energy, FluidStack input, FluidStack outputFluid, ItemStack outputItem, int chance) { if (input == null || outputFluid == null || energy <= 0 || recipeExists(input)) { return null; } if (outputItem.isEmpty()) { chance = 0; } RefineryRecipe recipe = new RefineryRecipe(input, outputFluid, outputItem, energy, chance); recipeMap.put(FluidHelper.getFluidHash(input), recipe); return recipe; }
public static TransposerRecipe addFillRecipe(int energy, ItemStack input, ItemStack output, FluidStack fluid, boolean reversible) { if (input.isEmpty() || output.isEmpty() || fluid == null || fluid.amount <= 0 || energy <= 0) { return null; } if (fillRecipeExists(input, fluid)) { return null; } TransposerRecipe recipeFill = new TransposerRecipe(input, output, fluid, energy, 100); recipeMapFill.put(asList(convertInput(input).hashCode(), FluidHelper.getFluidHash(fluid)), recipeFill); validationSet.add(convertInput(input)); if (reversible) { addExtractRecipe(energy, output, input, fluid, 100, false); } return recipeFill; }
if (tile.hasFluidUnderlay() && tile.isActive) { FluidStack stack = tile.getRenderFluid(); builder.append(",fluid=").append(stack != null ? FluidHelper.getFluidHash(stack) : tile.getTexture(tile.getFacing(), 0).getIconName());
@Override @SideOnly (Side.CLIENT) public void registerModels() { StateMap.Builder stateMap = new StateMap.Builder(); stateMap.ignore(VARIANT); ModelLoader.setCustomStateMapper(this, stateMap.build()); ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), "normal"); for (Type type : Type.values()) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), type.getMetadata(), location); } ModelRegistryHelper.register(location, new CCBakeryModel()); ModelBakery.registerBlockKeyGenerator(this, state -> { TileDeviceBase tile = state.getValue(TEProps.TILE_DEVICE); StringBuilder builder = new StringBuilder(state.getBlock().getRegistryName().toString() + "|" + state.getBlock().getMetaFromState(state)); builder.append("facing=").append(tile.getFacing()); builder.append(",active=").append(tile.isActive); builder.append(",side_config={"); for (int i : tile.sideCache) { builder.append(",").append(i); } builder.append("}"); if (tile.hasFluidUnderlay() && tile.isActive) { FluidStack stack = tile.getRenderFluid(); builder.append(",fluid=").append(stack != null ? FluidHelper.getFluidHash(stack) : tile.getTexture(tile.getFacing(), 0).getIconName()); } return builder.toString(); }); }
@Override @SideOnly (Side.CLIENT) public void registerModels() { ModelResourceLocation loc = new ModelResourceLocation(getRegistryName(), "inventory"); ModelLoader.setCustomMeshDefinition(this, stack -> loc); ModelRegistryHelper.register(loc, new CCBakeryModel()); ModelBakery.registerItemKeyGenerator(this, stack -> { int colour = ColorHelper.hasColor0(stack) ? 1 : 0; int active = isActive(stack) ? 1 : 0; int mode = getMode(stack); String fluid_hash = "none"; if (stack.hasTagCompound() && stack.getTagCompound().hasKey(CoreProps.FLUID)) { FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag(CoreProps.FLUID)); if (fluid != null) { fluid_hash = Integer.toString(FluidHelper.getFluidHash(fluid)); } } return String.format("%s|%s,color0=%s,mode=%s_%s,fluid=%s", getRegistryName(), stack.getMetadata(), colour, active, mode, fluid_hash); }); }