mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 05:33:00 +00:00 
			
		
		
		
	remap with yarrnforge
This commit is contained in:
		| @@ -1,57 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of ComputerCraft - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission. | ||||
|  * Send enquiries to dratcliffe@gmail.com | ||||
|  */ | ||||
|  | ||||
| package dan200.computercraft.api.pocket; | ||||
|  | ||||
| import javax.annotation.Nonnull; | ||||
|  | ||||
| import net.minecraft.item.ItemConvertible; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.util.Identifier; | ||||
| import net.minecraft.util.Util; | ||||
|  | ||||
| /** | ||||
|  * A base class for {@link IPocketUpgrade}s. | ||||
|  * | ||||
|  * One does not have to use this, but it does provide a convenient template. | ||||
|  */ | ||||
| public abstract class AbstractPocketUpgrade implements IPocketUpgrade { | ||||
|     private final Identifier id; | ||||
|     private final String adjective; | ||||
|     private final ItemStack stack; | ||||
|  | ||||
|     protected AbstractPocketUpgrade(Identifier identifier, String adjective, ItemConvertible item) { | ||||
|         this(identifier, adjective, new ItemStack(item)); | ||||
|     } | ||||
|  | ||||
|     protected AbstractPocketUpgrade(Identifier id, String adjective, ItemStack stack) { | ||||
|         this.id = id; | ||||
|         this.adjective = adjective; | ||||
|         this.stack = stack; | ||||
|     } | ||||
|  | ||||
|     protected AbstractPocketUpgrade(Identifier id, ItemConvertible item) { | ||||
|         this(id, Util.createTranslationKey("upgrade", id) + ".adjective", new ItemStack(item)); | ||||
|     } | ||||
|  | ||||
|     @Nonnull | ||||
|     @Override | ||||
|     public final Identifier getUpgradeID() { | ||||
|         return this.id; | ||||
|     } | ||||
|  | ||||
|     @Nonnull | ||||
|     @Override | ||||
|     public final String getUnlocalisedAdjective() { | ||||
|         return this.adjective; | ||||
|     } | ||||
|  | ||||
|     @Nonnull | ||||
|     @Override | ||||
|     public final ItemStack getCraftingItem() { | ||||
|         return this.stack; | ||||
|     } | ||||
| } | ||||
| @@ -1,98 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of the public ComputerCraft API - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only. | ||||
|  * For help using the API, and posting your mods, visit the forums at computercraft.info. | ||||
|  */ | ||||
|  | ||||
| package dan200.computercraft.api.pocket; | ||||
|  | ||||
| import java.util.Map; | ||||
|  | ||||
| import javax.annotation.Nonnull; | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
|  | ||||
| import net.minecraft.entity.Entity; | ||||
| import net.minecraft.nbt.CompoundTag; | ||||
| import net.minecraft.util.Identifier; | ||||
|  | ||||
| /** | ||||
|  * Wrapper class for pocket computers | ||||
|  */ | ||||
| public interface IPocketAccess { | ||||
|     /** | ||||
|      * Gets the entity holding this item. | ||||
|      * | ||||
|      * This must be called on the server thread. | ||||
|      * | ||||
|      * @return The holding entity, or {@code null} if none exists. | ||||
|      */ | ||||
|     @Nullable | ||||
|     Entity getEntity(); | ||||
|  | ||||
|     /** | ||||
|      * Get the colour of this pocket computer as a RGB number. | ||||
|      * | ||||
|      * @return The colour this pocket computer is. This will be a RGB colour between {@code 0x000000} and {@code 0xFFFFFF} or -1 if it has no colour. | ||||
|      * @see #setColour(int) | ||||
|      */ | ||||
|     int getColour(); | ||||
|  | ||||
|     /** | ||||
|      * Set the colour of the pocket computer to a RGB number. | ||||
|      * | ||||
|      * @param colour The colour this pocket computer should be changed to. This should be a RGB colour between {@code 0x000000} and {@code 0xFFFFFF} or | ||||
|      *     -1 to reset to the default colour. | ||||
|      * @see #getColour() | ||||
|      */ | ||||
|     void setColour(int colour); | ||||
|  | ||||
|     /** | ||||
|      * Get the colour of this pocket computer's light as a RGB number. | ||||
|      * | ||||
|      * @return The colour this light is. This will be a RGB colour between {@code 0x000000} and {@code 0xFFFFFF} or -1 if it has no colour. | ||||
|      * @see #setLight(int) | ||||
|      */ | ||||
|     int getLight(); | ||||
|  | ||||
|     /** | ||||
|      * Set the colour of the pocket computer's light to a RGB number. | ||||
|      * | ||||
|      * @param colour The colour this modem's light will be changed to. This should be a RGB colour between {@code 0x000000} and {@code 0xFFFFFF} or -1 | ||||
|      *     to reset to the default colour. | ||||
|      * @see #getLight() | ||||
|      */ | ||||
|     void setLight(int colour); | ||||
|  | ||||
|     /** | ||||
|      * Get the upgrade-specific NBT. | ||||
|      * | ||||
|      * This is persisted between computer reboots and chunk loads. | ||||
|      * | ||||
|      * @return The upgrade's NBT. | ||||
|      * @see #updateUpgradeNBTData() | ||||
|      */ | ||||
|     @Nonnull | ||||
|     CompoundTag getUpgradeNBTData(); | ||||
|  | ||||
|     /** | ||||
|      * Mark the upgrade-specific NBT as dirty. | ||||
|      * | ||||
|      * @see #getUpgradeNBTData() | ||||
|      */ | ||||
|     void updateUpgradeNBTData(); | ||||
|  | ||||
|     /** | ||||
|      * Remove the current peripheral and create a new one. You may wish to do this if the methods available change. | ||||
|      */ | ||||
|     void invalidatePeripheral(); | ||||
|  | ||||
|     /** | ||||
|      * Get a list of all upgrades for the pocket computer. | ||||
|      * | ||||
|      * @return A collection of all upgrade names. | ||||
|      */ | ||||
|     @Nonnull | ||||
|     Map<Identifier, IPeripheral> getUpgrades(); | ||||
| } | ||||
| @@ -1,99 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of the public ComputerCraft API - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2019. This API may be redistributed unmodified and in full only. | ||||
|  * For help using the API, and posting your mods, visit the forums at computercraft.info. | ||||
|  */ | ||||
|  | ||||
| package dan200.computercraft.api.pocket; | ||||
|  | ||||
| import javax.annotation.Nonnull; | ||||
| import javax.annotation.Nullable; | ||||
|  | ||||
| import dan200.computercraft.api.ComputerCraftAPI; | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
| import dan200.computercraft.api.turtle.ITurtleUpgrade; | ||||
|  | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.util.Identifier; | ||||
| import net.minecraft.world.World; | ||||
|  | ||||
| /** | ||||
|  * Additional peripherals for pocket computers. | ||||
|  * | ||||
|  * This is similar to {@link ITurtleUpgrade}. | ||||
|  */ | ||||
| public interface IPocketUpgrade { | ||||
|  | ||||
|     /** | ||||
|      * Gets a unique identifier representing this type of turtle upgrade. eg: "computercraft:wireless_modem" or "my_mod:my_upgrade". | ||||
|      * | ||||
|      * You should use a unique resource domain to ensure this upgrade is uniquely identified. The upgrade will fail registration if an already used ID is | ||||
|      * specified. | ||||
|      * | ||||
|      * @return The upgrade's id. | ||||
|      * @see IPocketUpgrade#getUpgradeID() | ||||
|      * @see ComputerCraftAPI#registerPocketUpgrade(IPocketUpgrade) | ||||
|      */ | ||||
|     @Nonnull | ||||
|     Identifier getUpgradeID(); | ||||
|  | ||||
|     /** | ||||
|      * Return an unlocalised string to describe the type of pocket computer this upgrade provides. | ||||
|      * | ||||
|      * An example of a built-in adjectives is "Wireless" - this is converted to "Wireless Pocket Computer". | ||||
|      * | ||||
|      * @return The unlocalised adjective. | ||||
|      * @see ITurtleUpgrade#getUnlocalisedAdjective() | ||||
|      */ | ||||
|     @Nonnull | ||||
|     String getUnlocalisedAdjective(); | ||||
|  | ||||
|     /** | ||||
|      * Return an item stack representing the type of item that a pocket computer must be crafted with to create a pocket computer which holds this upgrade. | ||||
|      * This item stack is also used to determine the upgrade given by {@code pocket.equip()}/{@code pocket.unequip()}. | ||||
|      * | ||||
|      * Ideally this should be constant over a session. It is recommended that you cache the item too, in order to prevent constructing it every time the | ||||
|      * method is called. | ||||
|      * | ||||
|      * @return The item stack used for crafting. This can be {@link ItemStack#EMPTY} if crafting is disabled. | ||||
|      */ | ||||
|     @Nonnull | ||||
|     ItemStack getCraftingItem(); | ||||
|  | ||||
|     /** | ||||
|      * Creates a peripheral for the pocket computer. | ||||
|      * | ||||
|      * The peripheral created will be stored for the lifetime of the upgrade, will be passed an argument to {@link #update(IPocketAccess, IPeripheral)} and | ||||
|      * will be attached, detached and have methods called in the same manner as an ordinary peripheral. | ||||
|      * | ||||
|      * @param access The access object for the pocket item stack. | ||||
|      * @return The newly created peripheral. | ||||
|      * @see #update(IPocketAccess, IPeripheral) | ||||
|      */ | ||||
|     @Nullable | ||||
|     IPeripheral createPeripheral(@Nonnull IPocketAccess access); | ||||
|  | ||||
|     /** | ||||
|      * Called when the pocket computer item stack updates. | ||||
|      * | ||||
|      * @param access The access object for the pocket item stack. | ||||
|      * @param peripheral The peripheral for this upgrade. | ||||
|      * @see #createPeripheral(IPocketAccess) | ||||
|      */ | ||||
|     default void update(@Nonnull IPocketAccess access, @Nullable IPeripheral peripheral) { | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Called when the pocket computer is right clicked. | ||||
|      * | ||||
|      * @param world The world the computer is in. | ||||
|      * @param access The access object for the pocket item stack. | ||||
|      * @param peripheral The peripheral for this upgrade. | ||||
|      * @return {@code true} to stop the GUI from opening, otherwise false. You should always provide some code path which returns {@code false}, such as | ||||
|      *     requiring the player to be sneaking - otherwise they will be unable to access the GUI. | ||||
|      * @see #createPeripheral(IPocketAccess) | ||||
|      */ | ||||
|     default boolean onRightClick(@Nonnull World world, @Nonnull IPocketAccess access, @Nullable IPeripheral peripheral) { | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Devan-Kerman
					Devan-Kerman