mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 12:42:53 +00:00
Generics for everyone \o/
This commit is contained in:
1 parent
ac9344cbda
commit
23ed2dcaea
55 files changed
+164
-163
No files matched your search
@@ -8,7 +8,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface IFlowerType<I extends IFlowerType> extends Comparable<I> {
|
||||
public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
|
||||
@@ -54,9 +54,9 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicBrickPair>, IColoredBlock, ISpriteRegister, IStateMapperRegister, IItemModelRegister {
|
||||
|
||||
|
||||
public static final PropertyEnum<CeramicBrickType> TYPE = PropertyEnum.create("type", CeramicBrickType.class);
|
||||
|
||||
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.ROCK);
|
||||
this.setHardness(1.0f);
|
||||
@@ -85,7 +85,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileCeramicBrick();
|
||||
@@ -111,7 +111,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Brown, CeramicBrickType.Chequered).getStack(1));
|
||||
itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Brown, CeramicBrickType.LargeBrick).getStack(1));
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
@@ -120,49 +120,49 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
ModelManager.registerCustomBlockModel(new BlockModelEntry(
|
||||
new ModelResourceLocation(resourceLocation, "normal"),
|
||||
new ModelResourceLocation(resourceLocation, "inventory"),
|
||||
new ModelMutlipass(BlockCeramicBrick.class), this));
|
||||
new ModelMutlipass<>(BlockCeramicBrick.class), this));
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, new CeramicBrickMeshDefinition());
|
||||
}
|
||||
|
||||
|
||||
private class CeramicBrickMeshDefinition implements ItemMeshDefinition{
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(this, new IProperty[]{TYPE}, new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(TYPE, CeramicBrickType.VALUES[meta]);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return ((IExtendedBlockState)super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos).withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, ItemStack stack) {
|
||||
return getDefaultState().withProperty(TYPE, CeramicBrickType.get(meta >> 16 & 0xFF));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(worldIn, pos, TileCeramicBrick.class);
|
||||
@@ -194,13 +194,13 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses() {
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List list, final boolean flag) {
|
||||
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> list, final boolean flag) {
|
||||
if (!itemStack.hasTagCompound()) {
|
||||
return;
|
||||
}
|
||||
@@ -138,11 +138,11 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List<ItemStack> itemList) {
|
||||
this.addCreativeItems(itemList, true);
|
||||
}
|
||||
|
||||
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
|
||||
public void addCreativeItems(final List<ItemStack> itemList, final boolean hideSecrets) {
|
||||
for (final IIndividual individual : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List subItems) {
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
for (Material mat : Material.values()) {
|
||||
for (Insulate ins : Insulate.values()) {
|
||||
subItems.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
@@ -54,7 +54,7 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add(Insulate.get(itemStack.getItemDamage()).getName());
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List subBlocks) {
|
||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List<ItemStack> subBlocks) {
|
||||
for (final Type type : Type.values()) {
|
||||
subBlocks.add(type.get());
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List<ItemStack> par3List) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH(final World world, final BlockPos pos) {
|
||||
return world.getBlockState(pos).getValue(ACIDITY);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ItemSoil extends ItemBlock {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer playerIn, final List tooltip, final boolean advanced) {
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer playerIn, final List<String> tooltip, final boolean advanced) {
|
||||
String info = "";
|
||||
info += BlockSoil.getMoisture(stack, true, true);
|
||||
if (info.length() > 0) {
|
||||
|
||||
@@ -936,7 +936,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
};
|
||||
|
||||
IFlowerType type;
|
||||
IFlowerType<EnumFlowerType> type;
|
||||
String name;
|
||||
String binomial;
|
||||
String branchName;
|
||||
@@ -968,19 +968,19 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
private IAllele[] template;
|
||||
private IFlowerGenome genome;
|
||||
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType type, final EnumFlowerColor colour) {
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType<EnumFlowerType> type, final EnumFlowerColor colour) {
|
||||
this(name, branch, binomial, type, false, colour, colour);
|
||||
}
|
||||
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType type, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) {
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType<EnumFlowerType> type, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) {
|
||||
this(name, branch, binomial, type, true, primaryColor, secondaryColor);
|
||||
}
|
||||
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType type, final boolean isDominant, final EnumFlowerColor colour) {
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType<EnumFlowerType> type, final boolean isDominant, final EnumFlowerColor colour) {
|
||||
this(name, branch, binomial, type, isDominant, colour, colour);
|
||||
}
|
||||
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType flowerType, final boolean isDominant, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) {
|
||||
FlowerDefinition(final String name, final String branch, final String binomial, final IFlowerType<EnumFlowerType> flowerType, final boolean isDominant, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) {
|
||||
String uid = Constants.BOTANY_MOD_ID + ".flower" + this;
|
||||
String unlocalizedDescription = "botany.description.flower" + this;
|
||||
String unlocalizedName = "botany.flowers.species." + name;
|
||||
@@ -1068,7 +1068,8 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
public static void preInitFlowers() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(FlowerManager.flowerRoot));
|
||||
for (FlowerDefinition def : values()) {
|
||||
IFlowerType type = def.species.getType();
|
||||
@SuppressWarnings("unchecked")
|
||||
IFlowerType<EnumFlowerType> type = def.species.getType();
|
||||
if (EnumFlowerType.highestSection < type.getSections()) {
|
||||
EnumFlowerType.highestSection = type.getSections();
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getMemberClass() {
|
||||
public Class<IFlower> getMemberClass() {
|
||||
return IFlower.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List<ItemStack> par3List) {
|
||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public enum BotanyItems implements IItemMiscProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(List tooltip) {
|
||||
public void addInformation(List<String> tooltip) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user