@Override public boolean accepts( ResourceLocation modelLocation ) { String modelPath = modelLocation.getResourcePath(); if( modelLocation.getResourcePath().startsWith( "models/" ) ) { modelPath = modelPath.substring( "models/".length() ); } try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft() .getResourceManager() .getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) ) .getInputStream() ) ) { return gson.fromJson( io, UVLMarker.class ).ae2_uvl_marker; } catch( Exception e ) { // Catch-all in case of any JSON parser issues. } return false; }
public UVLModelWrapper( ResourceLocation modelLocation ) String modelPath = modelLocation.getResourcePath(); if( modelLocation.getResourcePath().startsWith( "models/" ) ) ResourceLocation armatureLocation = new ResourceLocation( modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json" ); ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation( UVLModelLoader.this.resourceManager, armatureLocation ); ModelBlock model; String s = modelLocation.getResourcePath(); new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) ); reader = new InputStreamReader( iresource.getInputStream(), Charsets.UTF_8 ); lvt_5_1_.name = modelLocation.toString();
@Override public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } TankCacheKey that = (TankCacheKey) o; return that.fluid == this.fluid && that.location.equals(this.location); }
@Override public boolean accepts( ResourceLocation modelLocation ) { if( !modelLocation.getResourceDomain().equals( AppEng.MOD_ID ) ) { return false; } return this.builtInModels.containsKey( modelLocation.getResourcePath() ); }
@Override public boolean accepts(ResourceLocation modelLocation) { return modelLocation.getNamespace().equals("botania_special") && ( modelLocation.getPath().equals("specialflower") || modelLocation.getPath().equals("models/block/specialflower") || modelLocation.getPath().equals("models/item/specialflower")); }
@Override public TextureAtlasSprite getTexture(ResourceLocation baseTexture, String location) { TextureAtlasSprite blockTexture = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(texturePath.toString()); if(blockTexture == null) { blockTexture = TinkerTexture.loadManually(texturePath); } TextureColoredTexture sprite = new TextureColoredTexture(new ResourceLocation(blockTexture.getIconName()), baseTexture, location); sprite.stencil = false; return sprite; } }
@Override public boolean isValidMobType(String type) { return EntityList.isRegistered(new ResourceLocation(type)); }
@Override public BaseItemStack getItemInHand(HandSide handSide) { ItemStack is = this.player.getHeldItem(handSide == HandSide.MAIN_HAND ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND); return new BaseItemStack(ItemTypes.get(ForgeRegistries.ITEMS.getKey(is.getItem()).toString())); }
private ResourceLocation getResourceLocation(TextureAtlasSprite p_184396_1_) { ResourceLocation resourcelocation = new ResourceLocation(p_184396_1_.getIconName()); return new ResourceLocation(resourcelocation.getNamespace(), String.format("%s/%s%s", this.basePath, resourcelocation.getPath(), ".png")); } }
@Override public ItemStack getMeal(String string) { ResourceLocation location = string.contains(":") ? new ResourceLocation(string) : new ResourceLocation(MODID, string); for (Recipe recipe : Recipe.REGISTRY.values()) { if (recipe.getResource().equals(location)) { return CookingHelper.makeRecipe(recipe); } } return null; }
public static boolean shouldMoveTE(boolean te, IBlockState state) { if(!ModuleLoader.isFeatureEnabled(PistonsMoveTEs.class)) return te; // Jukeboxes that are playing can't be moved so the music can be stopped if(state.getPropertyKeys().contains(BlockJukebox.HAS_RECORD) && state.getValue(BlockJukebox.HAS_RECORD)) return true; ResourceLocation res = Block.REGISTRY.getNameForObject(state.getBlock()); return PistonsMoveTEs.movementBlacklist.contains(res.toString()) || PistonsMoveTEs.movementBlacklist.contains(res.getResourceDomain()); }
@Override public IModel loadModel( ResourceLocation modelLocation ) throws Exception { return this.builtInModels.get( modelLocation.getResourcePath() ); }
@Override public String getResourceId(FluidStack ingredient) { String defaultFluidName = FluidRegistry.getDefaultFluidName(ingredient.getFluid()); if (defaultFluidName == null) { return ""; } ResourceLocation fluidResourceName = new ResourceLocation(defaultFluidName); return fluidResourceName.getPath(); }
@SideOnly( Side.CLIENT ) public String getModID() { if( this.uniqueID == null ) { this.uniqueID = Item.REGISTRY.getNameForObject( this.getDefinition().getItem() ); } if( this.uniqueID == null ) { return "** Null"; } return this.uniqueID.getResourceDomain() == null ? "** Null" : this.uniqueID.getResourceDomain(); }
public @Nonnull ItemStack toGenericStack(@Nonnull Item item, int meta, int amount) { NBTTagCompound data = new NBTTagCompound(); if (isUnspawnable(entityId)) { return toStack(item, meta, amount); } data.setString(ENTITY_ID_KEY, entityId.toString()); if (item == itemSoulVial.getItem() && customName == null && PIG.equals(entityId) && Math.random() < 0.01) { data.setString(CUSTOM_NAME_KEY, Lang.EASTER_PIGGY.get()); } ItemStack stack = new ItemStack(item, amount, meta); stack.setTagCompound(data); return stack; }
public static void registerItemAllMeta(Item item, int range) { registerItemMetas(item, range, i -> item.getRegistryName().getPath()); }
@Nullable @Override public String getName(BlockType blockType) { return Block.REGISTRY.getObject(new ResourceLocation(blockType.getId())).getLocalizedName(); }
@EventHandler public void serverAboutToStart(FMLServerAboutToStartEvent event) { if (this.platform != null) { logger.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); WorldEdit.getInstance().getPlatformManager().unregister(platform); } this.platform = new ForgePlatform(this); WorldEdit.getInstance().getPlatformManager().register(platform); if (Loader.isModLoaded("sponge")) { this.provider = new ForgePermissionsProvider.SpongePermissionsProvider(); } else { this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform); } for (ResourceLocation name : Block.REGISTRY.getKeys()) { String nameStr = name.toString(); if (!BlockType.REGISTRY.keySet().contains(nameStr)) { BlockTypes.register(new BlockType(nameStr)); } } for (ResourceLocation name : Item.REGISTRY.getKeys()) { String nameStr = name.toString(); if (!ItemType.REGISTRY.keySet().contains(nameStr)) { ItemTypes.register(new ItemType(nameStr)); } } }
private ResourceLocation getResourceLocation(TextureAtlasSprite p_184396_1_) { ResourceLocation resourcelocation = new ResourceLocation(p_184396_1_.getIconName()); return new ResourceLocation(resourcelocation.getNamespace(), String.format("%s/%s%s", this.basePath, resourcelocation.getPath(), ".png")); } }
public Utensil(ResourceLocation resource) { this.resource = resource; this.unlocalized = resource.getResourceDomain() + ".cookware." + resource.getResourcePath().replace("_", "."); this.burntName = resource.getResourceDomain() + ".meal.burnt." + resource.getResourcePath().replace("_", "."); REGISTRY.put(resource, this); }