net.minecraft.util.ResourceLocation.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中net.minecraft.util.ResourceLocation.<init>方法的一些代码示例,展示了ResourceLocation.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceLocation.<init>方法的具体详情如下:
包路径:net.minecraft.util.ResourceLocation
类名称:ResourceLocation
方法名:<init>

ResourceLocation.<init>介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

@Override
public boolean isValidMobType(String type) {
  return EntityList.isRegistered(new ResourceLocation(type));
}

代码示例来源:origin: EngineHub/WorldEdit

@Nullable
@Override
public String getName(BlockType blockType) {
  return Block.REGISTRY.getObject(new ResourceLocation(blockType.getId())).getLocalizedName();
}

代码示例来源:origin: EngineHub/WorldEdit

@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
  int x = (this.width - this.backgroundWidth) / 2;
  int y = (this.height - this.backgroundHeight) / 2 - this.closeButton.height;
  GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  this.mc.renderEngine.bindTexture(new ResourceLocation(ForgeWorldEdit.MOD_ID, "textures/gui/reference.png"));
  this.drawTexturedModalRect(x, y, 0, 0, this.backgroundWidth, this.backgroundHeight);
  super.drawScreen(mouseX, mouseY, par3);
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
protected ResourceLocation getEntityTexture(@Nonnull EntityPixie entity) {
  return new ResourceLocation(LibResources.MODEL_PIXIE);
}

代码示例来源:origin: EngineHub/WorldEdit

@Nullable
@Override
public Entity createEntity(Location location, BaseEntity entity) {
  World world = getWorld();
  net.minecraft.entity.Entity createdEntity = EntityList.createEntityByIDFromName(new ResourceLocation(entity.getType().getId()), world);
  if (createdEntity != null) {
    CompoundTag nativeTag = entity.getNbtData();
    if (nativeTag != null) {
      NBTTagCompound tag = NBTConverter.toNative(entity.getNbtData());
      for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
        tag.removeTag(name);
      }
      createdEntity.readFromNBT(tag);
    }
    createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    world.spawnEntity(createdEntity);
    return new ForgeEntity(createdEntity);
  } else {
    return null;
  }
}

代码示例来源:origin: Vazkii/Botania

public ItemMagnetRing(String name, int range) {
  super(name);
  this.range = range;
  addPropertyOverride(new ResourceLocation("botania", "on"), (stack, worldIn, entityIn) -> ItemMagnetRing.getCooldown(stack) <= 0 ? 1 : 0);
}

代码示例来源:origin: Vazkii/Botania

public BreweryRecipeCategory(IGuiHelper guiHelper) {
  ResourceLocation location = new ResourceLocation("botania", "textures/gui/neiBrewery.png");
  background = guiHelper.createDrawable(location, 0, 0, 166, 65, 0, 0, 0, 0);
  localizedName = I18n.format("botania.nei.brewery");
}

代码示例来源:origin: Vazkii/Botania

@Nullable
private static SoundEvent getSound(ItemStack stack) {
  if(isDOIT(stack))
    return ModSounds.doit;
  else return SoundEvent.REGISTRY.getObject(new ResourceLocation(ItemNBTHelper.getString(stack, TAG_SOUND, "")));
}

代码示例来源:origin: Vazkii/Botania

public ItemGrassHorn() {
  super(LibItemNames.GRASS_HORN);
  setMaxStackSize(1);
  setHasSubtypes(true);
  addPropertyOverride(new ResourceLocation(LibMisc.MOD_ID, "vuvuzela"),
      (stack, worldIn, entityIn) -> stack.getDisplayName().toLowerCase(Locale.ROOT).contains("vuvuzela") ? 1 : 0);
}

代码示例来源:origin: Vazkii/Botania

public static void initTC() {
  Item salisMundus = Item.REGISTRY.getObject(new ResourceLocation("thaumcraft", "salis_mundus"));
  Item bathSalts = Item.REGISTRY.getObject(new ResourceLocation("thaumcraft", "bath_salts"));
  Item amber = Item.REGISTRY.getObject(new ResourceLocation("thaumcraft", "amber"));
  warpWardBrew = BotaniaAPI.registerBrewRecipe(ModBrews.warpWard, new ItemStack(Items.NETHER_WART), new ItemStack(salisMundus), new ItemStack(bathSalts), new ItemStack(amber));
}

代码示例来源:origin: Vazkii/Botania

public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
  background = guiHelper.createBlankDrawable(150, 110);
  localizedName = I18n.format("botania.nei.petalApothecary");
  overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
      0, 0, 150, 110);
}

代码示例来源:origin: Vazkii/Botania

public BlockModStairs(IBlockState state, String name) {
  super(state);
  setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
  setTranslationKey(name);
  setCreativeTab(BotaniaCreativeTab.INSTANCE);
  useNeighborBrightness = true;
}

代码示例来源:origin: Vazkii/Botania

public ItemSpawnerMover() {
  super(LibItemNames.SPAWNER_MOVER);
  setMaxStackSize(1);
  addPropertyOverride(new ResourceLocation("botania", "full"), (stack, worldIn, entityIn) -> hasData(stack) ? 1 : 0);
}

代码示例来源:origin: Vazkii/Botania

public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
  background = guiHelper.createBlankDrawable(168, 64);
  localizedName = I18n.format("botania.nei.pureDaisy");
  overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
      0, 0, 64, 46);
}

代码示例来源:origin: Vazkii/Botania

public OrechidIgnemRecipeCategory(IGuiHelper guiHelper) {
  background = guiHelper.createBlankDrawable(168, 64);
  localizedName = I18n.format("botania.nei.orechidIgnem");
  overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
      0, 0, 64, 46);
}

代码示例来源:origin: Vazkii/Botania

@Override
public void readFromPacketNBT(NBTTagCompound cmp) {
  super.readFromPacketNBT(cmp);
  if (cmp.hasKey(TAG_LOOT_TABLE))
    lootTable = new ResourceLocation(cmp.getString(TAG_LOOT_TABLE));
}

代码示例来源:origin: Vazkii/Botania

public OrechidRecipeCategory(IGuiHelper guiHelper) {
  background = guiHelper.createBlankDrawable(168, 64);
  localizedName = I18n.format("botania.nei.orechid");
  overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
      0, 0, 64, 46);
}

代码示例来源:origin: Vazkii/Botania

public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
  background = guiHelper.createBlankDrawable(168, 64);
  localizedName = I18n.format("botania.nei.manaPool");
  overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
      0, 0, 64, 46);
  ItemNBTHelper.setBoolean(renderStack, "RenderFull", true);
}

代码示例来源:origin: Vazkii/Botania

public BlockSolidVines() {
  setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
  setTranslationKey(LibBlockNames.SOLID_VINE);
  setHardness(0.5F);
  setSoundType(SoundType.PLANT);
  setCreativeTab(null);
}

代码示例来源:origin: Vazkii/Botania

public BlockModMushroom() {
  setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.MUSHROOM));
  setTranslationKey(LibBlockNames.MUSHROOM);
  setLightLevel(0.2F);
  setHardness(0F);
  setSoundType(SoundType.PLANT);
  setTickRandomly(false);
  setCreativeTab(BotaniaCreativeTab.INSTANCE);
  setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}

相关文章