From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../jp/plusplus/fbs/pottery/PotteryRegistry.java | 220 +++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java (limited to 'src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java') diff --git a/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java new file mode 100644 index 0000000..8cc6ae7 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/PotteryRegistry.java @@ -0,0 +1,220 @@ +package jp.plusplus.fbs.pottery; + +import cpw.mods.fml.common.FMLLog; +import jp.plusplus.fbs.FBS; +import jp.plusplus.fbs.api.IPottery; +import jp.plusplus.fbs.block.BlockCore; +import jp.plusplus.fbs.item.ItemCore; +import jp.plusplus.fbs.pottery.usable.*; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +/** + * Created by plusplus_F on 2016/03/30. + */ +public class PotteryRegistry { + private static PotteryRegistry instance=new PotteryRegistry(); + + private ArrayList potteries=new ArrayList(); + private ArrayList potteryEffects=new ArrayList(); + private PotteryBase cachedPotteryEffect; + public PotteryPair cachedPottery; + + + public static void register(){ + + //------------------------------------陶芸---------------------------------------------- + + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)0, false), "","",""," c c "," c "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)1, false), "","",""," csc "," c "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)2, false), "","",""," cbc "," c "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)3, false), "","",""," cfc "," c "); + + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)0, true), "","",""," g g "," g "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)1, true), "","",""," gsg "," g "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)2, true), "","",""," gbg "," g "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.SMALL, (byte)3, true), "","",""," gfg "," g "); + + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)0, false), "",""," c c "," c c "," ccc "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)1, false), "",""," c c "," csc "," ccc "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)2, false), "",""," c c "," cbc "," ccc "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)3, false), "",""," c c "," cfc "," ccc "); + + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)0, true), "",""," g g "," g g "," ggg "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)1, true), "",""," g g "," gsg "," ggg "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)2, true), "",""," g g "," gbg "," ggg "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.MEDIUM, (byte)3, true), "",""," g g "," gfg "," ggg "); + + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)0, false), " c c "," c c ","c c","c c"," ccc "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)1, false), " c c "," c c ","c c","c s c"," ccc "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)2, false), " c c "," c c ","c c","c b c"," ccc "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)3, false), " c c "," c c ","c c","c f c"," ccc "); + + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)0, true), " g g "," g g ","g g","g g"," ggg "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)1, true), " g g "," g g ","g g","g s g"," ggg "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)2, true), " g g "," g g ","g g","g b g"," ggg "); + RegisterPotteryCrafting(BlockCore.pot.getItemStack(IPottery.PotteryState.MOLDED, IPottery.PotteryGrade.NORMAL, IPottery.PotterySize.LARGE, (byte)3, true), " g g "," g g ","g g","g f g"," ggg "); + + registerPotteryEffect(new PotteryKeep()); + registerPotteryEffect(new PotterySenaka()); + registerPotteryEffect(new PotteryVoid()); + registerPotteryEffect(new PotteryChange()); + registerPotteryEffect(new PotteryCrucible()); + registerPotteryEffect(new PotteryLottery()); + registerPotteryEffect(new PotteryTaboo()); + registerPotteryEffect(new PotteryUnbreakable()); + registerPotteryEffect(new PotteryEnchantment()); + registerPotteryEffect(new PotteryTaboo()); + registerPotteryEffect(new PotteryFurnace()); + registerPotteryEffect(new PotteryAppraisal()); + } + + /* + #################################################### + Potter's Wheel + + クラフト処理は現在クソ以外の何者でもない(Registry.PotteryPair.isMatch参照)ですが仮実装なので・・・ + 要望があればキチンとした感じに作り直します + #################################################### + */ + + public static void RegisterPotteryCrafting(ItemStack prod, String ... str){ + instance.potteries.add(new PotteryRegistry.PotteryPair(prod, str)); + } + public static ItemStack GetPotteryCrafting(ItemStack[] r){ + if(instance.cachedPottery!=null && instance.cachedPottery.isMatch(r)){ + return instance.cachedPottery.product; + } + + for(PotteryRegistry.PotteryPair pp : instance.potteries){ + if(pp.isMatch(r)){ + instance.cachedPottery=pp; + return pp.product; + } + } + return null; + } + public static ArrayList GetPotteryCrafting(){ return instance.potteries; } + + + public static int registerPotteryEffect(PotteryBase p){ + instance.potteryEffects.add(p); + return instance.potteryEffects.size()-1; + } + public static PotteryBase getPotteryEffect(int id){ + return instance.potteryEffects.get(id); + } + public static PotteryBase getPotteryEffect(String unlocalizedName){ + if(instance.cachedPotteryEffect!=null && instance.cachedPotteryEffect.getUnlocalizedName().equals(unlocalizedName)){ + return instance.cachedPotteryEffect; + } + + for(PotteryBase pb : instance.potteryEffects){ + if(pb.getUnlocalizedName().equals(unlocalizedName)){ + instance.cachedPotteryEffect=pb; + return pb; + } + } + return null; + } + public static int getPotteryEffectId(String unlocalizedName){ + int s=instance.potteryEffects.size(); + for(int i=0;i