net.minecraft.util.ResourceLocation Java Examples
The following examples show how to use
net.minecraft.util.ResourceLocation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiReactorRedstonePort.java From BigReactors with MIT License | 7 votes |
public GuiReactorRedstonePort(Container container, TileEntityReactorRedstonePort tileentity) { super(container); _guiBackground = new ResourceLocation(BigReactors.GUI_DIRECTORY + "RedstonePort.png"); port = tileentity; ySize = 204; btnMap = new HashMap<CircuitType, GuiSelectableButton>(); outputLevel = tileentity.getOutputLevel(); greaterThan = tileentity.getGreaterThan(); activeOnPulse = tileentity.isInputActiveOnPulse(); if(outputLevel < 0) { retract = true; outputLevel = Math.abs(outputLevel); } else { retract = false; } }
Example #2
Source File: GTEventLootTableLoad.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@SubscribeEvent public void onLootTableLoad(LootTableLoadEvent event) { /* * Iterates both the stack array and resource location array to create a 2d * table */ if (GTConfig.general.addLootItems) { for (ItemStack item : lootpool) { for (ResourceLocation table : loottable) { if (event.getName().equals(table)) { event.getTable().getPool("main").addEntry(new LootEntryItem(item.getItem(), 16, 0, new LootFunction[] { createCountFunction(1, 6) }, NO_CONDITIONS, getStackResourceName(item))); } } } } }
Example #3
Source File: EntityFallingBlockEU.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void writeEntityToNBT(NBTTagCompound compound) { Block block = this.blockState != null ? this.blockState.getBlock() : Blocks.AIR; ResourceLocation rl = Block.REGISTRY.getNameForObject(block); compound.setString("Block", rl == null ? "" : rl.toString()); compound.setByte("Data", this.blockState != null ? (byte) block.getMetaFromState(this.blockState) : 0); compound.setInteger("Time", this.fallTime); compound.setBoolean("DropItem", this.shouldDropItem); compound.setBoolean("HurtEntities", this.hurtEntities); compound.setFloat("FallHurtAmount", this.fallHurtAmount); compound.setInteger("FallHurtMax", this.fallHurtMax); if (this.tileEntityData != null) { compound.setTag("TileEntityData", this.tileEntityData); } }
Example #4
Source File: TargetData.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
public boolean isTargetBlockUnchanged() { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if (server == null) { return false; } World world = server.getWorld(this.dimension); if (world == null) { return false; } IBlockState iBlockState = world.getBlockState(this.pos); Block block = iBlockState.getBlock(); ResourceLocation rl = ForgeRegistries.BLOCKS.getKey(block); int meta = block.getMetaFromState(iBlockState); // The target block unique name and metadata matches what we have stored return this.blockMeta == meta && rl != null && this.blockName.equals(rl.toString()); }
Example #5
Source File: StructureLoader.java From YUNoMakeGoodMap with Apache License 2.0 | 6 votes |
@Override public void generate(World world, BlockPos pos) { PlacementSettings settings = new PlacementSettings(); Template temp = null; String suffix = world.provider.getDimensionType().getSuffix(); String opts = world.getWorldInfo().getGeneratorOptions() + suffix; if (!Strings.isNullOrEmpty(opts)) temp = StructureUtil.loadTemplate(new ResourceLocation(opts), (WorldServer)world, true); if (temp == null) temp = StructureUtil.loadTemplate(new ResourceLocation("/config/", this.fileName + suffix), (WorldServer)world, !Strings.isNullOrEmpty(suffix)); if (temp == null) return; //If we're not in the overworld, and we don't have a template... BlockPos spawn = StructureUtil.findSpawn(temp, settings); if (spawn != null) { pos = pos.subtract(spawn); world.setSpawnPoint(pos); } temp.addBlocksToWorld(world, pos, settings, 0); //Push to world, with no neighbor notifications! world.getPendingBlockUpdates(new StructureBoundingBox(pos, pos.add(temp.getSize())), true); //Remove block updates, so that sand doesn't fall! }
Example #6
Source File: IconHelper.java From AgriCraft with MIT License | 6 votes |
@Nonnull public static TextureAtlasSprite registerIcon(@Nonnull ResourceLocation texturePath) { // Validate parameters. Preconditions.checkNotNull(texturePath, "IconHelper cannot register an icon with a null texture path!"); // The icon to be returned. TextureAtlasSprite ret = null; // Attempt to register the sprite to the MineCraft texture map. try { ret = Minecraft.getMinecraft().getTextureMapBlocks().registerSprite(texturePath); } catch (Exception e) { AgriCore.getLogger("agricraft").debug(e.getLocalizedMessage()); } // Return the icon, or the default icon in the case that the icon was null. if (ret != null) { return ret; } else { return getDefaultIcon(); } }
Example #7
Source File: NovaFolderResourcePack.java From NOVA-Core with GNU Lesser General Public License v3.0 | 6 votes |
@Override public Set<ResourceLocation> getLanguageFiles() { Pattern langPattern = Pattern.compile("^[a-zA-Z0-9-]+\\.lang$", Pattern.CASE_INSENSITIVE); Set<ResourceLocation> langFiles = new HashSet<>(); for (String domain : getResourceDomains()) { findFileCaseInsensitive("assets/" + domain + "/lang/").filter(File::isDirectory).ifPresent(file -> { Arrays.stream(file.listFiles((dir, name) -> langPattern.asPredicate().test(name))) .map(File::getName) .forEach(name -> langFiles.add(new ResourceLocation(domain, name))); }); } return langFiles; }
Example #8
Source File: TabCompletionUtil.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
public static List<String> getListOfStringsMatchingLastWord(String[] p_175762_0_, Collection<?> p_175762_1_) { String s = p_175762_0_[p_175762_0_.length - 1]; List<String> list = new ArrayList<>(); if (!p_175762_1_.isEmpty()) { list = p_175762_1_.stream().map(Functions.toStringFunction()::apply).collect(Collectors.toList()).stream().filter(s2 -> doesStringStartWith(s, s2)).collect(Collectors.toList()); if (list.isEmpty()) { for (Object object : p_175762_1_) { if (object instanceof ResourceLocation && doesStringStartWith(s, ((ResourceLocation) object).getResourcePath())) { list.add(String.valueOf(object)); } } } } return list; }
Example #9
Source File: DynamicTextureWrapper.java From MediaMod with GNU General Public License v3.0 | 6 votes |
/** * Get resource location from url * * @param url - url to get the file from * @return ResourceLocation */ public static ResourceLocation getTexture(URL url) { init(); if (!URL_TEXTURES.containsKey(url)) { URL_TEXTURES.put(url, new WrappedResource(null)); queueImage(url); } WrappedResource wr = URL_TEXTURES.get(url); if (wr.location == null) { if (URL_IMAGES.get(url) != null && URL_IMAGES.get(url).image != null) { DynamicTexture texture = new DynamicTexture(URL_IMAGES.get(url).image); WrappedResource wr2 = new WrappedResource(FMLClientHandler.instance().getClient().getTextureManager().getDynamicTextureLocation(url.toString(), texture)); URL_TEXTURES.put(url, wr2); return wr2.location; } else { return FULLY_TRANSPARENT_TEXTURE; } } return wr.location; }
Example #10
Source File: BlockTraverseSapling.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
public BlockTraverseSapling(String name, TraverseTreeGenerator generator) { super(); this.generator = generator; setRegistryName(new ResourceLocation(TraverseConstants.MOD_ID, name + "_sapling")); setTranslationKey(getRegistryName().toString()); setCreativeTab(TraverseTab.TAB); setSoundType(SoundType.PLANT); ShootingStar.registerModel(new ModelCompound(TraverseConstants.MOD_ID, this, "sapling", STAGE, TYPE)); }
Example #11
Source File: ItemBuildersWand.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private ResourceLocation getTemplateResource(ItemStack stack, EntityPlayer player) { int id = this.getSelectionIndex(stack); UUID uuid = NBTUtils.getUUIDFromItemStack(stack, WRAPPER_TAG_NAME, true); String name = NBTUtils.getOrCreateString(stack, WRAPPER_TAG_NAME, "player", player.getName()); return new ResourceLocation(Reference.MOD_ID, name + "_" + uuid.toString() + "_" + id); }
Example #12
Source File: ModuleEffectFrost.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void renderSpell(World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { Vec3d position = spell.getTarget(world); if (position == null) return; ParticleBuilder glitter = new ParticleBuilder(1); glitter.setAlphaFunction(new InterpFloatInOut(0.0f, 0.1f)); glitter.setRender(new ResourceLocation(Wizardry.MODID, NBTConstants.MISC.SPARKLE_BLURRED)); glitter.enableMotionCalculation(); glitter.setScaleFunction(new InterpScale(1, 0)); glitter.setAcceleration(new Vec3d(0, -0.02, 0)); glitter.setCollision(true); glitter.setCanBounce(true); ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), RandUtil.nextInt(5, 15), 0, (aFloat, particleBuilder) -> { double radius = 2; double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat(); double r = radius * RandUtil.nextFloat(); double x = r * MathHelper.cos((float) theta); double z = r * MathHelper.sin((float) theta); glitter.setScale(RandUtil.nextFloat()); glitter.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-2, 2), z)); glitter.setLifetime(RandUtil.nextInt(50, 100)); Vec3d direction = position.add(glitter.getPositionOffset()).subtract(position).normalize().scale(1 / 5); glitter.addMotion(direction.scale(RandUtil.nextDouble(0.5, 1))); }); }
Example #13
Source File: ItemPLRecord.java From Production-Line with MIT License | 5 votes |
public ItemPLRecord(String name, SoundEvent soundEvent) { super(name, soundEvent); this.name = name; this.setCreativeTab(ProductionLine.creativeTabPL); this.setUnlocalizedName(MOD_ID + "." + name); GameRegistry.<Item>register(this, new ResourceLocation(MOD_ID, name)); }
Example #14
Source File: MotionBlurResourceManager.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public List<IResource> getAllResources(ResourceLocation location) throws IOException { return null; }
Example #15
Source File: GuiCustomizeWorld.java From YUNoMakeGoodMap with Apache License 2.0 | 5 votes |
public Info(int width, List<String> lines, ResourceLocation logoPath, Dimension logoDims) { super(GuiCustomizeWorld.this.mc, width, GuiCustomizeWorld.this.height, 32, GuiCustomizeWorld.this.height - 68 + 4, LIST_WIDTH + 20, 60, GuiCustomizeWorld.this.width, GuiCustomizeWorld.this.height); this.lines = resizeContent(lines); this.logoPath = logoPath; this.logoDims = logoDims; this.setHeaderInfo(true, getHeaderHeight()); }
Example #16
Source File: ResearchItem.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon) { this.key = key; this.category = category; this.tags = tags; this.icon_resource = icon; this.icon_item = null; this.displayColumn = col; this.displayRow = row; this.complexity = complex; if (complexity < 1) this.complexity = 1; if (complexity > 3) this.complexity = 3; }
Example #17
Source File: RenderTofuCow.java From TofuCraftReload with MIT License | 5 votes |
/** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityTofuCow entity) { if(entity.getVariant() == 1){ return ZUNDACOW_TEXTURES; }else { return COW_TEXTURES; } }
Example #18
Source File: VanillaModelWrapper.java From VanillaFix with MIT License | 5 votes |
@Override public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { if (!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) { throw new IllegalArgumentException("can't bake vanilla models to the format that doesn't fit into the default one: " + format); } ModelBlock model = this.model; if (model == null) { return BuiltinLoader.WRAPPED_MODEL_MISSING.bake(BuiltinLoader.WRAPPED_MODEL_MISSING.getDefaultState(), format, bakedTextureGetter); } List<TRSRTransformation> newTransforms = Lists.newArrayList(); for (int i = 0; i < model.getElements().size(); i++) { BlockPart part = model.getElements().get(i); newTransforms.add(animation.getPartTransform(state, part, i)); } ItemCameraTransforms transforms = model.getAllTransforms(); Map<ItemCameraTransforms.TransformType, TRSRTransformation> tMap = Maps.newEnumMap(ItemCameraTransforms.TransformType.class); tMap.putAll(PerspectiveMapWrapper.getTransforms(transforms)); tMap.putAll(PerspectiveMapWrapper.getTransforms(state)); IModelState perState = new SimpleModelState(ImmutableMap.copyOf(tMap)); if (hasItemModel(model)) { return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } if (isCustomRenderer(model)) { return new BuiltInModel(transforms, model.createOverrides()); } return bakeNormal(model, perState, state, newTransforms, format, bakedTextureGetter, uvlock); }
Example #19
Source File: ParticleUtils.java From Artifacts with MIT License | 5 votes |
public static ResourceLocation getParticleTexture() { try { return (ResourceLocation)ReflectionHelper.getPrivateValue(EffectRenderer.class, null, new String[] { "particleTextures", "b", "field_110737_b" }); } catch (Exception e) { } return null; }
Example #20
Source File: MetaTileEntityItemCollector.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public MetaTileEntityItemCollector(ResourceLocation metaTileEntityId, int tier, int maxItemSuckingRange) { super(metaTileEntityId, tier); this.maxItemSuckingRange = maxItemSuckingRange; this.itemSuckingRange = maxItemSuckingRange; this.itemFilter = new ItemFilterContainer(this::markDirty); initializeInventory(); }
Example #21
Source File: RenderTiger.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override protected ResourceLocation getEntityTexture(EntityTiger entity) { if(entity.getTigerType() == TigerType.Snow) return texTigerSnow; return texTiger; }
Example #22
Source File: ModuleShapeTouch.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void renderSpell(World world, ModuleInstanceShape instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { IShapeOverrides overrides = spellRing.getOverrideHandler().getConsumerInterface(IShapeOverrides.class); if (overrides.onRenderTouch(world, spell, spellRing)) return; Entity targetEntity = spell.getVictim(world); if (targetEntity == null) return; ParticleBuilder glitter = new ParticleBuilder(1); glitter.setRender(new ResourceLocation(Wizardry.MODID, NBTConstants.MISC.SPARKLE_BLURRED)); ParticleSpawner.spawn(glitter, world, new InterpCircle(targetEntity.getPositionVector().add(0, targetEntity.height / 2.0, 0), new Vec3d(0, 1, 0), 1, 10), 50, RandUtil.nextInt(10, 15), (aFloat, particleBuilder) -> { if (RandUtil.nextBoolean()) { glitter.setColor(spellRing.getPrimaryColor()); glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.1), 0)); } else { glitter.setColor(spellRing.getSecondaryColor()); glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(-0.1, -0.01), 0)); } glitter.setLifetime(RandUtil.nextInt(20, 30)); glitter.setScale((float) RandUtil.nextDouble(0.3, 1)); glitter.setAlphaFunction(new InterpFloatInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1))); glitter.setLifetime(RandUtil.nextInt(10, 20)); glitter.setScaleFunction(new InterpScale(1, 0)); }); }
Example #23
Source File: FWBlockSound.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
@Override public SoundEvent getBreakSound() { return blockSound.getSound(BlockProperty.BlockSound.BlockSoundTrigger.BREAK) .map(sound -> (sound.domain.isEmpty() && !sound.name.contains(".")) ? "dig." + sound.name : sound.getID()) .map(soundID -> SoundEvent.REGISTRY.getObject(new ResourceLocation(soundID))) .orElseGet(super::getBreakSound); }
Example #24
Source File: RegUtil.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
public static <T extends Item> T registerItem(IForgeRegistry<Item> reg, T item, String name) { item.setRegistryName(new ResourceLocation(CommunityGlobals.MOD_ID, name)); item.setTranslationKey(CommunityGlobals.MOD_ID + '.' + name); item.setCreativeTab(CommunityGlobals.TAB); reg.register(item); return item; }
Example #25
Source File: ModuleEffectPoisonCloud.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void renderSpell(World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { Vec3d position = spell.getTarget(world); if (position == null) return; ParticleBuilder glitter = new ParticleBuilder(0); if (RandUtil.nextInt(5) != 0) glitter.setColor(instance.getPrimaryColor()); else glitter.setColor(instance.getSecondaryColor()); glitter.setRender(new ResourceLocation(Wizardry.MODID, NBTConstants.MISC.SMOKE)); ParticleSpawner.spawn(glitter, world, new StaticInterp<>(position), 20, 0, (aFloat, particleBuilder) -> { particleBuilder.setLifetime(RandUtil.nextInt(10, 40)); particleBuilder.setScale(RandUtil.nextFloat(5, 10)); particleBuilder.setAlpha(RandUtil.nextFloat(0.3f, 0.5f)); particleBuilder.setAlphaFunction(new InterpFloatInOut(0.3f, 0.4f)); double area = spellRing.getAttributeValue(world, AttributeRegistry.AREA, spell); double theta = 2.0f * (float) Math.PI * RandUtil.nextFloat(); double r = area * RandUtil.nextFloat(); double x = r * MathHelper.cos((float) theta); double z = r * MathHelper.sin((float) theta); particleBuilder.setPositionOffset(new Vec3d(x, RandUtil.nextDouble(-r, r), z)); particleBuilder.setMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01))); // particleBuilder.setAcceleration(new Vec3d(0, -0.015, 0)); }); }
Example #26
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static Colour[] loadTextureColours(ResourceLocation resource) { int[] idata = loadTextureData(resource); Colour[] data = new Colour[idata.length]; for (int i = 0; i < data.length; i++) data[i] = new ColourARGB(idata[i]); return data; }
Example #27
Source File: BakedModelInserter.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Collection<ResourceLocation> getTextures() { List<ResourceLocation> textures = Lists.newArrayList(); for (String name : this.getTextureMapping().values()) { textures.add(new ResourceLocation(name)); } return textures; }
Example #28
Source File: ItemBuildersWand.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private TemplateEnderUtilities getTemplate(World world, EntityPlayer player, ItemStack stack, PlacementSettings placement) { TemplateManagerEU templateManager = this.getTemplateManager(); ResourceLocation rl = this.getTemplateResource(stack, player); TemplateEnderUtilities template = templateManager.getTemplate(rl); template.setPlacementSettings(placement); return template; }
Example #29
Source File: TexturedItemModel.java From OpenModsLib with MIT License | 5 votes |
private static IModel getModel(Optional<ResourceLocation> model) { if (model.isPresent()) { ResourceLocation location = model.get(); return ModelLoaderRegistry.getModelOrLogError(location, "Couldn't load base-model dependency: " + location); } else { return ModelLoaderRegistry.getMissingModel(); } }
Example #30
Source File: ResearchItem.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon) { this.key = key; this.category = category; this.tags = tags; this.icon_resource = icon; this.icon_item = null; this.displayColumn = col; this.displayRow = row; this.complexity = complex; if (complexity < 1) this.complexity = 1; if (complexity > 3) this.complexity = 3; }