diff options
Diffstat (limited to 'src')
49 files changed, 891 insertions, 6 deletions
diff --git a/src/main/java/kubatech/CommonProxy.java b/src/main/java/kubatech/CommonProxy.java index db752f9fa0..6f9a187cc2 100644 --- a/src/main/java/kubatech/CommonProxy.java +++ b/src/main/java/kubatech/CommonProxy.java @@ -19,6 +19,8 @@ package kubatech; +import static kubatech.loaders.ItemLoader.RegisterItems; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.*; import kubatech.commands.CommandConfig; @@ -36,6 +38,7 @@ public class CommonProxy { Config.synchronizeConfiguration(); RecipeLoader.addRecipes(); FMLCommonHandler.instance().bus().register(new FMLEventHandler()); + RegisterItems(); } public void init(FMLInitializationEvent event) {} diff --git a/src/main/java/kubatech/api/ConstructableItemStack.java b/src/main/java/kubatech/api/ConstructableItemStack.java index 668d21d803..728e7299cd 100644 --- a/src/main/java/kubatech/api/ConstructableItemStack.java +++ b/src/main/java/kubatech/api/ConstructableItemStack.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api; import cpw.mods.fml.common.registry.GameRegistry; diff --git a/src/main/java/kubatech/api/enums/ItemList.java b/src/main/java/kubatech/api/enums/ItemList.java index b0cf3289b6..270faf39cc 100644 --- a/src/main/java/kubatech/api/enums/ItemList.java +++ b/src/main/java/kubatech/api/enums/ItemList.java @@ -14,7 +14,21 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public enum ItemList implements IItemContainer { - ExtremeExterminationChamber; + ExtremeExterminationChamber, + BlackTea, + ButterflyTea, + EarlGrayTea, + GreenTea, + LemonTea, + MilkTea, + OolongTea, + PeppermintTea, + PuerhTea, + RedTea, + WhiteTea, + YellowTea, + UltimateTea, + ; private ItemStack mStack; private boolean mHasNotBeenSet = true; diff --git a/src/main/java/kubatech/api/mobhandler/MobDrop.java b/src/main/java/kubatech/api/mobhandler/MobDrop.java index 76942b3148..247c73a2be 100644 --- a/src/main/java/kubatech/api/mobhandler/MobDrop.java +++ b/src/main/java/kubatech/api/mobhandler/MobDrop.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.mobhandler; import io.netty.buffer.ByteBuf; diff --git a/src/main/java/kubatech/api/network/CustomTileEntityPacket.java b/src/main/java/kubatech/api/network/CustomTileEntityPacket.java index cd7bfd3389..9a3df765d2 100644 --- a/src/main/java/kubatech/api/network/CustomTileEntityPacket.java +++ b/src/main/java/kubatech/api/network/CustomTileEntityPacket.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.network; import cpw.mods.fml.common.network.NetworkRegistry; diff --git a/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java b/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java index 643ca70d0f..4208ea92fe 100644 --- a/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java +++ b/src/main/java/kubatech/api/tileentity/CustomTileEntityPacketHandler.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.tileentity; import kubatech.api.network.CustomTileEntityPacket; diff --git a/src/main/java/kubatech/api/utils/FastRandom.java b/src/main/java/kubatech/api/utils/FastRandom.java index c0fb1ec9d5..0927dee6c0 100644 --- a/src/main/java/kubatech/api/utils/FastRandom.java +++ b/src/main/java/kubatech/api/utils/FastRandom.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.utils; import java.util.Random; diff --git a/src/main/java/kubatech/api/utils/GSONUtils.java b/src/main/java/kubatech/api/utils/GSONUtils.java index 90f777000c..2936aee2b2 100644 --- a/src/main/java/kubatech/api/utils/GSONUtils.java +++ b/src/main/java/kubatech/api/utils/GSONUtils.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.utils; import com.google.gson.*; diff --git a/src/main/java/kubatech/api/utils/ItemID.java b/src/main/java/kubatech/api/utils/ItemID.java index 932c45a0f9..a452021bad 100644 --- a/src/main/java/kubatech/api/utils/ItemID.java +++ b/src/main/java/kubatech/api/utils/ItemID.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.utils; import java.util.Objects; diff --git a/src/main/java/kubatech/api/utils/MobUtils.java b/src/main/java/kubatech/api/utils/MobUtils.java index 0b20364484..a82b336190 100644 --- a/src/main/java/kubatech/api/utils/MobUtils.java +++ b/src/main/java/kubatech/api/utils/MobUtils.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.api.utils; import cpw.mods.fml.relauncher.Side; diff --git a/src/main/java/kubatech/commands/CommandHelp.java b/src/main/java/kubatech/commands/CommandHelp.java index dba8ab622d..8f9c19c42e 100644 --- a/src/main/java/kubatech/commands/CommandHelp.java +++ b/src/main/java/kubatech/commands/CommandHelp.java @@ -19,7 +19,8 @@ package kubatech.commands; -import static kubatech.commands.CommandHelp.Translations.*; +import static kubatech.commands.CommandHelp.Translations.POSSIBLE_COMMANDS; +import static kubatech.commands.CommandHelp.Translations.USAGE; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/kubatech/config/OverridesConfig.java b/src/main/java/kubatech/config/OverridesConfig.java index 0ea7a318f7..7d149fef81 100644 --- a/src/main/java/kubatech/config/OverridesConfig.java +++ b/src/main/java/kubatech/config/OverridesConfig.java @@ -1,3 +1,22 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + package kubatech.config; import com.dreammaster.main.MainRegistry; @@ -12,7 +31,10 @@ import java.io.File; import java.io.Reader; import java.io.Writer; import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import kubatech.Tags; import kubatech.api.ConstructableItemStack; import kubatech.api.LoaderReference; diff --git a/src/main/java/kubatech/kubatech.java b/src/main/java/kubatech/kubatech.java index 6973c281b4..6a19eb3721 100644 --- a/src/main/java/kubatech/kubatech.java +++ b/src/main/java/kubatech/kubatech.java @@ -19,6 +19,8 @@ package kubatech; +import static kubatech.api.enums.ItemList.RedTea; + import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.*; @@ -26,6 +28,9 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; import kubatech.api.network.CustomTileEntityPacket; import kubatech.api.network.LoadConfigPacket; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -42,6 +47,25 @@ public class kubatech { public static kubatech instance = null; public static final SimpleNetworkWrapper NETWORK = new SimpleNetworkWrapper(Tags.MODID); + public static final CreativeTabs KT = new CreativeTabs(Tags.MODID) { + private ItemStack iconItemStack = null; + + @Override + public ItemStack getIconItemStack() { + if (iconItemStack == null) iconItemStack = RedTea.get(1); + return iconItemStack; + } + + @Override + public Item getTabIconItem() { + return null; + } + + @Override + public String getTranslatedTabLabel() { + return Tags.MODNAME; + } + }; static { NETWORK.registerMessage(new LoadConfigPacket.Handler(), LoadConfigPacket.class, 0, Side.CLIENT); diff --git a/src/main/java/kubatech/loaders/ItemLoader.java b/src/main/java/kubatech/loaders/ItemLoader.java new file mode 100644 index 0000000000..940f5274f9 --- /dev/null +++ b/src/main/java/kubatech/loaders/ItemLoader.java @@ -0,0 +1,48 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + +package kubatech.loaders; + +import static kubatech.api.enums.ItemList.*; + +import cpw.mods.fml.common.registry.GameRegistry; +import kubatech.loaders.item.KubaItems; +import kubatech.loaders.item.items.Tea; +import kubatech.loaders.item.items.TeaUltimate; + +public class ItemLoader { + public static final KubaItems kubaitems = new KubaItems(); + + public static void RegisterItems() { + GameRegistry.registerItem(kubaitems, "kubaitems"); + BlackTea.set(kubaitems.registerProxyItem(new Tea("black_tea"))); + ButterflyTea.set(kubaitems.registerProxyItem(new Tea("butterfly_tea"))); + EarlGrayTea.set(kubaitems.registerProxyItem(new Tea("earl_gray_tea"))); + GreenTea.set(kubaitems.registerProxyItem(new Tea("green_tea"))); + LemonTea.set(kubaitems.registerProxyItem(new Tea("lemon_tea"))); + MilkTea.set(kubaitems.registerProxyItem(new Tea("milk_tea"))); + OolongTea.set(kubaitems.registerProxyItem(new Tea("oolong_tea"))); + PeppermintTea.set(kubaitems.registerProxyItem(new Tea("peppermint_tea"))); + PuerhTea.set(kubaitems.registerProxyItem(new Tea("pu-erh_tea"))); + RedTea.set(kubaitems.registerProxyItem(new Tea("red_tea"))); + WhiteTea.set(kubaitems.registerProxyItem(new Tea("white_tea"))); + YellowTea.set(kubaitems.registerProxyItem(new Tea("yellow_tea"))); + UltimateTea.set(kubaitems.registerProxyItem(new TeaUltimate())); + } +} diff --git a/src/main/java/kubatech/loaders/item/ItemProxy.java b/src/main/java/kubatech/loaders/item/ItemProxy.java new file mode 100644 index 0000000000..67491a0ba8 --- /dev/null +++ b/src/main/java/kubatech/loaders/item/ItemProxy.java @@ -0,0 +1,84 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + +package kubatech.loaders.item; + +import java.util.List; +import kubatech.Tags; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemProxy { + private final String unlocalizedName; + private final String texturepath; + private IIcon icon; + private int itemID; + + public ItemProxy(String unlocalizedName, String texture) { + this.unlocalizedName = "item.kubaitem." + unlocalizedName; + texturepath = Tags.MODID + ":" + texture; + } + + public void ItemInit(int index) { + itemID = index; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + public String getDisplayName(ItemStack stack) { + return StatCollector.translateToLocal(this.unlocalizedName + ".name").trim(); + } + + public void registerIcon(IIconRegister iconRegister) { + icon = iconRegister.registerIcon(texturepath); + } + + public IIcon getIcon() { + return icon; + } + + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {} + + public void onUpdate( + ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {} + + public EnumAction getItemUseAction(ItemStack p_77661_1_) { + return EnumAction.none; + } + + public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { + return p_77659_1_; + } + + public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) { + return p_77654_1_; + } + + public int getMaxItemUseDuration() { + return 0; + } +} diff --git a/src/main/java/kubatech/loaders/item/KubaItems.java b/src/main/java/kubatech/loaders/item/KubaItems.java new file mode 100644 index 0000000000..fdc38ec0ba --- /dev/null +++ b/src/main/java/kubatech/loaders/item/KubaItems.java @@ -0,0 +1,145 @@ +/* + * KubaTech - Gregtech Addon + * Copyright (C) 2022 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * + */ + +package kubatech.loaders.item; + +import static kubatech.kubatech.KT; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.List; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class KubaItems extends Item { + private static final HashMap<Integer, ItemProxy> items = new HashMap<>(); + private static int idCounter = 0; + + public KubaItems() { + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.setCreativeTab(KT); + this.setUnlocalizedName("kubaitems"); + } + + public ItemStack registerProxyItem(ItemProxy item) { + items.put(idCounter, item); + item.ItemInit(idCounter); + return new ItemStack(this, 1, idCounter++); + } + + private ItemProxy getItem(ItemStack stack) { + return items.get(stack.getItemDamage()); + } + + private ItemProxy getItem(int damage) { + return items.get(damage); + } + + @Override + public boolean onItemUse( + ItemStack p_77648_1_, + EntityPlayer p_77648_2_, + World p_77648 |
