net.minecraft.init.Items Java Examples

The following examples show how to use net.minecraft.init.Items. 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: KillAuraModule.java    From seppuku with GNU General Public License v3.0 9 votes vote down vote up
@Listener
public void onWalkingUpdate(EventUpdateWalkingPlayer event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        final Minecraft mc = Minecraft.getMinecraft();

        final Entity target = findTarget();

        if (target != null) {
            final float[] angle = MathUtil.calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), target.getPositionEyes(mc.getRenderPartialTicks()));
            Seppuku.INSTANCE.getRotationManager().setPlayerRotations(angle[0], angle[1]);

            final float ticks = 20.0f - Seppuku.INSTANCE.getTickRateManager().getTickRate();

            final boolean canAttack = this.coolDown.getValue() ? (mc.player.getCooledAttackStrength(this.sync.getValue() ? -ticks : 0.0f) >= 1) : true;

            final ItemStack stack = mc.player.getHeldItem(EnumHand.OFF_HAND);

            //TODO interp
            if (this.teleport.getValue()) {
                Seppuku.INSTANCE.getPositionManager().setPlayerPosition(target.posX, target.posY, target.posZ);
            }

            if (canAttack) {
                if (stack != null && stack.getItem() == Items.SHIELD) {
                    mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, mc.player.getHorizontalFacing()));
                }

                mc.player.connection.sendPacket(new CPacketUseEntity(target));
                mc.player.swingArm(EnumHand.MAIN_HAND);
                mc.player.resetCooldown();
            }
        }
    }
}
 
Example #2
Source File: RedstoneEther.java    From WirelessRedstone with MIT License 6 votes vote down vote up
public static ItemStack[] getColourSetters() {
    if (coloursetters == null) {
        coloursetters = new ItemStack[]{
                new ItemStack(Items.dye, 1, 1),
                new ItemStack(Items.dye, 1, 2),
                new ItemStack(Items.dye, 1, 3),
                new ItemStack(Items.dye, 1, 4),
                new ItemStack(Items.dye, 1, 5),
                new ItemStack(Items.dye, 1, 6),
                new ItemStack(Items.dye, 1, 7),
                new ItemStack(Items.dye, 1, 8),
                new ItemStack(Items.dye, 1, 9),
                new ItemStack(Items.dye, 1, 10),
                new ItemStack(Items.dye, 1, 11),
                new ItemStack(Items.dye, 1, 12),
                new ItemStack(Items.dye, 1, 13),
                new ItemStack(Items.dye, 1, 14),
                new ItemStack(Items.redstone, 1)};
    }
    return coloursetters;
}
 
Example #3
Source File: FireworkRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private void loadAllFireworks() {
    //charges
    Item[] shapes = new Item[]{null, Items.fire_charge, Items.gold_nugget, Items.feather, Items.skull};
    Item[] effects = new Item[]{null, Items.diamond, Items.glowstone_dust};
    for (Item shape : shapes)
        for (Item effect : effects)
            genRecipe(Items.gunpowder, shape, effect, Items.dye, Items.dye, 0);

    //fireworks
    genRecipe(Items.gunpowder, Items.paper, Items.firework_charge, 2);
    genRecipe(Items.gunpowder, Items.gunpowder, Items.paper, Items.firework_charge, 2);
    genRecipe(Items.gunpowder, Items.gunpowder, Items.gunpowder, Items.paper, Items.firework_charge, 2);

    //setup a valid charge to use for the recolour recipe
    for (int i = 0; i < 9; i++)
        inventoryCrafting.setInventorySlotContents(i, null);
    inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.gunpowder));
    inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.dye));
    recipeFireworks.matches(inventoryCrafting, null);
    ItemStack charge = recipeFireworks.getCraftingResult(null);
    genRecipe(charge, Items.dye, Items.dye, 1);
}
 
Example #4
Source File: AutoTotemModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Listener
public void onUpdate(EventPlayerUpdate event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        final Minecraft mc = Minecraft.getMinecraft();

        if(mc.currentScreen == null || mc.currentScreen instanceof GuiInventory) {
            if(mc.player.getHealth() <= this.health.getValue()) {
                final ItemStack offHand = mc.player.getHeldItemOffhand();

                if (offHand.getItem() == Items.TOTEM_OF_UNDYING) {
                    return;
                }

                final int slot = this.getItemSlot(Items.TOTEM_OF_UNDYING);

                if(slot != -1) {
                    mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player);
                    mc.playerController.windowClick(mc.player.inventoryContainer.windowId, 45, 0, ClickType.PICKUP, mc.player);
                    mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player);
                    mc.playerController.updateController();
                }
            }
        }
    }
}
 
Example #5
Source File: TraverseCommon.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void init(FMLInitializationEvent event) {
	for (Block block : TraverseBlocks.oreDictNames.keySet()) {
		OreDictionary.registerOre(TraverseBlocks.oreDictNames.get(block), block);
	}
	for (TraverseWorld.TraverseBiomeEntry traverseBiome : TraverseWorld.biomeList) {
		BiomeManager.addBiome(traverseBiome.getType(), traverseBiome.getEntry());
		if (traverseBiome.hasVillages()) {
			BiomeManager.addVillageBiome(traverseBiome.getBiome(), traverseBiome.canSpawn());
		}
		if (traverseBiome.canSpawn()) {
			BiomeManager.addSpawnBiome(traverseBiome.getBiome());
		}
		BiomeProvider.allowedBiomes.add(traverseBiome.getBiome());
	}

	registerSmeltingRecipe(new ItemStack(Items.COAL, 1, 1), new ItemStack(TUtils.getBlock("fir_log")), 0.15F);
	registerSmeltingRecipe(new ItemStack(TUtils.getBlock("red_rock")), new ItemStack(TUtils.getBlock("red_rock_cobblestone")), 0.1F);
	registerSmeltingRecipe(new ItemStack(TUtils.getBlock("blue_rock")), new ItemStack(TUtils.getBlock("blue_rock_cobblestone")), 0.1F);
}
 
Example #6
Source File: RecipeBalloon.java    From archimedes-ships with MIT License 6 votes vote down vote up
@Override
public ItemStack getCraftingResult(InventoryCrafting inventorycrafting)
{
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 2; j++)
		{
			ItemStack itemstack = inventorycrafting.getStackInRowAndColumn(i, j);
			if (itemstack == null) continue;
			if (itemstack.getItem() == Item.getItemFromBlock(Blocks.wool))
			{
				ItemStack itemstack1 = inventorycrafting.getStackInRowAndColumn(i, j + 1);
				if (itemstack1 != null && itemstack1.getItem() == Items.string)
				{
					return new ItemStack(ArchimedesShipMod.blockBalloon, 1, itemstack.getItemDamage());
				}
				return null;
			}
			return null;
		}
	}
	return null;
}
 
Example #7
Source File: MixinTileEntityFurnace.java    From Production-Line with MIT License 6 votes vote down vote up
@Inject(method = "update", at = @At("RETURN"))
private void onUpdate(CallbackInfo callbackInfo) {
    if (!this.world.isRemote) {
        if (this.isBurning()) {
            ItemStack itemStack = this.furnaceItemStacks[0];
            if (itemStack != null) {
                if (itemStack.getItem() instanceof ItemBlock) {
                    Block block = ((ItemBlock) itemStack.getItem()).block;
                    if (block.getMaterial(block.getStateFromMeta(itemStack.getMetadata())) == Material.TNT) {
                        this.doExplosion();
                    }
                } else if (itemStack.getItem() == Items.GUNPOWDER) {
                    this.doExplosion();
                } else if (itemStack.getItem() instanceof ItemFirework || itemStack.getItem()
                        instanceof ItemFireworkCharge) {
                    this.doExplosion();
                }
            }
        }
    }
}
 
Example #8
Source File: EntityArcher.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void dropFewItems(boolean par1, int par2) {
    int j;
    int k;

    j = this.rand.nextInt(3 + par2);

    for (k = 0; k < j; ++k) {
        this.dropItem(Items.arrow, 1);
    }
    j = this.rand.nextInt(3 + par2);

    for (k = 0; k < j; ++k) {
        this.dropItem(Items.bone, 1);
    }
}
 
Example #9
Source File: TileFloader.java    From YouTubeModdingTutorial with MIT License 6 votes vote down vote up
@Override
public void update() {
    if (!world.isRemote) {
        // Do something is we have a full water block below. We have a feather ready in our inventory
        // and we can find a tank that can accept 100mb of Fload
        IBlockState stateDown = world.getBlockState(pos.down());
        if (stateDown.getBlock() == Blocks.WATER) {
            if (stateDown.getValue(BlockStaticLiquid.LEVEL) == 0) {
                // Test extracting a feather
                ItemStack extracted = inputHandler.extractItem(0, 1, true);
                if (extracted.getItem() == Items.FEATHER) {
                    if (findTankAndFill()) {
                        // All is ok. Really extract the feature and remove the water block
                        world.setBlockToAir(pos.down());
                        inputHandler.extractItem(0, 1, false);
                    }
                }
            }
        }
    }
}
 
Example #10
Source File: EntityMage.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
protected void handleDrinkingPotionUpdate() {
	if (this.attackTimer-- <= 0) {
		this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F,
				0.8F + this.rand.nextFloat() * 0.4F);
		this.setAggressive(false);
		ItemStack itemstack = this.getHeldItemOffhand();
		this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY);

		if (itemstack != null && itemstack.getItem() == Items.POTIONITEM) {
			List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemstack);

			if (list != null) {
				for (PotionEffect potioneffect : list) {
					this.addPotionEffect(new PotionEffect(potioneffect));
				}
			}
		}

		this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(MODIFIER);
	}
}
 
Example #11
Source File: TileEntityBloomeryFurnace.java    From GardenCollection with MIT License 6 votes vote down vote up
public static int getItemBurnTime (ItemStack stack) {
    if (stack == null)
        return 0;

    Item item = stack.getItem();

    if (item instanceof ItemBlock) {
        Block block = Block.getBlockFromItem(item);
        if (block == ModBlocks.stoneBlock && stack.getItemDamage() == 0)
            return ModBlocks.stoneBlock.getBurnTime(stack);
    }

    if (item == Items.coal && stack.getItemDamage() == 1)
        return 1600;

    return 0;
}
 
Example #12
Source File: ComponentMining.java    From Artifacts with MIT License 6 votes vote down vote up
@Override
public float getDigSpeed(ItemStack itemStack, Block block, int meta) {
	ToolMaterial toolMaterial = ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")];
	if(toolMaterial == toolMaterial.WOOD) {
		return (Items.wooden_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial());
	}
	else if(toolMaterial == toolMaterial.STONE) {
		return (Items.stone_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial());
	}
	else if(toolMaterial == toolMaterial.GOLD) {
		return (Items.golden_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial());
	}
	else if(toolMaterial == toolMaterial.IRON) {
		return (Items.iron_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial());
	}
	else if(toolMaterial == toolMaterial.EMERALD) {
		return (Items.diamond_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial());
	}
	return (toolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial());
}
 
Example #13
Source File: ShapedRecipeTests.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test_removeRecipe_both()
{
    ShapedRecipe recipe = gson.fromJson("{ \"shape\": [ \"AA\", \"BB\" ]," +
                                        "\"items\": { \"A\":\"minecraft:stone\", \"B\": { \"item\":\"minecraft:log\" } }," +
                                        "\"result\": \"minecraft:apple\" }", ShapedRecipe.class);

    assertTrue(recipe.removeRecipe(createTestRecipes(Items.APPLE)));
    assertFalse(recipe.removeRecipe(createTestRecipes(Items.DIAMOND_AXE)));
    assertFalse(recipe.removeRecipe(createTestRecipesOre(Items.APPLE)));
}
 
Example #14
Source File: QuestGather.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private static QuestData quest2(Province province, EntityPlayer player) {
	Random rand = player.world.rand;
	QuestData data = baseQuest(province, player);
	List<ItemStack> required = new ArrayList<ItemStack>();
	required.add(new ItemStack(Items.FLINT_AND_STEEL, 1));
	required.add(new ItemStack(Blocks.OBSIDIAN, 10));

	QuestGather.setRequiredItems(data, required);
	List<ItemStack> reward = new ArrayList<ItemStack>();
	reward.add(new ItemStack(Items.EMERALD, 3 + rand.nextInt(2)));
	QuestGather.setRewardItems(data, reward);
	setRewardRep(data, 10);
	return data;
}
 
Example #15
Source File: QuestFarm.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ItemStack> complete(QuestData quest, List<ItemStack> items) {
	if (!quest.getCompleted()) {
		return null;
	}

	Province province = loadProvince(quest.getPlayer().world, quest.getPlayer().getPosition());

	if (province == null || province.id == null || !province.id.equals(quest.getProvinceId())) {
		return null;
	}

	PlayerCivilizationCapability playerCiv = PlayerCivilizationCapabilityImpl.get(quest.getPlayer());

	playerCiv.adjustReputation(quest.getCiv(), new DataWrapper().setData(quest).getRewardRep());

	if (playerCiv.getReputation(province.civilization) > 100 && quest.getPlayer().world.rand.nextInt(10) > 8) {
		ItemStack hoe = new ItemStack(Items.GOLDEN_HOE);
		hoe.setStackDisplayName("Golden Hoe of " + province.name);
		items.add(hoe);
	}

	List<ItemStack> rewards = getRewardItems(quest);
	if (rewards != null) {
		items.addAll(rewards);
	}

	return items;
}
 
Example #16
Source File: GTPPRecipeLoader.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void run() {

    GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ball.get(0L), new FluidStack(FluidRegistry.getFluid("ender"), 250), new ItemStack(Items.ender_pearl, 1, 0), 100, 30);
    //MK4
    GT_Values.RA.addFusionReactorRecipe(Materials.Plutonium241.getMolten(144), Materials.Helium.getGas(1000), ELEMENT.getInstance().CURIUM.getFluid(144), 96, 98304, 500000000);
    GT_Values.RA.addFusionReactorRecipe(ELEMENT.getInstance().CURIUM.getFluid(144), Materials.Helium.getPlasma(144), ELEMENT.getInstance().CALIFORNIUM.getFluid(144), 128, 196608, 750000000);
    GT_Values.RA.addFusionReactorRecipe(Materials.Plutonium241.getMolten(144), Materials.Calcium.getPlasma(144), Materials.Flerovium.getMolten(144), 160, 196608, 1000000000);

}
 
Example #17
Source File: PlayerInteractEventHandler.java    From AgriCraft with MIT License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void denyBonemeal(PlayerInteractEvent.RightClickBlock event) {
    if (!event.getEntityPlayer().isSneaking()) {
        return;
    }
    ItemStack heldItem = event.getEntityPlayer().getActiveItemStack();
    if (!heldItem.isEmpty() && heldItem.getItem() == Items.DYE && heldItem.getItemDamage() == 15) {
        TileEntity te = event.getWorld().getTileEntity(event.getPos());
        if (te != null && (te instanceof TileEntityCrop)) {
            event.setUseItem(Event.Result.DENY);
        }
    }
}
 
Example #18
Source File: DragonBreath.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
public DragonBreath() {
	setPotionEffect("-14+13");
	setTextureName("dragon_breath");
	setContainerItem(Items.glass_bottle);
	setUnlocalizedName(Utils.getUnlocalisedName("dragon_breath"));
	setCreativeTab(EtFuturum.enableLingeringPotions ? EtFuturum.creativeTab : null);
}
 
Example #19
Source File: TileArcanePackager.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean canPack() {
    if (getStackInSlot(11) != null) {
        return false;
    }

    boolean check = false;
    for (int i = 0; i < 9; i++) {
        if (getStackInSlot(i) != null) {
            check = true;
            break;
        }
    }

    if (!check) {
        return false;
    }

    if (useEssentia) {
        if (amount < 4) {
            return false;
        }
    } else {
        ItemStack leather = getStackInSlot(9);
        if (leather == null || leather.stackSize < 1 || leather.getItem() != Items.leather) {
            return false;
        }

        ItemStack string = getStackInSlot(10);
        if (string == null || string.stackSize < 1 || string.getItem() != Items.string) {
            return false;
        }
    }

    return true;
}
 
Example #20
Source File: EntityExplodingChicken.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
 * use this to react to sunlight and start to burn.
 */
public void onLivingUpdate()
{
    super.onLivingUpdate();
    this.oFlap = this.wingRotation;
    this.oFlapSpeed = this.destPos;
    this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D);
    this.destPos = MathHelper.clamp(this.destPos, 0.0F, 1.0F);

    if (!this.onGround && this.wingRotDelta < 1.0F)
    {
        this.wingRotDelta = 1.0F;
    }

    this.wingRotDelta = (float)((double)this.wingRotDelta * 0.9D);

    if (!this.onGround && this.motionY < 0.0D)
    {
        this.motionY *= 0.6D;
    }

    this.wingRotation += this.wingRotDelta * 2.0F;

    if (!this.world.isRemote && !this.isChild() && !this.isChickenJockey() && --this.timeUntilNextEgg <= 0)
    {
        this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
        this.dropItem(Items.EGG, 1);
        this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
    }
}
 
Example #21
Source File: Thaumcraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(){
    ItemStack lapis = new ItemStack(Items.dye, 1, 4);
    Item shard = GameRegistry.findItem(ModIds.THAUMCRAFT, "ItemShard");
    if(shard != null) {
        GameRegistry.addRecipe(new ItemStack(Itemss.machineUpgrade, 1, 10), "lal", "bcd", "lel", 'l', lapis, 'a', new ItemStack(shard, 1, 0), 'b', new ItemStack(shard, 1, 1), 'c', new ItemStack(shard, 1, 6), 'd', new ItemStack(shard, 1, 3), 'e', new ItemStack(shard, 1, 4));
    } else {
        Log.error("Thaumcraft shard item couldn't be found! Registry name has changed? Thaumcraft Upgrade has no recipe!");
    }
}
 
Example #22
Source File: GTTileBedrockMiner.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void addSlots(InventoryHandler handler) {
	handler.registerDefaultSideAccess(AccessRule.Both, RotationList.ALL);
	handler.registerDefaultSlotAccess(AccessRule.Import, SLOT_INPUTS);
	handler.registerDefaultSlotAccess(AccessRule.Export, SLOT_OUTPUTS);
	handler.registerDefaultSlotsForSide(RotationList.DOWN.invert(), SLOT_ALLVALID);
	handler.registerInputFilter(new ArrayFilter(CommonFilters.DischargeEU, new BasicItemFilter(Items.REDSTONE), new BasicItemFilter(Ic2Items.suBattery)), SLOT_FUEL);
	handler.registerOutputFilter(CommonFilters.NotDischargeEU, SLOT_FUEL);
	handler.registerSlotType(SlotType.Fuel, SLOT_FUEL);
	handler.registerSlotType(SlotType.Input, SLOT_INPUTS);
	handler.registerSlotType(SlotType.Output, SLOT_OUTPUTS);
}
 
Example #23
Source File: BaitManager.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Check if our Player is holding a Fishing Rod, and filters out the Grapple Hook (If any more items are made that
 * are Items.fishing_rods but aren't used for fishing, add them here)
 *
 * @return True if it can be used for fishing
 */
public boolean isHoldingRod() {
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;

    if (player != null) {
        ItemStack item = player.getHeldItem();
        if (item == null || item.getItem() != Items.fishing_rod) return false;

        return !"GRAPPLING_HOOK".equals(ItemUtils.getSkyBlockItemID(item));
    }
    return false;
}
 
Example #24
Source File: ItemFilterDeserializerTest.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test_machineFuel()
{
    MachineManager.addFuel(new ResourceLocation("someFuel"), new TestMachineFuel());
    Map<String, ItemFilter> map = gson.fromJson("{\"filter\": \"machineFuel:someFuel\"}", new TypeToken<Map<String, ItemFilter>>() {}.getType());

    ItemFilter filter = map.get("filter");

    assertTrue(filter.accepts(new ItemStack(Items.STICK)));
    assertTrue(filter.accepts(new ItemStack(Items.IRON_INGOT)));
    assertFalse(filter.accepts(new ItemStack(Items.GOLD_INGOT)));
}
 
Example #25
Source File: AutoLog.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onLocalPlayerUpdate(LocalPlayerUpdateEvent event) {
  if (MC.player != null) {
    int health = (int) (MC.player.getHealth() + MC.player.getAbsorptionAmount());
    if (health <= threshold.get()
        || (noTotem.getAsBoolean()
        && !((MC.player.getHeldItemOffhand().getItem() == Items.TOTEM_OF_UNDYING)
        || MC.player.getHeldItemMainhand().getItem() == Items.TOTEM_OF_UNDYING))) {
      AutoReconnectMod.hasAutoLogged = true;
      getNetworkManager()
          .closeChannel(new TextComponentString("Health too low (" + health + ")"));
      disable();
    }
  }
}
 
Example #26
Source File: EntityFallenMount.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
  ItemStack itemstack = player.inventory.getCurrentItem();
  if(itemstack.getItem() == Items.SPAWN_EGG) {
    return super.processInteract(player, hand);
  }
  return false;
}
 
Example #27
Source File: RegenModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
private int findEmptyHotbar() {
    for (int i = 0; i < 9; i++) {
        final ItemStack stack = Minecraft.getMinecraft().player.inventory.getStackInSlot(i);

        if (stack.getItem() == Items.AIR) {
            return i;
        }
    }
    return -1;
}
 
Example #28
Source File: WRLogicProxy.java    From WirelessRedstone with MIT License 5 votes vote down vote up
private static void addRecipies()
{
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemwireless, 1, 0),
            "t  ",
            "srr",
            "fff",
            't', WirelessRedstoneCore.wirelessTransceiver,
            's', "obsidianRod",
            'f', new ItemStack(Blocks.stone_slab, 1, 0),
            'r', Items.redstone));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemwireless, 1, 1),
            "d  ",
            "srr",
            "fff",
            'd', WirelessRedstoneCore.recieverDish,
            's', "obsidianRod",
            'f', new ItemStack(Blocks.stone_slab, 1, 0),
            'r', Items.redstone));
    
    GameRegistry.addRecipe(new ItemStack(itemwireless, 1, 2),
            "p  ",
            "srr",
            "fff",
            'p', WirelessRedstoneCore.blazeTransceiver,
            's', Items.blaze_rod,
            'f', new ItemStack(Blocks.stone_slab, 1, 0),
            'r', Items.redstone);
}
 
Example #29
Source File: ItemUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static ItemStack storeTEInStack(ItemStack stack, TileEntity te)
{
    NBTTagCompound nbt = te.writeToNBT(new NBTTagCompound());

    if (stack.getItem() == Items.SKULL && nbt.hasKey("Owner"))
    {
        NBTTagCompound tagOwner = nbt.getCompoundTag("Owner");
        NBTTagCompound tagSkull = new NBTTagCompound();

        tagSkull.setTag("SkullOwner", tagOwner);
        stack.setTagCompound(tagSkull);

        return stack;
    }
    else
    {
        NBTTagCompound tagLore = new NBTTagCompound();
        NBTTagList tagList = new NBTTagList();

        tagList.appendTag(new NBTTagString("(+NBT)"));
        tagLore.setTag("Lore", tagList);
        stack.setTagInfo("display", tagLore);
        stack.setTagInfo("BlockEntityTag", nbt);

        return stack;
    }
}
 
Example #30
Source File: ShapedRecipeTests.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void test_removeRecipe_onlyInput_ore()
{
    ShapedRecipe recipe = gson.fromJson("{ \"shape\": [ \"AA\", \"BB\" ]," +
                                        "\"items\": { \"A\":\"minecraft:stone\", \"B\": \"oreclass:stickWood\" } }", ShapedRecipe.class);

    assertFalse(recipe.removeRecipe(createTestRecipes(Items.APPLE)));
    assertTrue(recipe.removeRecipe(createTestRecipesOre(Items.APPLE)));
}