diff options
author | miozune <miozune@gmail.com> | 2023-05-17 00:01:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-16 17:01:01 +0200 |
commit | 04514282c08ebefdb3e68a46db34092f72be2316 (patch) | |
tree | 0c9bc99f480f7e7f45a99a55a5b6619ebb5b014b /src/main/java/gtPlusPlus/xmod/gregtech/api | |
parent | cd58ff7cd4dc4b5ffe917a24a4b4c6da577f462d (diff) | |
download | GT5-Unofficial-04514282c08ebefdb3e68a46db34092f72be2316.tar.gz GT5-Unofficial-04514282c08ebefdb3e68a46db34092f72be2316.tar.bz2 GT5-Unofficial-04514282c08ebefdb3e68a46db34092f72be2316.zip |
Remove a lot of unused classes (#629)
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api')
29 files changed, 0 insertions, 3279 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java deleted file mode 100644 index 78b5cced08..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItem.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.energy; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Provides the ability to store energy on the implementing item. - * - * The item should have a maximum damage of 13. - */ -public interface IC2ElectricItem { - - /** - * Determine if the item can be used in a machine or as an armor part to supply energy. - * - * @return Whether the item can supply energy - */ - boolean canProvideEnergy(ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy greater than 0. - * - * @return Item ID to use - */ - Item getChargedItem(ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy of 0. - * - * @return Item ID to use - */ - Item getEmptyItem(ItemStack itemStack); - - /** - * Get the item's maximum charge energy in EU. - * - * @return Maximum charge energy - */ - double getMaxCharge(ItemStack itemStack); - - /** - * Get the item's tier, lower tiers can't send energy to higher ones. Batteries are Tier 1, Energy Crystals are Tier - * 2, Lapotron Crystals are Tier 3. - * - * @return Item's tier - */ - int getTier(ItemStack itemStack); - - /** - * Get the item's transfer limit in EU per transfer operation. - * - * @return Transfer limit - */ - double getTransferLimit(ItemStack itemStack); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java deleted file mode 100644 index 007d66de66..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/energy/IC2ElectricItemManager.java +++ /dev/null @@ -1,94 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.energy; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * This interface specifies a manager to handle the various tasks for electric items. - * - * The default implementation does the following: - store and retrieve the charge - handle charging, taking amount, - * tier, transfer limit, canProvideEnergy and simulate into account - replace item IDs if appropriate - * (getChargedItemId() and getEmptyItemId()) - update and manage the damage value for the visual charge indicator - * - * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the default implementations - * through ElectricItem.rawManager. The default implementation is designed to minimize its dependency on its own - * constraints/structure and delegates most work back to the more atomic features in the gateway manager. - */ -public interface IC2ElectricItemManager { - - /** - * Charge an item with a specified amount of energy. - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the charging device, has to be at least as high as the item to charge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually change the item, just determine the return value - * @return Energy transferred into the electric item - */ - double charge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Discharge an item by a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param tier tier of the discharging device, has to be at least as high as the item to discharge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param externally use the supplied item externally, i.e. to power something else as if it was a battery - * @param simulate don't actually discharge the item, just determine the return value - * @return Energy retrieved from the electric item - */ - double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, - boolean simulate); - - /** - * Determine the charge level for the specified item. - * - * @param itemStack ItemStack containing the electric item - * @return charge level in EU - */ - double getCharge(ItemStack stack); - - /** - * Determine if the specified electric item has at least a specific amount of EU. This is supposed to be used in the - * item code during operation, for example if you want to implement your own electric item. BatPacks are not taken - * into account. - * - * @param itemStack electric item's stack - * @param amount minimum amount of energy required - * @return true if there's enough energy - */ - boolean canUse(ItemStack stack, double amount); - - /** - * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. This is supposed to be - * used in the item code during operation, for example if you want to implement your own electric item. - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param entity entity holding the item - * @return true if the operation succeeded - */ - boolean use(ItemStack stack, double amount, EntityLivingBase entity); - - /** - * Charge an item from the BatPack a player is wearing. This is supposed to be used in the item code during - * operation, for example if you want to implement your own electric item. use() already contains this - * functionality. - * - * @param itemStack electric item's stack - * @param entity entity holding the item - */ - void chargeFromArmor(ItemStack stack, EntityLivingBase entity); - - /** - * Get the tool tip to display for electric items. - * - * @param itemStack ItemStack to determine the tooltip for - * @return tool tip string or null for none - */ - String getToolTip(ItemStack stack); - - // TODO: add tier getter -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java deleted file mode 100644 index 74c9d9ee5b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/CustomGtTextures.java +++ /dev/null @@ -1,83 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import gregtech.api.GregTech_API; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.lib.CORE; - -public class CustomGtTextures { - - public enum ItemIcons implements IIconContainer, Runnable { - - VOID, // The Empty Texture - RENDERING_ERROR, - PUMP, - SKOOKUMCHOOCHER; - - public static final ITexture[] ERROR_RENDERING = new ITexture[] { new GT_RenderedTexture(RENDERING_ERROR) }; - - protected IIcon mIcon, mOverlay; - - private ItemIcons() { - GregTech_API.sGTItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return this.mOverlay; - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - - @Override - public void run() { - this.mIcon = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + "iconsets/" + this); - this.mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + "iconsets/" + this + "_OVERLAY"); - } - - public static class CustomIcon implements IIconContainer, Runnable { - - protected IIcon mIcon, mOverlay; - protected String mIconName; - - public CustomIcon(final String aIconName) { - this.mIconName = aIconName; - GregTech_API.sGTItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return this.mOverlay; - } - - @Override - public void run() { - this.mIcon = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + this.mIconName); - this.mOverlay = GregTech_API.sItemIcons.registerIcon(CORE.RES_PATH_ITEM + this.mIconName + "_OVERLAY"); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java deleted file mode 100644 index 87d85a578e..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextureSet.java +++ /dev/null @@ -1,159 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; - -public class GregtechTextureSet { - - public static final GregtechTextureSet SET_NONE = new GregtechTextureSet("NONE"), - SET_DULL = new GregtechTextureSet("DULL"), SET_RUBY = new GregtechTextureSet("RUBY"), - SET_OPAL = new GregtechTextureSet("OPAL"), SET_LEAF = new GregtechTextureSet("LEAF"), - SET_WOOD = new GregtechTextureSet("WOOD"), SET_SAND = new GregtechTextureSet("SAND"), - SET_FINE = new GregtechTextureSet("FINE"), SET_FIERY = new GregtechTextureSet("FIERY"), - SET_FLUID = new GregtechTextureSet("FLUID"), SET_ROUGH = new GregtechTextureSet("ROUGH"), - SET_PAPER = new GregtechTextureSet("PAPER"), SET_GLASS = new GregtechTextureSet("GLASS"), - SET_FLINT = new GregtechTextureSet("FLINT"), SET_LAPIS = new GregtechTextureSet("LAPIS"), - SET_SHINY = new GregtechTextureSet("SHINY"), SET_SHARDS = new GregtechTextureSet("SHARDS"), - SET_POWDER = new GregtechTextureSet("POWDER"), SET_QUARTZ = new GregtechTextureSet("QUARTZ"), - SET_EMERALD = new GregtechTextureSet("EMERALD"), SET_DIAMOND = new GregtechTextureSet("DIAMOND"), - SET_LIGNITE = new GregtechTextureSet("LIGNITE"), SET_MAGNETIC = new GregtechTextureSet("MAGNETIC"), - SET_METALLIC = new GregtechTextureSet("METALLIC"), SET_NETHERSTAR = new GregtechTextureSet("NETHERSTAR"), - SET_GEM_VERTICAL = new GregtechTextureSet("GEM_VERTICAL"), - SET_GEM_HORIZONTAL = new GregtechTextureSet("GEM_HORIZONTAL"); - - public final IIconContainer[] mTextures = new IIconContainer[128]; - public final String mSetName; - - public GregtechTextureSet(final String aSetName) { - this.mSetName = aSetName; - this.mTextures[0] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/turbineBlade"); - this.mTextures[1] = new Textures.ItemIcons.CustomIcon( - "materialicons/" + this.mSetName + "/toolHeadSkookumChoocher"); - this.mTextures[2] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[3] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[4] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[5] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[6] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[7] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[8] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[9] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[10] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[11] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[12] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[13] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[14] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[15] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[16] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[17] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[18] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[19] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[20] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[21] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[22] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[23] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[24] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[25] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[26] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[27] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[28] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[29] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[30] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[31] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[32] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[33] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[34] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[35] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[36] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[37] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[38] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[39] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[40] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[41] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[42] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[43] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[44] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[45] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[46] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[47] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[48] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[49] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[50] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[51] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[52] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[53] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[54] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[55] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[56] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[57] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[58] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[59] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[60] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[61] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[62] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[63] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[64] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[65] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[66] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[67] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[68] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[69] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[70] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[71] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[72] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[73] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[74] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[75] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[76] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[77] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[78] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[79] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[80] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[81] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[82] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[83] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[84] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[85] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[86] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[87] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[88] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[89] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[90] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[91] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[92] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[93] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[94] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[95] = new Textures.BlockIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[96] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[97] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[98] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[99] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[100] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[101] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[102] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[103] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[104] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[105] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[106] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[107] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[108] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[109] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[110] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[111] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[112] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[113] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[114] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[115] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[116] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[117] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[118] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[119] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[120] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[121] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[122] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[123] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[124] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[125] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[126] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - this.mTextures[127] = new Textures.ItemIcons.CustomIcon("materialicons/" + this.mSetName + "/void"); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java deleted file mode 100644 index 1b9a88e230..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechTextures.java +++ /dev/null @@ -1,188 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.enums; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_IconContainer; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_Texture; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -public class GregtechTextures { - - public enum BlockIcons implements Interface_IconContainer, Runnable { - - VOID, - - LARGECENTRIFUGE1, - LARGECENTRIFUGE2, - LARGECENTRIFUGE3, - LARGECENTRIFUGE4, - LARGECENTRIFUGE5, - LARGECENTRIFUGE6, - LARGECENTRIFUGE7, - LARGECENTRIFUGE8, - LARGECENTRIFUGE9, - LARGECENTRIFUGE_ACTIVE1, - LARGECENTRIFUGE_ACTIVE2, - LARGECENTRIFUGE_ACTIVE3, - LARGECENTRIFUGE_ACTIVE4, - LARGECENTRIFUGE_ACTIVE5, - LARGECENTRIFUGE_ACTIVE6, - LARGECENTRIFUGE_ACTIVE7, - LARGECENTRIFUGE_ACTIVE8, - LARGECENTRIFUGE_ACTIVE9; - - public static final Interface_IconContainer[] CENTRIFUGE = new Interface_IconContainer[] { LARGECENTRIFUGE1, - LARGECENTRIFUGE2, LARGECENTRIFUGE3, LARGECENTRIFUGE4, LARGECENTRIFUGE5, LARGECENTRIFUGE6, - LARGECENTRIFUGE7, LARGECENTRIFUGE8, LARGECENTRIFUGE9 }, - CENTRIFUGE_ACTIVE = new Interface_IconContainer[] { LARGECENTRIFUGE_ACTIVE1, LARGECENTRIFUGE_ACTIVE2, - LARGECENTRIFUGE_ACTIVE3, LARGECENTRIFUGE_ACTIVE4, LARGECENTRIFUGE_ACTIVE5, - LARGECENTRIFUGE_ACTIVE6, LARGECENTRIFUGE_ACTIVE7, LARGECENTRIFUGE_ACTIVE8, - LARGECENTRIFUGE_ACTIVE9 }; - - public static Interface_Texture[] GT_CASING_BLOCKS = new Interface_Texture[64]; - - protected IIcon mIcon; - - private BlockIcons() { - Meta_GT_Proxy.GT_BlockIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return null; - } - - @Override - public void run() { - this.mIcon = Meta_GT_Proxy.sBlockIcons.registerIcon(GTPlusPlus.ID + ":" + "iconsets/" + this); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; - } - - public static class CustomIcon implements Interface_IconContainer, Runnable { - - protected IIcon mIcon; - protected String mIconName; - - public CustomIcon(final String aIconName) { - this.mIconName = aIconName; - Meta_GT_Proxy.GT_BlockIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return null; - } - - @Override - public void run() { - this.mIcon = Meta_GT_Proxy.sBlockIcons.registerIcon(GTPlusPlus.ID + ":" + this.mIconName); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; - } - } - } - - public enum ItemIcons implements Interface_IconContainer, Runnable { - - VOID, // The Empty Texture - RENDERING_ERROR, // The Purple/Black Texture - SKOOKUMCHOOCHER, // The Skookum Tool Texture - PUMP, // The Hand Pump Texture - TURBINE_SMALL, - TURBINE_LARGE, - TURBINE_HUGE; - - /* - * public static final Interface_IconContainer[] DURABILITY_BAR = new Interface_IconContainer[]{ - * DURABILITY_BAR_0, DURABILITY_BAR_1, DURABILITY_BAR_2, DURABILITY_BAR_3, DURABILITY_BAR_4, DURABILITY_BAR_5, - * DURABILITY_BAR_6, DURABILITY_BAR_7, DURABILITY_BAR_8, }, ENERGY_BAR = new Interface_IconContainer[]{ - * ENERGY_BAR_0, ENERGY_BAR_1, ENERGY_BAR_2, ENERGY_BAR_3, ENERGY_BAR_4, ENERGY_BAR_5, ENERGY_BAR_6, - * ENERGY_BAR_7, ENERGY_BAR_8, }; - */ - - // public static final Interface_Texture[] ERROR_RENDERING = new Interface_Texture[]{new - // GregtechRenderedTexture(RENDERING_ERROR)}; - - protected IIcon mIcon, mOverlay; - - private ItemIcons() { - Meta_GT_Proxy.GT_ItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return this.mOverlay; - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - - @Override - public void run() { - this.mIcon = Meta_GT_Proxy.sItemIcons.registerIcon(GTPlusPlus.ID + ":" + "iconsets/" + this); - this.mOverlay = Meta_GT_Proxy.sItemIcons - .registerIcon(GTPlusPlus.ID + ":" + "iconsets/" + this + "_OVERLAY"); - } - - public static class CustomIcon implements Interface_IconContainer, Runnable { - - protected IIcon mIcon, mOverlay; - protected String mIconName; - - public CustomIcon(final String aIconName) { - this.mIconName = aIconName; - Meta_GT_Proxy.GT_ItemIconload.add(this); - } - - @Override - public IIcon getIcon() { - return this.mIcon; - } - - @Override - public IIcon getOverlayIcon() { - return this.mOverlay; - } - - @Override - public void run() { - this.mIcon = Meta_GT_Proxy.sItemIcons.registerIcon(GTPlusPlus.ID + ":" + this.mIconName); - this.mOverlay = Meta_GT_Proxy.sItemIcons - .registerIcon(GTPlusPlus.ID + ":" + this.mIconName + "_OVERLAY"); - } - - @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java deleted file mode 100644 index eff3de28a3..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces; - -import net.minecraftforge.common.util.ForgeDirection; - -import ic2.api.energy.tile.IHeatSource; - -public interface IHeatEntity extends IHeatSource, IHeatSink { - - public int getHeatBuffer(); - - public void setHeatBuffer(int HeatBuffer); - - public void addtoHeatBuffer(int heat); - - public int getTransmitHeat(); - - public int fillHeatBuffer(int maxAmount); - - public int getMaxHeatEmittedPerTick(); - - public void updateHeatEntity(); - - @Override - public int maxrequestHeatTick(ForgeDirection directionFrom); - - @Override - public int requestHeat(ForgeDirection directionFrom, int requestheat); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java deleted file mode 100644 index 9e671fe538..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IHeatSink { - - int maxHeatInPerTick(ForgeDirection var1); - - int addHeat(ForgeDirection var1, int var2); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java deleted file mode 100644 index cb5d875071..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java +++ /dev/null @@ -1,12 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces; - -import java.util.ArrayList; - -import net.minecraft.tileentity.TileEntity; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; - -public interface IMetaTileEntityHeatPipe extends IMetaTileEntity { - - long transferHeat(byte var1, long var2, long var4, ArrayList<TileEntity> var6); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java deleted file mode 100644 index 2f4eaf4293..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_IconContainer.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; - -public interface Interface_IconContainer { - - /** - * @return A regular Icon. - */ - public IIcon getIcon(); - - /** - * @return Icon of the Overlay (or null if there is no Icon) - */ - public IIcon getOverlayIcon(); - - /** - * @return the Default Texture File for this Icon. - */ - public ResourceLocation getTextureFile(); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java deleted file mode 100644 index 230dc6ab8d..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_OreRecipeRegistrator_GT.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.OrePrefixes; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; - -public interface Interface_OreRecipeRegistrator_GT { - - /** - * Contains a Code Fragment, used in the OrePrefix to register Recipes. Better than using a switch/case, like I did - * before. - * - * @param aPrefix always != null - * @param aMaterial always != null, and can be == _NULL if the Prefix is Self Referencing or not Material based! - * @param aStack always != null - */ - public void registerOre(OrePrefixes aPrefix, GT_Materials aMaterial, String aOreDictName, String aModName, - ItemStack aStack); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java deleted file mode 100644 index 53d3055213..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/Interface_Texture.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.interfaces.internal; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; - -public interface Interface_Texture { - - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); - - public boolean isValidTexture(); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java deleted file mode 100644 index 91ad6d9d9c..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java +++ /dev/null @@ -1,617 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items.tools; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.stats.AchievementList; -import net.minecraft.stats.StatList; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.event.world.BlockEvent; - -import gregtech.api.GregTech_API; -import gregtech.api.enchants.Enchantment_Radioactivity; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.IToolStats; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats; - -/** - * This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench: - * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, - * null); - */ -public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool { - - /** - * All instances of this Item Class are listed here. This gets used to register the Renderer to all Items of this - * Type, if useStandardMetaItemRenderer() returns true. - * <p/> - * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. - */ - public static final HashMap<String, GT_MetaGenTool> sInstances = new HashMap<>(); - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - - public final HashMap<Short, IToolStats> mToolStats = new HashMap<>(); - - /** - * Creates the Item using these Parameters. - * - * @param aUnlocalized The Unlocalized Name of this Item. - */ - public GT_MetaGenTool(final String aUnlocalized) { - super(aUnlocalized); - GT_ModHandler.registerBoxableItemToToolBox(this); - this.setCreativeTab(GregTech_API.TAB_GREGTECH); - this.setMaxStackSize(1); - sInstances.put(this.getUnlocalizedName(), this); - } - - /* ---------- FOR ADDING CUSTOM ITEMS INTO THE REMAINING 766 RANGE ---------- */ - - public static final Materials getPrimaryMaterialEx(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null) { - return Materials.getRealMaterial(aNBT.getString("PrimaryMaterial")); - } - } - return Materials._NULL; - } - - public static final Materials getSecondaryMaterialEx(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if (aNBT != null) { - return Materials.getRealMaterial(aNBT.getString("SecondaryMaterial")); - } - } - return Materials._NULL; - } - - /** - * This adds a Custom Item to the ending Range. - * - * @param aID The Id of the assigned Tool Class [0 - 32765] (only even Numbers allowed! Uneven - * ID's are empty electric Items) - * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no - * ToolTip - * @param aToolStats The Food Value of this Item. Can be null as well. - * @param aOreDictNamesAndAspects The OreDict Names you want to give the Item. Also used to assign Thaumcraft - * Aspects. - * @return An ItemStack containing the newly created Item, but without specific Stats. - */ - public final ItemStack addToolEx(final int aID, final String aEnglish, String aToolTip, final IToolStats aToolStats, - final Object... aOreDictNamesAndAspects) { - if (aToolTip == null) { - aToolTip = ""; - } - if ((aID >= 0) && (aID < 32766) && ((aID % 2) == 0)) { - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".name", aEnglish); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".tooltip", aToolTip); - GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName() + "." + (aID + 1) + ".name", - aEnglish + " (Empty)"); - GT_LanguageManager.addStringLocalization( - this.getUnlocalizedName() + "." + (aID + 1) + ".tooltip", - "You need to recharge it"); - this.mToolStats.put((short) aID, aToolStats); - this.mToolStats.put((short) (aID + 1), aToolStats); - aToolStats.onStatsAddedToTool(this, aID); - final ItemStack rStack = new ItemStack(this, 1, aID); - final List<TC_AspectStack> tAspects = new ArrayList<>(); - for (final Object tOreDictNameOrAspect : aOreDictNamesAndAspects) { - if (tOreDictNameOrAspect instanceof TC_AspectStack) { - ((TC_AspectStack) tOreDictNameOrAspect).addToAspectList(tAspects); - } else { - GT_OreDictUnificator.registerOre(tOreDictNameOrAspect, rStack); - } - } - if (GregTech_API.sThaumcraftCompat != null) { - GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); - } - return rStack; - } - return null; - } - - /** - * This Function gets an ItemStack Version of this Tool - * - * @param aToolID the ID of the Tool Class - * @param aAmount Amount of Items (well normally you only need 1) - * @param aPrimaryMaterial Primary Material of this Tool - * @param aSecondaryMaterial Secondary (Rod/Handle) Material of this Tool - * @param aElectricArray The Electric Stats of this Tool (or null if not electric) - */ - public final ItemStack getToolWithStatsEx(final int aToolID, final int aAmount, final Materials aPrimaryMaterial, - final Materials aSecondaryMaterial, final long[] aElectricArray) { - final ItemStack rStack = new ItemStack(this, aAmount, aToolID); - final IToolStats tToolStats = this.getToolStats(rStack); - if (tToolStats != null) { - final NBTTagCompound tMainNBT = new NBTTagCompound(), tToolNBT = new NBTTagCompound(); - if (aPrimaryMaterial != null) { - tToolNBT.setString("PrimaryMaterial", aPrimaryMaterial.toString()); - tToolNBT.setLong( - "MaxDamage", - 100L * (long) (aPrimaryMaterial.mDurability * tToolStats.getMaxDurabilityMultiplier())); - } - if (aSecondaryMaterial != null) { - tToolNBT.setString("SecondaryMaterial", aSecondaryMaterial.toString()); - } - - if (aElectricArray != null) { - tToolNBT.setBoolean("Electric", true); - tToolNBT.setLong("MaxCharge", aElectricArray[0]); - tToolNBT.setLong("Voltage", aElectricArray[1]); - tToolNBT.setLong("Tier", aElectricArray[2]); - tToolNBT.setLong("SpecialData", aElectricArray[3]); - } - - tMainNBT.setTag("GT.ToolStats", tToolNBT); - rStack.setTagCompound(tMainNBT); - } - this.isItemStackUsable(rStack); - return rStack; - } - - /** - * Called by the Block Harvesting Event within the GT_Proxy - */ - @Override - public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack, - final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, - final byte aMetaData, final int aFortune, final boolean aSilkTouch, - final BlockEvent.HarvestDropsEvent aEvent) { - final IToolStats tStats = this.getToolStats(aStack); - if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) { - this.doDamage( - aStack, - tStats.convertBlockDrops( - aDrops, - aStack, - aPlayer, - aBlock, - aX, - aY, - aZ, - aMetaData, - aFortune, - aSilkTouch, - aEvent) * tStats.getToolDamagePerDropConversion()); - } - } - - @Override - public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) { - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats == null) || !this.isItemStackUsable(aStack)) { - return true; - } - GT_Utility.doSoundAtClient(tStats.getEntityHitSound(), 1, 1.0F); - if (super.onLeftClickEntity(aStack, aPlayer, aEntity)) { - return true; - } - if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) { - final float tMagicDamage = tStats - .getMagicDamageAgainstEntity( - aEntity instanceof EntityLivingBase - ? EnchantmentHelper - .getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity) - : 0.0F, - aEntity, - aStack, - aPlayer); - float tDamage = tStats.getNormalDamageAgainstEntity( - (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() - + this.getToolCombatDamage(aStack), - aEntity, - aStack, - aPlayer); - if ((tDamage + tMagicDamage) > 0.0F) { - final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround - && !aPlayer.isOnLadder() - && !aPlayer.isInWater() - && !aPlayer.isPotionActive(Potion.blindness) - && (aPlayer.ridingEntity == null) - && (aEntity instanceof EntityLivingBase); - if (tCriticalHit && (tDamage > 0.0F)) { - tDamage *= 1.5F; - } - tDamage += tMagicDamage; - if (aEntity.attackEntityFrom(tStats.getDamageSource(aPlayer, aEntity), tDamage)) { - if (aEntity instanceof EntityLivingBase) { - aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4); - } - final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase - ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity) - : 0); - if (tKnockcack > 0) { - aEntity.addVelocity( - -MathHelper.sin((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F, - 0.1D, - MathHelper.cos((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F); - aPlayer.motionX *= 0.6D; - aPlayer.motionZ *= 0.6D; - aPlayer.setSprinting(false); - } - if (tCriticalHit) { - aPlayer.onCriticalHit(aEntity); - } - if (tMagicDamage > 0.0F) { - aPlayer.onEnchantmentCritical(aEntity); - } - if (tDamage >= 18.0F) { - aPlayer.triggerAchievement(AchievementList.overkill); - } - aPlayer.setLastAttacker(aEntity); - if (aEntity instanceof EntityLivingBase) { - EnchantmentHelper.func_151384_a((EntityLivingBase) aEntity, aPlayer); - } - EnchantmentHelper.func_151385_b(aPlayer, aEntity); - if (aEntity instanceof EntityLivingBase) { - aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F)); - } - aEntity.hurtResistantTime = Math - .max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity)); - aPlayer.addExhaustion(0.3F); - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - } - if (aStack.stackSize <= 0) { - aPlayer.destroyCurrentEquippedItem(); - } - return true; - } - - @Override - public ItemStack onItemRightClick(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats != null) && tStats.canBlock()) { - aPlayer.setItemInUse(aStack, 72000); - } - return super.onItemRightClick(aStack, aWorld, aPlayer); - } - - @Override - public Long[] getFluidContainerStats(final ItemStack aStack) { - return null; - } - - @Override - public Long[] getElectricStats(final ItemStack aStack) { - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT = aNBT.getCompoundTag("GT.ToolStats"); - if ((aNBT != null) && aNBT.getBoolean("Electric")) { - return new Long[] { aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"), - aNBT.getLong("SpecialData") }; - } - } - return null; - } - - @Override - public float getToolCombatDamage(final ItemStack aStack) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats == null) { - return 0; - } - return tStats.getBaseDamage() + getPrimaryMaterial(aStack).mToolQuality; - } - - @Override - public float getDigSpeed(final ItemStack aStack, final Block aBlock, final int aMetaData) { - if (!this.isItemStackUsable(aStack)) { - return 0.0F; - } - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats == null) || (Math.max(0, this.getHarvestLevel(aStack, "")) < aBlock.getHarvestLevel(aMetaData))) { - return 0.0F; - } - return tStats.isMinableBlock(aBlock, (byte) aMetaData) - ? Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed) - : 0.0F; - } - - @Override - public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX, - final int aY, final int aZ, final EntityLivingBase aPlayer) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - if (tStats == null) { - return false; - } - GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F); - this.doDamage( - aStack, - (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak())); - return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F; - } - - private ItemStack getContainerItem(ItemStack aStack, final boolean playSound) { - if (!this.isItemStackUsable(aStack)) { - return null; - } - aStack = GT_Utility.copyAmount(1, aStack); - final IToolStats tStats = this.getToolStats(aStack); - if (tStats == null) { - return null; - } - this.doDamage(aStack, tStats.getToolDamagePerContainerCraft()); - aStack = aStack.stackSize > 0 ? aStack : null; - if (playSound) { - // String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); - // GT_Utility.doSoundAtClient(sound, 1, 1.0F); - } - return aStack; - } - - @Override - public Interface_ToolStats getToolStats(final ItemStack aStack) { - this.isItemStackUsable(aStack); - return this.getToolStatsInternal(aStack); - } - - private Interface_ToolStats getToolStatsInternal(final ItemStack aStack) { - return (Interface_ToolStats) (aStack == null ? null : this.mToolStats.get((short) aStack.getItemDamage())); - } - - @Override - public float getSaplingModifier(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer, - final int aX, final int aY, final int aZ) { - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isGrafter() ? Math.min(100.0F, (1 + this.getHarvestLevel(aStack, "")) * 20.0F) - : 0.0F; - } - - @Override - public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, - final int aZ) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isCrowbar(); - } - - @Override - public void onWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats != null) { - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public boolean canWrench(final EntityPlayer player, final int x, final int y, final int z) { - System.out.println("canWrench"); - if (player == null) { - return false; - } - if (player.getCurrentEquippedItem() == null) { - return false; - } - if (!this.isItemStackUsable(player.getCurrentEquippedItem())) { - return false; - } - final Interface_ToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); - return (tStats != null) && tStats.isWrench(); - } - - @Override - public void wrenchUsed(final EntityPlayer player, final int x, final int y, final int z) { - if (player == null) { - return; - } - if (player.getCurrentEquippedItem() == null) { - return; - } - final IToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); - if (tStats != null) { - this.doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public boolean canUse(final ItemStack stack, final EntityPlayer player, final int x, final int y, final int z) { - return this.canWrench(player, x, y, z); - } - - @Override - public void used(final ItemStack stack, final EntityPlayer player, final int x, final int y, final int z) { - this.wrenchUsed(player, x, y, z); - } - - @Override - public boolean shouldHideFacades(final ItemStack stack, final EntityPlayer player) { - if (player == null) { - return false; - } - if (player.getCurrentEquippedItem() == null) { - return false; - } - if (!this.isItemStackUsable(player.getCurrentEquippedItem())) { - return false; - } - final Interface_ToolStats tStats = this.getToolStats(player.getCurrentEquippedItem()); - return tStats.isWrench(); - } - - @Override - public boolean canLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isCrowbar(); - } - - @Override - public void onLink(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats != null) { - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public boolean canBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - if (!this.isItemStackUsable(aStack)) { - return false; - } - final IToolStats tStats = this.getToolStats(aStack); - return (tStats != null) && tStats.isCrowbar(); - } - - @Override - public void onBoost(final EntityPlayer aPlayer, final ItemStack aStack, final EntityMinecart cart) { - final IToolStats tStats = this.getToolStats(aStack); - if (tStats != null) { - this.doDamage(aStack, tStats.getToolDamagePerEntityAttack()); - } - } - - @Override - public void onCreated(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) { - final IToolStats tStats = this.getToolStats(aStack); - if ((tStats != null) && (aPlayer != null)) { - tStats.onToolCrafted(aStack, aPlayer); - } - super.onCreated(aStack, aWorld, aPlayer); - } - - @Override - public boolean isFull3D() { - return true; - } - - @Override - public boolean isItemStackUsable(final ItemStack aStack) { - final IToolStats tStats = this.getToolStatsInternal(aStack); - if (((aStack.getItemDamage() % 2) == 1) || (tStats == null)) { - final NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT.removeTag("ench"); - } - return false; - } - final Materials aMaterial = getPrimaryMaterial(aStack); - final HashMap<Integer, Integer> tMap = new HashMap<>(), tResult = new HashMap<>(); - if (aMaterial.mEnchantmentTools != null) { - tMap.put(aMaterial.mEnchantmentTools.effectId, (int) aMaterial.mEnchantmentToolsLevel); - if (aMaterial.mEnchantmentTools == Enchantment.fortune) { - tMap.put(Enchantment.looting.effectId, (int) aMaterial.mEnchantmentToolsLevel); - } - if (aMaterial.mEnchantmentTools == Enchantment.knockback) { - tMap.put(Enchantment.power.effectId, (int) aMaterial.mEnchantmentToolsLevel); - } - if (aMaterial.mEnchantmentTools == Enchantment.fireAspect) { - tMap.put(Enchantment.flame.effectId, (int) aMaterial.mEnchantmentToolsLevel); - } - } - final Enchantment[] tEnchants = tStats.getEnchantments(aStack); - final int[] tLevels = tStats.getEnchantmentLevels(aStack); - for (int i = 0; i < tEnchants.length; i++) { - if (tLevels[i] > 0) { - final Integer tLevel = tMap.get(tEnchants[i].effectId); - tMap.put( - tEnchants[i].effectId, - tLevel == null ? tLevels[i] : tLevel == tLevels[i] ? tLevel + 1 : Math.max(tLevel, tLevels[i])); - } - } - for (final Entry<Integer, Integer> tEntry : tMap.entrySet()) { - if ((tEntry.getKey() == 33) || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2)) - || (tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId)) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } else { - switch (Enchantment.enchantmentsList[tEntry.getKey()].type) { - case weapon: - if (tStats.isWeapon()) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } - break; - case all: - tResult.put(tEntry.getKey(), tEntry.getValue()); - break; - case armor: - case armor_feet: - case armor_head: - case armor_legs: - case armor_torso: - break; - case bow: - if (tStats.isRangedWeapon()) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } - break; - case breakable: - break; - case fishing_rod: - break; - case digger: - if (tStats.isMiningTool()) { - tResult.put(tEntry.getKey(), tEntry.getValue()); - } - break; - } - } - } - EnchantmentHelper.setEnchantments(tResult, aStack); - return true; - } - - @Override - public short getChargedMetaData(final ItemStack aStack) { - return (short) (aStack.getItemDamage() - (aStack.getItemDamage() % 2)); - } - - @Override - public short getEmptyMetaData(final ItemStack aStack) { - final NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - aNBT.removeTag("ench"); - } - return (short) ((aStack.getItemDamage() + 1) - (aStack.getItemDamage() % 2)); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java deleted file mode 100644 index 463b6d9f7f..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items.types; - -import java.util.List; - -import net.minecraft.block.BlockDispenser; -import net.minecraft.dispenser.BehaviorDefaultDispenseItem; -import net.minecraft.dispenser.IBlockSource; -import net.minecraft.dispenser.IPosition; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import gregtech.api.enums.SubTag; -import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour; -import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base; - -public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_Base> { - - @Override - public boolean onLeftClickEntity(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, - final EntityPlayer aPlayer, final Entity aEntity) { - return false; - } - - @Override - public boolean onItemUse(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final EntityPlayer aPlayer, - final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, - final float hitY, final float hitZ) { - return false; - } - - @Override - public boolean onItemUseFirst(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, - final EntityPlayer aPlayer, final World aWorld, final int aX, final int aY, final int aZ, final int aSide, - final float hitX, final float hitY, final float hitZ) { - return false; - } - - @Override - public ItemStack onItemRightClick(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld, - final EntityPlayer aPlayer) { - return aStack; - } - - @Override - public List<String> getAdditionalToolTips(final Gregtech_MetaItem_Base aItem, final List<String> aList, - final ItemStack aStack) { - return aList; - } - - @Override - public void onUpdate(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld, - final Entity aPlayer, final int aTimer, final boolean aIsInHand) {} - - @Override - public boolean isItemStackUsable(final Gregtech_MetaItem_Base aItem, final ItemStack aStack) { - return true; - } - - @Override - public boolean canDispense(final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, final ItemStack aStack) { - return false; - } - - @Override - public ItemStack onDispense(final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, - final ItemStack aStack) { - final EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); - final IPosition iposition = BlockDispenser.func_149939_a(aSource); - final ItemStack itemstack1 = aStack.splitStack(1); - BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); - return aStack; - } - - @Override - public boolean hasProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, - final ItemStack aStack) { - return false; - } - - @Override - public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, - final ItemStack aStack, final World aWorld, final double aX, final double aY, final double aZ) { - return null; - } - - @Override - public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, - final ItemStack aStack, final World aWorld, final EntityLivingBase aEntity, final float aSpeed) { - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java deleted file mode 100644 index c387c513a4..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java +++ /dev/null @@ -1,157 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items.types; - -import java.util.List; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.IFluidBlock; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Block_Ores; -import gregtech.common.blocks.GT_TileEntity_Ores; - -public class ToolType_HardHammer extends ToolType_Base { - - private final int mVanillaCosts; - private final int mEUCosts; - private final String mTooltip = GT_LanguageManager - .addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting"); - - public ToolType_HardHammer(final int aVanillaCosts, final int aEUCosts) { - this.mVanillaCosts = aVanillaCosts; - this.mEUCosts = aEUCosts; - } - - public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, - final World aWorld, final int aX, final int aY, final int aZ, final int aSide, final float hitX, - final float hitY, final float hitZ) { - if (aWorld.isRemote) { - return false; - } - final Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - - ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer( - aPlayer, - "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - GT_Utility.sendSoundToPlayers( - aWorld, - GregTech_API.sSoundList.get(Integer.valueOf(1)), - 1.0F, - -1.0F, - aX, - aY, - aZ); - return true; - } - if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) - || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) { - if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { - GT_Utility.sendSoundToPlayers( - aWorld, - GregTech_API.sSoundList.get(Integer.valueOf(1)), - 1.0F, - -1.0F, - aX, - aY, - aZ); - int tX = aX; - int tY = aY; - int tZ = aZ; - int tMetaID = 0; - final int tQuality = (aItem instanceof GT_MetaGenerated_Tool) - ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") - : 0; - - int i = 0; - for (final int j = 6 + tQuality; i < j; i++) { - tX -= ForgeDirection.getOrientation(aSide).offsetX; - tY -= ForgeDirection.getOrientation(aSide).offsetY; - tZ -= ForgeDirection.getOrientation(aSide).offsetZ; - - final Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) { - GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock."); - break; - } - if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) - || ((tBlock instanceof IFluidBlock))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock."); - break; - } - if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) { - GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Rock."); - break; - } - if (tBlock != aBlock) { - if (i >= 4) { - break; - } - GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Rock."); - break; - } - } - final Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide); - i = 0; - for (final int j = 9 + (2 * tQuality); i < j; i++) { - tX = (aX - 4 - tQuality) + tRandom.nextInt(j); - tY = (aY - 4 - tQuality) + tRandom.nextInt(j); - tZ = (aZ - 4 - tQuality) + tRandom.nextInt(j); - final Block tBlock = aWorld.getBlock(tX, tY, tZ); - if ((tBlock instanceof GT_Block_Ores)) { - final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ); - if ((tTileEntity instanceof GT_TileEntity_Ores)) { - final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData - % 1000)]; - if ((tMaterial != null) && (tMaterial != Materials._NULL)) { - GT_Utility.sendChatToPlayer( - aPlayer, - "Found traces of " + tMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } else { - tMetaID = aWorld.getBlockMetadata(tX, tY, tZ); - tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - GT_Utility.sendChatToPlayer( - aPlayer, - "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore."); - return true; - } - } - } - GT_Utility.sendChatToPlayer(aPlayer, "No Ores found."); - } - return true; - } - return false; - } - - public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, - final ItemStack aStack) { - aList.add(this.mTooltip); - return aList; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java deleted file mode 100644 index e117c1b28e..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java +++ /dev/null @@ -1,188 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.items.types; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.GregTech_API; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import ic2.api.tile.IWrenchable; - -public class ToolType_Wrench extends ToolType_Base { - - private final int mCosts; - private final String mTooltip = GT_LanguageManager - .addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick"); - - public ToolType_Wrench(final int aCosts) { - this.mCosts = aCosts; - } - - public boolean onItemUseFirst(final GT_MetaBase_Item aItem, final ItemStack aStack, final EntityPlayer aPlayer, - final World aWorld, final int aX, final int aY, final int aZ, final int ordinalSide, final float hitX, - final float hitY, final float hitZ) { - if (aWorld.isRemote) { - return false; - } - final ForgeDirection side = ForgeDirection.getOrientation(ordinalSide); - final Block aBlock = aWorld.getBlock(aX, aY, aZ); - if (aBlock == null) { - return false; - } - final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); - final ForgeDirection targetSide = GT_Utility.determineWrenchingSide(side, hitX, hitY, hitZ); - final byte ordinalTargetSide = (byte) targetSide.ordinal(); - final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - try { - if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable wrenchable))) { - if (wrenchable.wrenchCanSetFacing(aPlayer, ordinalTargetSide)) { - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - wrenchable.setFacing(ordinalTargetSide); - GT_Utility - .sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { - final int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) { - ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); - for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) { - if (tOutput == null) { - aWorld.spawnEntityInWorld( - new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack)); - } else { - aWorld.spawnEntityInWorld( - new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput)); - tOutput = null; - } - } - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility - .sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - return true; - } - } catch (final Throwable e) {} - if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) { - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) { - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) { - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) { - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.spawnEntityInWorld( - new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta))); - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (aMeta == ordinalTargetSide) { - if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) - || (aBlock == Blocks.piston) - || (aBlock == Blocks.sticky_piston) - || (aBlock == Blocks.dispenser) - || (aBlock == Blocks.dropper) - || (aBlock == Blocks.furnace) - || (aBlock == Blocks.lit_furnace) - || (aBlock == Blocks.chest) - || (aBlock == Blocks.trapped_chest) - || (aBlock == Blocks.ender_chest) - || (aBlock == Blocks.hopper)) { - if ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { - aWorld.spawnEntityInWorld( - new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0))); - aWorld.setBlockToAir(aX, aY, aZ); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - } else { - if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) - || (aBlock == Blocks.dispenser) - || (aBlock == Blocks.dropper)) { - if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ordinalTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) - || (aBlock == Blocks.furnace) - || (aBlock == Blocks.lit_furnace) - || (aBlock == Blocks.chest) - || (aBlock == Blocks.ender_chest) - || (aBlock == Blocks.trapped_chest)) { - if ((targetSide.offsetY == 0) && ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ordinalTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - if (aBlock == Blocks.hopper) { - if ((targetSide != ForgeDirection.UP) && ((aPlayer.capabilities.isCreativeMode) - || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { - aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ordinalTargetSide, 3); - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return true; - } - } - if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(targetSide)) - && ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) - || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) - && (aBlock.rotateBlock(aWorld, aX, aY, aZ, targetSide))) { - if (!aPlayer.capabilities.isCreativeMode) { - ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); - } - GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(100), 1.0F, -1.0F, aX, aY, aZ); - } - return false; - } - - public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList, - final ItemStack aStack) { - aList.add(this.mTooltip); - return aList; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java deleted file mode 100644 index a47ed592c4..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java +++ /dev/null @@ -1,81 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; - -public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntity_BasicMachine_GT_Recipe { - - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(int aID, String aName, String aNameRegional, int aTier, - String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, - int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) { - super( - aID, - aName, - aNameRegional, - aTier, - aDescription, - aRecipes, - aInputSlots, - aOutputSlots, - aTankCapacity, - aGUIParameterA, - aGUIParameterB, - aGUIName, - aSound, - aSharedTank, - aRequiresFluidForFiltering, - aSpecialEffect, - aOverlays, - aRecipe); - } - - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(String aName, int aTier, String aDescription, - GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, - int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, - String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { - super( - aName, - aTier, - aDescription, - aRecipes, - aInputSlots, - aOutputSlots, - aTankCapacity, - aAmperage, - aGUIParameterA, - aGUIParameterB, - aTextures, - aGUIName, - aNEIName, - aSound, - aSharedTank, - aRequiresFluidForFiltering, - aSpecialEffect); - } - - public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(String aName, int aTier, String[] aDescription, - GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, - int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, - String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { - super( - aName, - aTier, - aDescription[0], - aRecipes, - aInputSlots, - aOutputSlots, - aTankCapacity, - aAmperage, - aGUIParameterA, - aGUIParameterB, - aTextures, - aGUIName, - aNEIName, - aSound, - aSharedTank, - aRequiresFluidForFiltering, - aSpecialEffect); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java deleted file mode 100644 index fea297a53d..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java +++ /dev/null @@ -1,220 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import java.lang.reflect.Field; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import com.google.common.collect.BiMap; - -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Output { - - public final AutoMap<Fluid> mFluidsToUse = new AutoMap<Fluid>(); - public final int mFluidCapacity; - private int mTotalPlasmaSupported = -1; - - public GT_MetaTileEntity_Hatch_Plasma(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional, 6); - mFluidCapacity = 256000; - initHatch(); - } - - public GT_MetaTileEntity_Hatch_Plasma(final String aName, final String aDescription, - final ITexture[][][] aTextures) { - super(aName, 6, aDescription, aTextures); - mFluidCapacity = 256000; - initHatch(); - } - - public GT_MetaTileEntity_Hatch_Plasma(final String aName, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, 6, aDescription[0], aTextures); - mFluidCapacity = 256000; - initHatch(); - } - - private void initHatch() { - - // Get all Plasmas, but the easiest way to do this is to just ask the Fluid Registry what exists and filter - // through them lazily. - Field fluidNameCache; - - fluidNameCache = ReflectionUtils.getField(FluidRegistry.class, "fluidNames"); - - AutoMap<String> mValidPlasmaNameCache = new AutoMap<String>(); - if (fluidNameCache != null) { - try { - Object fluidNames = fluidNameCache.get(null); - if (fluidNames != null) { - try { - @SuppressWarnings("unchecked") - BiMap<Integer, String> fluidNamesMap = (BiMap<Integer, String>) fluidNames; - if (fluidNamesMap != null) { - for (String g : fluidNamesMap.values()) { - if (g.toLowerCase().contains("plasma")) { - mValidPlasmaNameCache.put(g); - } - } - } - } catch (ClassCastException e) {} - } - } catch (IllegalArgumentException | IllegalAccessException e) {} - } - - AutoMap<Fluid> mPlasmaCache = new AutoMap<Fluid>(); - if (!mValidPlasmaNameCache.isEmpty()) { - for (String y : mValidPlasmaNameCache) { - Fluid t = FluidRegistry.getFluid(y); - if (t != null) { - if (t.getTemperature() > 1000) { - mPlasmaCache.put(t); - } - } - } - } - - if (!mPlasmaCache.isEmpty()) { - for (Fluid w : mPlasmaCache) { - mFluidsToUse.put(w); - } - } - } - - @Override - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture }; - } - - @Override - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture }; - } - - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - if (side == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { - for (Fluid f : mFluidsToUse) { - if (f != null) { - if (GT_Utility.getFluidForFilledItem(aStack, true).getFluid() == f) { - return true; - } - } - } - } - return false; - } - - @Override - public boolean isFluidInputAllowed(final FluidStack aFluid) { - for (Fluid f : mFluidsToUse) { - if (f != null) { - if (aFluid.getFluid() == f) { - return true; - } - } - } - return false; - } - - @Override - public int getCapacity() { - return this.mFluidCapacity; - } - - @Override - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return (MetaTileEntity) new GT_MetaTileEntity_Hatch_Plasma(this.mName, this.mDescription, this.mTextures); - } - - @Override - public String[] getDescription() { - - if (mTotalPlasmaSupported < 0) { - if (mFluidsToUse.isEmpty()) { - mTotalPlasmaSupported = 0; - } else { - mTotalPlasmaSupported = mFluidsToUse.size(); - } - } - - String aX = EnumChatFormatting.GRAY + ""; - String a1 = EnumChatFormatting.GOLD + "Refined containment" + aX; - String a2 = EnumChatFormatting.GOLD + "Capacity: " + EnumChatFormatting.DARK_AQUA + getCapacity() + "L" + aX; - String a3 = EnumChatFormatting.GOLD + "Supports " - + EnumChatFormatting.DARK_RED - + mTotalPlasmaSupported - + EnumChatFormatting.GOLD - + " types of plasma" - + aX; - - String[] s2 = new String[] { a1, a2, a3, CORE.GT_Tooltip.get() }; - return s2; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - // TODO Auto-generated method stub - return super.getTextureSet(aTextures); - } - - private Field F1, F2; - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - byte a1 = 0, a2 = 0; - try { - if (F1 == null) { - F1 = ReflectionUtils.getField(getClass(), "actualTexture"); - } - if (F2 == null) { - F2 = ReflectionUtils.getField(getClass(), "mTexturePage"); - } - - if (F1 != null) { - a1 = F1.getByte(this); - } - if (F2 != null) { - a2 = F2.getByte(this); - } - } catch (IllegalArgumentException | IllegalAccessException n) {} - - int textureIndex = a1 | a2 << 7; - byte texturePointer = (byte) (a1 & 127); - - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { - ITexture g = textureIndex > 0 ? BlockIcons.casingTexturePages[a2][texturePointer] - : BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]; - - return new ITexture[] { g }; - } - - return side != facing - ? (textureIndex > 0 ? new ITexture[] { BlockIcons.casingTexturePages[a2][texturePointer] } - : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }) - : (textureIndex > 0 - ? (aActive ? this.getTexturesActive(BlockIcons.casingTexturePages[a2][texturePointer]) - : this.getTexturesInactive(BlockIcons.casingTexturePages[a2][texturePointer])) - : (aActive ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) - : this.getTexturesInactive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]))); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java deleted file mode 100644 index 0408469ecf..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ /dev/null @@ -1,485 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import static gregtech.api.enums.GT_Values.VN; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cofh.api.energy.IEnergyReceiver; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.TextureSet; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.metatileentity.IMetaTileEntityCable; -import gregtech.api.interfaces.tileentity.IColoredTileEntity; -import gregtech.api.interfaces.tileentity.IEnergyConnected; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Proxy; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import ic2.api.energy.tile.IEnergySink; - -public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements IMetaTileEntityCable { - - public final float mThickNess; - public final GT_Materials mMaterial; - public final long mCableLossPerMeter, mAmperage, mVoltage; - public final boolean mInsulated, mCanShock; - public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0; - public long mRestRF; - public short mOverheat; - public final int mWireHeatingTicks; - - public GregtechMetaPipeEntityBase_Cable(final int aID, final String aName, final String aNameRegional, - final float aThickNess, final GT_Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, - final long aVoltage, final boolean aInsulated, final boolean aCanShock) { - super(aID, aName, aNameRegional, 0); - this.mThickNess = aThickNess; - this.mMaterial = aMaterial; - this.mAmperage = aAmperage; - this.mVoltage = aVoltage; - this.mInsulated = aInsulated; - this.mCanShock = aCanShock; - this.mCableLossPerMeter = aCableLossPerMeter; - this.mWireHeatingTicks = this.getGT5Var(); - } - - public GregtechMetaPipeEntityBase_Cable(final String aName, final float aThickNess, final GT_Materials aMaterial, - final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated, - final boolean aCanShock) { - super(aName, 0); - this.mThickNess = aThickNess; - this.mMaterial = aMaterial; - this.mAmperage = aAmperage; - this.mVoltage = aVoltage; - this.mInsulated = aInsulated; - this.mCanShock = aCanShock; - this.mCableLossPerMeter = aCableLossPerMeter; - this.mWireHeatingTicks = this.getGT5Var(); - } - - private int getGT5Var() { - final Class<? extends GT_Proxy> clazz = GT_Mod.gregtechproxy.getClass(); - final String lookingForValue = "mWireHeatingTicks"; - int temp = 4; - Field field; - try { - field = clazz.getClass().getField(lookingForValue); - final Class<?> clazzType = field.getType(); - if (clazzType.toString().equals("int")) { - temp = (field.getInt(clazz)); - } else { - temp = 4; - } - } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { - // Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - // - PLEASE REPORT THIS."); - Logger.WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); - Logger.ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); - temp = 4; - } - return temp; - } - - @Override - public byte getTileEntityBaseType() { - return (byte) (this.mInsulated ? 9 : 8); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaPipeEntityBase_Cable( - this.mName, - this.mThickNess, - this.mMaterial, - this.mCableLossPerMeter, - this.mAmperage, - this.mVoltage, - this.mInsulated, - this.mCanShock); - } - - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final byte aConnections, final int aColorIndex, final boolean aConnected, final boolean aRedstone) { - if (!this.mInsulated) { - return new ITexture[] { new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - this.mMaterial.mRGBa) }; - } - if (aConnected) { - final float tThickNess = this.getThickNess(); - if (tThickNess < 0.37F) { - return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_TINY, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - if (tThickNess < 0.49F) { - return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_SMALL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - if (tThickNess < 0.74F) { - return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_MEDIUM, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - if (tThickNess < 0.99F) { - return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_LARGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - return new ITexture[] { - new GT_RenderedTexture( - this.mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], - this.mMaterial.mRGBa), - new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_HUGE, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - return new ITexture[] { new GT_RenderedTexture( - Textures.BlockIcons.INSULATION_FULL, - Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) }; - } - - @Override - public void onEntityCollidedWithBlock(final World aWorld, final int aX, final int aY, final int aZ, - final Entity aEntity) { - if (this.mCanShock && ((((BaseMetaPipeEntity) this.getBaseMetaTileEntity()).mConnections & -128) == 0) - && (aEntity instanceof EntityLivingBase)) { - GT_Utility.applyElectricityDamage( - (EntityLivingBase) aEntity, - this.mTransferredVoltageLast20, - this.mTransferredAmperageLast20); - } - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(final World aWorld, final int aX, final int aY, final int aZ) { - if (!this.mCanShock) { - return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - return AxisAlignedBB - .getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return true; - } - - @Override - public final boolean renderInside(final ForgeDirection side) { - return false; - } - - @Override - public int getProgresstime() { - return (int) this.mTransferredAmperage * 64; - } - - @Override - public int maxProgresstime() { - return (int) this.mAmperage * 64; - } - - @Override - public long injectEnergyUnits(final ForgeDirection side, final long aVoltage, final long aAmperage) { - if (!this.getBaseMetaTileEntity().getCoverBehaviorAtSide(side).letsEnergyIn( - side, - this.getBaseMetaTileEntity().getCoverIDAtSide(side), - this.getBaseMetaTileEntity().getCoverDataAtSide(side), - this.getBaseMetaTileEntity())) { - return 0; - } - return this.transferElectricity( - side, - aVoltage, - aAmperage, - new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity()))); - } - - @Override - public long transferElectricity(final ForgeDirection side, long aVoltage, final long aAmperage, - final ArrayList<TileEntity> aAlreadyPassedTileEntityList) { - long rUsedAmperes = 0; - aVoltage -= this.mCableLossPerMeter; - if (aVoltage > 0) { - for (final ForgeDirection targetSide : ForgeDirection.VALID_DIRECTIONS) { - if (rUsedAmperes > aAmperage) break; - final int ordinalTarget = targetSide.ordinal(); - if ((targetSide != side) && ((this.mConnections & (1 << ordinalTarget)) != 0) - && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(targetSide).letsEnergyOut( - targetSide, - this.getBaseMetaTileEntity().getCoverIDAtSide(targetSide), - this.getBaseMetaTileEntity().getCoverDataAtSide(targetSide), - this.getBaseMetaTileEntity())) { - final TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(targetSide); - if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { - aAlreadyPassedTileEntityList.add(tTileEntity); - if (tTileEntity instanceof IEnergyConnected) { - if (this.getBaseMetaTileEntity().getColorization() >= 0) { - final byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); - if ((tColor >= 0) && (tColor != this.getBaseMetaTileEntity().getColorization())) { - continue; - } - } - if ((tTileEntity instanceof IGregTechTileEntity) - && (((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity() instanceof IMetaTileEntityCable) - && ((IGregTechTileEntity) tTileEntity) - .getCoverBehaviorAtSide(targetSide.getOpposite()).letsEnergyIn( - targetSide.getOpposite(), - ((IGregTechTileEntity) tTileEntity) - .getCoverIDAtSide(targetSide.getOpposite()), - ((IGregTechTileEntity) tTileEntity) - .getCoverDataAtSide(targetSide.getOpposite()), - ((IGregTechTileEntity) tTileEntity))) { - if (((IGregTechTileEntity) tTileEntity).getTimer() > 50) { - rUsedAmperes += ((IMetaTileEntityCable) ((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity()).transferElectricity( - targetSide.getOpposite(), - aVoltage, - aAmperage - rUsedAmperes, - aAlreadyPassedTileEntityList); - } - } else { - rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits( - targetSide.getOpposite(), - aVoltage, - aAmperage - rUsedAmperes); - } - - } else if (tTileEntity instanceof IEnergySink) { - final ForgeDirection oppositeDirection = targetSide.getOpposite(); - if (((IEnergySink) tTileEntity) - .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), oppositeDirection)) { - if ((((IEnergySink) tTileEntity).getDemandedEnergy() > 0) - && (((IEnergySink) tTileEntity) - .injectEnergy(oppositeDirection, aVoltage, aVoltage) < aVoltage)) { - rUsedAmperes++; - } - } - } else if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver)) { - final ForgeDirection oppositeDirection = targetSide.getOpposite(); - final int rfOut = (int) ((aVoltage * GregTech_API.mEUtoRF) / 100); - if (((IEnergyReceiver) tTileEntity).receiveEnergy(oppositeDirection, rfOut, true) - == rfOut) { - ((IEnergyReceiver) tTileEntity).receiveEnergy(oppositeDirection, rfOut, false); - rUsedAmperes++; - } else - if (((IEnergyReceiver) tTileEntity).receiveEnergy(oppositeDirection, rfOut, true) > 0) { - if (this.mRestRF == 0) { - final int RFtrans = ((IEnergyReceiver) tTileEntity) - .receiveEnergy(oppositeDirection, rfOut, false); - rUsedAmperes++; - this.mRestRF = rfOut - RFtrans; - } else { - final int RFtrans = ((IEnergyReceiver) tTileEntity) - .receiveEnergy(oppositeDirection, (int) this.mRestRF, false); - this.mRestRF = this.mRestRF - RFtrans; - } - } - if (GregTech_API.mRFExplosions - && (((IEnergyReceiver) tTileEntity).getMaxEnergyStored(oppositeDirection) - < (rfOut * 600))) { - if (rfOut > ((32 * GregTech_API.mEUtoRF) / 100)) { - this.doExplosion(rfOut); - } - } - } - } - } - } - } - - this.mTransferredAmperage += rUsedAmperes; - this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); - this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); - - if ((aVoltage > this.mVoltage) || (this.mTransferredAmperage > this.mAmperage)) { - if (this.mOverheat > (this.mWireHeatingTicks * 100)) { - this.getBaseMetaTileEntity().setToFire(); - } else { - this.mOverheat += 100; - } - return aAmperage; - } - - return rUsedAmperes; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - this.mTransferredAmperage = 0; - if (this.mOverheat > 0) { - this.mOverheat--; - } - - if ((aTick % 20) == 0) { - this.mTransferredVoltageLast20 = 0; - this.mTransferredAmperageLast20 = 0; - this.mConnections = 0; - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - final int ordinalSide = side.ordinal(); - final ForgeDirection oppositeSide = side.getOpposite(); - if (aBaseMetaTileEntity.getCoverBehaviorAtSide(side).alwaysLookConnected( - side, - aBaseMetaTileEntity.getCoverIDAtSide(side), - aBaseMetaTileEntity.getCoverDataAtSide(side), - aBaseMetaTileEntity) - || aBaseMetaTileEntity.getCoverBehaviorAtSide(side).letsEnergyIn( - side, - aBaseMetaTileEntity.getCoverIDAtSide(side), - aBaseMetaTileEntity.getCoverDataAtSide(side), - aBaseMetaTileEntity) - || aBaseMetaTileEntity.getCoverBehaviorAtSide(side).letsEnergyOut( - side, - aBaseMetaTileEntity.getCoverIDAtSide(side), - aBaseMetaTileEntity.getCoverDataAtSide(side), - aBaseMetaTileEntity)) { - final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(side); - if (tTileEntity instanceof IColoredTileEntity) { - if (aBaseMetaTileEntity.getColorization() >= 0) { - final byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); - if ((tColor >= 0) && (tColor != aBaseMetaTileEntity.getColorization())) { - continue; - } - } - } - if ((tTileEntity instanceof IEnergyConnected) - && (((IEnergyConnected) tTileEntity).inputEnergyFrom(oppositeSide) - || ((IEnergyConnected) tTileEntity).outputsEnergyTo(oppositeSide))) { - this.mConnections |= (1 << ordinalSide); - continue; - } - if ((tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity() instanceof IMetaTileEntityCable)) { - if (((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(oppositeSide) - .alwaysLookConnected( - oppositeSide, - ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(oppositeSide), - ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(oppositeSide), - ((IGregTechTileEntity) tTileEntity)) - || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(oppositeSide) - .letsEnergyIn( - oppositeSide, - ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(oppositeSide), - ((IGregTechTileEntity) tTileEntity) - .getCoverDataAtSide(oppositeSide), - ((IGregTechTileEntity) tTileEntity)) - || ((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(oppositeSide) - .letsEnergyOut( - oppositeSide, - ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(oppositeSide), - ((IGregTechTileEntity) tTileEntity) - .getCoverDataAtSide(oppositeSide), - ((IGregTechTileEntity) tTileEntity))) { - this.mConnections |= (1 << ordinalSide); - continue; - } - } - if ((tTileEntity instanceof IEnergySink) && ((IEnergySink) tTileEntity) - .acceptsEnergyFrom((TileEntity) aBaseMetaTileEntity, oppositeSide)) { - this.mConnections |= (1 << ordinalSide); - continue; - } - if (GregTech_API.mOutputRF && (tTileEntity instanceof IEnergyReceiver) - && ((IEnergyReceiver) tTileEntity).canConnectEnergy(oppositeSide)) { - this.mConnections |= (1 << ordinalSide); - continue; - } - - } - } - } - } - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[] { - "Max Voltage: " + EnumChatFormatting.GREEN - + this.mVoltage - + " (" - + VN[GT_Utility.getTier(this.mVoltage)] - + ")" - + EnumChatFormatting.GRAY, - "Max Amperage: " + EnumChatFormatting.YELLOW + this.mAmperage + EnumChatFormatting.GRAY, - "Loss/Meter/Ampere: " + EnumChatFormatting.RED - + this.mCableLossPerMeter - + EnumChatFormatting.GRAY - + " EU-Volt" }; - } - - @Override - public float getThickNess() { - return this.mThickNess; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - // - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - // - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java index b50a40636a..714eb561d9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java @@ -24,7 +24,6 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bUnbreakable = false; public int mSuccess = 0, mTargetStackSize = 0; public UUID ownerUUID; - // UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); private boolean value_last = false, value_current = false; public GregtechMetaSafeBlockBase(final int aID, final String aName, final String aNameRegional, final int aTier, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java deleted file mode 100644 index b7f41b11c8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechFluid.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.objects; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraftforge.fluids.Fluid; - -import gregtech.api.GregTech_API; - -public class GregtechFluid extends Fluid implements Runnable { - - public final String mTextureName; - private final short[] mRGBa; - - public GregtechFluid(final String aName, final String aTextureName, final short[] aRGBa) { - super(aName); - this.mRGBa = aRGBa; - this.mTextureName = aTextureName; - GregTech_API.sGTBlockIconload.add(this); - } - - @Override - public int getColor() { - return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) - | Math.max(0, Math.min(255, this.mRGBa[2])); - } - - @Override - public void run() { - this.setIcons(GregTech_API.sBlockIcons.registerIcon(GTPlusPlus.ID + ":" + "fluids/fluid." + this.mTextureName)); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java deleted file mode 100644 index 7f2fda6dd8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/recipe/ProcessingSkookumChoocherToolRecipes.java +++ /dev/null @@ -1,26 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.recipe; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.ToolDictNames; -import gregtech.api.interfaces.IOreRecipeRegistrator; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; - -public class ProcessingSkookumChoocherToolRecipes implements IOreRecipeRegistrator { - - public ProcessingSkookumChoocherToolRecipes() { - // GregtechOrePrefixes.toolSkookumChoocher.add(this); - } - - @Override - public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - GT_ModHandler.addShapelessCraftingRecipe( - MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(7734, 1, aMaterial, aMaterial, null), - new Object[] { aOreDictName, OrePrefixes.stick.get(aMaterial), OrePrefixes.screw.get(aMaterial), - ToolDictNames.craftingToolScrewdriver }); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java deleted file mode 100644 index bfbd4e6da3..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen.java +++ /dev/null @@ -1,64 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; - -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.concurrent.ConcurrentHashMap; - -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -public abstract class GTPP_Worldgen { - - public final String mWorldGenName; - public final boolean mEnabled; - private final Map<String, Boolean> mDimensionMap = new ConcurrentHashMap<String, Boolean>(); - - public GTPP_Worldgen(String aName, List aList, boolean aDefault) { - mWorldGenName = aName; - mEnabled = sCustomWorldgenFile.get("worldgen", mWorldGenName, aDefault); - if (mEnabled) aList.add(this); - } - - /** - * @param aWorld The World Object - * @param aRandom The Random Generator to use - * @param aBiome The Name of the Biome (always != null) - * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End - * @param aChunkX xCoord of the Chunk - * @param aChunkZ zCoord of the Chunk - * @return if the Worldgeneration has been successfully completed - */ - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - return false; - } - - /** - * @param aWorld The World Object - * @param aRandom The Random Generator to use - * @param aBiome The Name of the Biome (always != null) - * @param aDimensionType The Type of Worldgeneration to add. -1 = Nether, 0 = Overworld, +1 = End - * @param aChunkX xCoord of the Chunk - * @param aChunkZ zCoord of the Chunk - * @return if the Worldgeneration has been successfully completed - */ - public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - return false; - } - - public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { - String aDimName = aWorld.provider.getDimensionName(); - Boolean tAllowed = mDimensionMap.get(aDimName); - if (tAllowed == null) { - boolean tValue = sCustomWorldgenFile - .get("worldgen.dimensions." + mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType); - mDimensionMap.put(aDimName, tValue); - return tValue; - } - return tAllowed; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java deleted file mode 100644 index ffb1baf9f0..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java +++ /dev/null @@ -1,105 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import java.util.Collection; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import gtPlusPlus.core.lib.CORE; - -public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { - - public GTPP_Worldgen_Boulder(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, - int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, - boolean aAllowToGenerateinVoid) { - super( - aName, - aDefault, - aBlock, - aBlockMeta, - aDimensionType, - aAmount, - aSize, - aProbability, - aMinY, - aMaxY, - aBiomeList, - aAllowToGenerateinVoid); - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) - && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) - && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { - for (int i = 0; i < mAmount; i++) { - int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), - tZ = aChunkZ + aRandom.nextInt(16); - Block tBlock = aWorld.getBlock(tX, tY - 7, tZ); - if (tBlock != null && tBlock.isOpaqueCube() - && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) { - float math_pi = CORE.PI; - float var6 = aRandom.nextFloat() * math_pi; - float var1b = mSize / 8.0F; - float var3b = MathHelper.sin(var6) * var1b; - float var4b = MathHelper.cos(var6) * var1b; - float var8b = -2 * var3b; - float var9b = -2 * var4b; - int var10b = (tX + 8); - int var11b = (tZ + 8); - float var7 = (var10b + var3b); - float var11 = (var11b + var4b); - int var5b = aRandom.nextInt(3); - int var6b = aRandom.nextInt(3); - int var7b = var6b - var5b; - float var15 = (tY + var5b - 2); - float var12b = math_pi / mSize; - - for (int var19 = 0; var19 <= mSize; ++var19) { - float var2b = var19 / mSize; - float var20 = var7 + var8b * var2b; - float var22 = var15 + var7b * var2b; - float var24 = var11 + var9b * var2b; - float var26 = aRandom.nextFloat() * mSize / 16.0F; - float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F; - int var32 = MathHelper.floor_float(var20 - var28); - int var33 = MathHelper.floor_float(var22 - var28); - int var34 = MathHelper.floor_float(var24 - var28); - int var35 = MathHelper.floor_float(var20 + var28); - int var36 = MathHelper.floor_float(var22 + var28); - int var37 = MathHelper.floor_float(var24 + var28); - - for (int var38 = var32; var38 <= var35; ++var38) { - float var39 = (var38 + 0.5F - var20) / (var28); - float var13b = var39 * var39; - if (var13b < 1.0F) { - for (int var41 = var33; var41 <= var36; ++var41) { - float var42 = (var41 + 0.5F - var22) / (var28); - float var14b = var13b + var42 * var42; - if (var14b < 1.0F) { - for (int var44 = var34; var44 <= var37; ++var44) { - float var45 = (var44 + 0.5F - var24) / (var28); - Block block = aWorld.getBlock(var38, var41, var44); - if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld - .getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) - || (block != null && !(block instanceof BlockContainer)))) { - aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0); - } - } - } - } - } - } - } - } - } - return true; - } - return false; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java deleted file mode 100644 index 6e87662ef1..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_GT_Ore_Layer.java +++ /dev/null @@ -1,252 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Random; - -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.common.blocks.GT_TileEntity_Ores; -import gregtech.loaders.misc.GT_Achievements; -import gtPlusPlus.core.material.Material; - -public class GTPP_Worldgen_GT_Ore_Layer extends GTPP_Worldgen { - - public static ArrayList<GTPP_Worldgen_GT_Ore_Layer> sList = new ArrayList<GTPP_Worldgen_GT_Ore_Layer>(); - public static int sWeight = 0; - public final short mMinY; - public final short mMaxY; - public final short mWeight; - public final short mDensity; - public final short mSize; - public short mPrimaryMeta; - public short mSecondaryMeta; - public short mBetweenMeta; - public short mSporadicMeta; - public final String mRestrictBiome; - public final boolean mDarkWorld; - public final String aTextWorldgen = "worldgen.gtpp."; - - public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, - int aSize, boolean aOverworld, Materials aPrimary, Materials aSecondary, Materials aBetween, - Materials aSporadic) { - super(aName, sList, aDefault); - this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); - this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math - .max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); - this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); - this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); - this.mPrimaryMeta = ((short) sCustomWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); - this.mSecondaryMeta = ((short) sCustomWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); - this.mBetweenMeta = ((short) sCustomWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); - this.mSporadicMeta = ((short) sCustomWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - this.mRestrictBiome = sCustomWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); - - if (this.mEnabled) { - GT_Achievements.registerOre( - GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], - aMinY, - aMaxY, - aWeight, - false, - false, - false); - GT_Achievements.registerOre( - GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], - aMinY, - aMaxY, - aWeight, - false, - false, - false); - GT_Achievements.registerOre( - GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], - aMinY, - aMaxY, - aWeight, - false, - false, - false); - GT_Achievements.registerOre( - GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], - aMinY, - aMaxY, - aWeight, - false, - false, - false); - sWeight += this.mWeight; - } - } - - public GTPP_Worldgen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, - int aSize, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { - super(aName, sList, aDefault); - this.mDarkWorld = sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Darkworld", true); - this.mMinY = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); - this.mMaxY = ((short) Math - .max(this.mMinY + 5, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY))); - this.mWeight = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); - this.mDensity = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); - this.mSize = ((short) Math.max(1, sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); - /* - * this.mPrimaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", - * aPrimary.mMetaItemSubID)); this.mSecondaryMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + - * this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); this.mBetweenMeta = ((short) - * sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", - * aBetween.mMetaItemSubID)); this.mSporadicMeta = ((short) sCustomWorldgenFile.get(aTextWorldgen + - * this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); - */ this.mRestrictBiome = sCustomWorldgenFile - .get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); - - if (this.mEnabled) { - /* - * GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, - * aWeight, false, false, false); - * GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, - * aWeight, false, false, false); GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta - * % 1000)], aMinY, aMaxY, aWeight, false, false, false); - * GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, - * aWeight, false, false, false); - */ sWeight += this.mWeight; - } - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { - return false; // Not the correct biome for ore mix - } - if (!isGenerationAllowed( - aWorld, - aDimensionType, - ((aDimensionType == -1) && (false)) || ((aDimensionType == 0) && (this.mDarkWorld)) - || ((aDimensionType == 1) && (false)) - || ((aWorld.provider.getDimensionName().equals("Moon")) && (false)) - || ((aWorld.provider.getDimensionName().equals("Mars")) && (false)) ? aDimensionType - : aDimensionType ^ 0xFFFFFFFF)) { - return false; - } - int tMinY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY - 5); - - int cX = aChunkX - aRandom.nextInt(this.mSize); - int eX = aChunkX + 16 + aRandom.nextInt(this.mSize); - for (int tX = cX; tX <= eX; tX++) { - int cZ = aChunkZ - aRandom.nextInt(this.mSize); - int eZ = aChunkZ + 16 + aRandom.nextInt(this.mSize); - for (int tZ = cZ; tZ <= eZ; tZ++) { - if (this.mSecondaryMeta > 0) { - for (int i = tMinY - 1; i < tMinY + 2; i++) { - if ((aRandom.nextInt( - Math.max( - 1, - Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) - / this.mDensity)) - == 0) - || (aRandom.nextInt( - Math.max( - 1, - Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) - / this.mDensity)) - == 0)) { - setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false); - } - } - } - if ((this.mBetweenMeta > 0) && ((aRandom.nextInt( - Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) - == 0) - || (aRandom.nextInt( - Math.max( - 1, - Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) - / this.mDensity)) - == 0))) { - setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false); - } - if (this.mPrimaryMeta > 0) { - for (int i = tMinY + 3; i < tMinY + 6; i++) { - if ((aRandom.nextInt( - Math.max( - 1, - Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) - / this.mDensity)) - == 0) - || (aRandom.nextInt( - Math.max( - 1, - Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) - / this.mDensity)) - == 0)) { - setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false); - } - } - } - if ((this.mSporadicMeta > 0) && ((aRandom.nextInt( - Math.max(1, Math.max(MathHelper.abs_int(cZ - tZ), MathHelper.abs_int(eZ - tZ)) / this.mDensity)) - == 0) - || (aRandom.nextInt( - Math.max( - 1, - Math.max(MathHelper.abs_int(cX - tX), MathHelper.abs_int(eX - tX)) - / this.mDensity)) - == 0))) { - setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false); - } - } - } - if (GT_Values.D1) { - System.out.println("Generated Orevein: " + this.mWorldGenName + " " + aChunkX + " " + aChunkZ); - } - return true; - } - - private Method mSetOre = null; - - private boolean setOreBlock(World world, int x, int y, int z, int secondarymeta, boolean bool) { - - if (mSetOre == null) { - try { - mSetOre = GT_TileEntity_Ores.class.getMethod( - "setOreBlock", - World.class, - int.class, - int.class, - int.class, - int.class, - boolean.class); - } catch (SecurityException | NoSuchMethodException e) { - try { - mSetOre = GT_TileEntity_Ores.class - .getMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class); - } catch (SecurityException | NoSuchMethodException r) {} - } - } - - if (mSetOre != null) { - try { - return (boolean) mSetOre.invoke(world, x, y, z, secondarymeta, bool); - } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException t) { - return false; - } - } else { - return false; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java deleted file mode 100644 index 8ed90b799f..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Handler.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import static gtPlusPlus.xmod.gregtech.api.world.WorldGenUtils.mOresToRegister; - -import gtPlusPlus.core.material.Material; - -public class GTPP_Worldgen_Handler implements Runnable { - - @Override - public void run() { - - for (GT_OreVein_Object ore : mOresToRegister) { - generateNewVein(ore); - } - } - - private final GTPP_Worldgen_GT_Ore_Layer generateNewVein(final GT_OreVein_Object ore) { - return generateNewVein( - ore.mOreMixName, - ore.minY, - ore.maxY, - ore.weight, - ore.density, - ore.size, - ore.aPrimary, - ore.aSecondary, - ore.aBetween, - ore.aSporadic); - } - - private final GTPP_Worldgen_GT_Ore_Layer generateNewVein(String mOreMixName, int minY, int maxY, int weight, - int density, int size, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { - return new GTPP_Worldgen_GT_Ore_Layer( - "ore.mix." + mOreMixName, // String aName, - true, // boolean aDefault, - minY, - maxY, // int aMinY, int aMaxY, - weight, // int aWeight, - density, // int aDensity, - size, // int aSize, - aPrimary, // Materials aPrimary, - aSecondary, // Materials aSecondary, - aBetween, // Materials aBetween, - aSporadic); // Materials aSporadic - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java deleted file mode 100644 index 22b64d6cfc..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore.java +++ /dev/null @@ -1,36 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import static gtPlusPlus.xmod.gregtech.HANDLER_GT.sCustomWorldgenFile; - -import java.util.ArrayList; -import java.util.Collection; - -import net.minecraft.block.Block; - -import gtPlusPlus.xmod.gregtech.HANDLER_GT; - -public abstract class GTPP_Worldgen_Ore extends GTPP_Worldgen { - - public final int mBlockMeta, mAmount, mSize, mMinY, mMaxY, mProbability, mDimensionType; - public final Block mBlock; - public final Collection<String> mBiomeList; - public final boolean mAllowToGenerateinVoid; - private final String aTextWorldgen = "worldgen."; - - public GTPP_Worldgen_Ore(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, - int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, - boolean aAllowToGenerateinVoid) { - super(aName, HANDLER_GT.sCustomWorldgenList, aDefault); - mDimensionType = aDimensionType; - mBlock = aBlock; - mBlockMeta = Math.min(Math.max(aBlockMeta, 0), 15); - mProbability = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "Probability", aProbability); - mAmount = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "Amount", aAmount); - mSize = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "Size", aSize); - mMinY = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "MinHeight", aMinY); - mMaxY = sCustomWorldgenFile.get(aTextWorldgen + mWorldGenName, "MaxHeight", aMaxY); - if (aBiomeList == null) mBiomeList = new ArrayList<String>(); - else mBiomeList = aBiomeList; - mAllowToGenerateinVoid = aAllowToGenerateinVoid; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java deleted file mode 100644 index b8113d5f86..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java +++ /dev/null @@ -1,120 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import java.util.Collection; -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -import gtPlusPlus.core.lib.CORE; - -public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { - - public GTPP_Worldgen_Ore_Normal(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, - int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, - boolean aAllowToGenerateinVoid) { - super( - aName, - aDefault, - aBlock, - aBlockMeta, - aDimensionType, - aAmount, - aSize, - aProbability, - aMinY, - aMaxY, - aBiomeList, - aAllowToGenerateinVoid); - } - - @Override - public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, - int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { - if (isGenerationAllowed(aWorld, aDimensionType, mDimensionType) - && (mBiomeList.isEmpty() || mBiomeList.contains(aBiome)) - && (mProbability <= 1 || aRandom.nextInt(mProbability) == 0)) { - for (int i = 0; i < mAmount; i++) { - int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), - tZ = aChunkZ + aRandom.nextInt(16); - if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) { - float math_pi = CORE.PI; - float var1b = mSize / 8.0F; - float var6 = aRandom.nextFloat() * math_pi; - float var3b = MathHelper.sin(var6) * var1b; - float var4b = MathHelper.cos(var6) * var1b; - float var8b = -2 * var3b; - float var9b = -2 * var4b; - int var10b = (tX + 8); - int var11b = (tZ + 8); - float var7 = (var10b + var3b); - float var11 = (var11b + var4b); - int var5b = aRandom.nextInt(3); - int var6b = aRandom.nextInt(3); - int var7b = var6b - var5b; - float var15 = (tY + var5b - 2); - float var12b = math_pi / mSize; - - for (int var19 = 0; var19 <= mSize; ++var19) { - float var2b = var19 / mSize; - float var20 = var7 + var8b * var2b; - float var22 = var15 + var7b * var2b; - float var24 = var11 + var9b * var2b; - float var26 = aRandom.nextFloat() * mSize / 16.0F; - float var28 = ((MathHelper.sin(var19 * var12b) + 1.0F) * var26 + 1.0F) / 2.0F; - int var32 = MathHelper.floor_float(var20 - var28); - int var33 = MathHelper.floor_float(var22 - var28); - int var34 = MathHelper.floor_float(var24 - var28); - int var35 = MathHelper.floor_float(var20 + var28); - int var36 = MathHelper.floor_float(var22 + var28); - int var37 = MathHelper.floor_float(var24 + var28); - - for (int var38 = var32; var38 <= var35; ++var38) { - float var39 = (var38 + 0.5F - var20) / (var28); - float var13b = var39 * var39; - if (var13b < 1.0F) { - for (int var41 = var33; var41 <= var36; ++var41) { - float var42 = (var41 + 0.5F - var22) / (var28); - float var14b = var13b + var42 * var42; - if (var14b < 1.0F) { - for (int var44 = var34; var44 <= var37; ++var44) { - float var45 = (var44 + 0.5F - var24) / (var28); - Block block = aWorld.getBlock(var38, var41, var44); - if (var14b + var45 * var45 < 1.0F && ((mAllowToGenerateinVoid && aWorld - .getBlock(var38, var41, var44).isAir(aWorld, var38, var41, var44)) - || (block != null && (block.isReplaceableOreGen( - aWorld, - var38, - var41, - var44, - Blocks.stone) - || block.isReplaceableOreGen( - aWorld, - var38, - var41, - var44, - Blocks.end_stone) - || block.isReplaceableOreGen( - aWorld, - var38, - var41, - var44, - Blocks.netherrack))))) { - aWorld.setBlock(var38, var41, var44, mBlock, mBlockMeta, 0); - } - } - } - } - } - } - } - } - } - return true; - } - return false; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java deleted file mode 100644 index 65813693b3..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/GT_OreVein_Object.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import gtPlusPlus.core.material.Material; - -public class GT_OreVein_Object { - - final String mOreMixName; // String aName, - final int minY, maxY; // int aMinY, int aMaxY, - final int weight; // int aWeight, - final int density; // int aDensity, - final int size; // int aSize, - final Material aPrimary; // Materials aPrimary, - final Material aSecondary; // Materials aSecondary, - final Material aBetween; // Materials aBetween, - final Material aSporadic; // Materials aSporadic - - GT_OreVein_Object(String mOreMixName, int minY, int maxY, int weight, int density, int size, Material aPrimary, - Material aSecondary, Material aBetween, Material aSporadic) { - this.mOreMixName = mOreMixName; - this.minY = minY; - this.maxY = maxY; - this.weight = weight; - this.density = density; - this.size = size; - this.aPrimary = aPrimary; - this.aSecondary = aSecondary; - this.aBetween = aBetween; - this.aSporadic = aSporadic; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java deleted file mode 100644 index 5ca61cf4d7..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/world/WorldGenUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.world; - -import java.util.ArrayList; -import java.util.List; - -import gtPlusPlus.core.material.Material; - -public class WorldGenUtils { - - static List<GT_OreVein_Object> mOresToRegister = new ArrayList<GT_OreVein_Object>(); - - public static final void addNewOreMixForWorldgen(GT_OreVein_Object newVein) { - mOresToRegister.add(newVein); - } - - public static boolean generateNewOreVeinObject(String mOreMixName, int minY, int maxY, int weight, int density, - int size, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) { - GT_OreVein_Object newVein = new GT_OreVein_Object( - mOreMixName, - minY, - maxY, - weight, - density, - size, - aPrimary, - aSecondary, - aBetween, - aSporadic); - addNewOreMixForWorldgen(newVein); - return true; - } -} |