mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-18 19:29:32 +00:00
Add generics information from forge where possible
This commit is contained in:
1 parent
05c7b3f85f
commit
ac6e5d2861
6 files changed
+18
-15
No files matched your search
@@ -8,31 +8,33 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta> extends Block {
|
||||
public final PropertyEnum prop;
|
||||
public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializable> extends Block {
|
||||
public final PropertyEnum<E> prop;
|
||||
private final E[] values;
|
||||
|
||||
private static PropertyEnum tmp;
|
||||
private static PropertyEnum<?> tmp;
|
||||
|
||||
public EnumBlock(Material material, PropertyEnum prop, Class<E> clazz) {
|
||||
public EnumBlock(Material material, PropertyEnum<E> prop, Class<E> clazz) {
|
||||
super(preInit(material, prop));
|
||||
this.prop = prop;
|
||||
values = clazz.getEnumConstants();
|
||||
}
|
||||
|
||||
private static Material preInit(Material material, PropertyEnum property) {
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Material preInit(Material material, PropertyEnum<?> property) {
|
||||
tmp=property;
|
||||
return material;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) {
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(E type : values) {
|
||||
list.add(new ItemStack(this, 1, type.getMeta()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package slimeknights.mantle.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
@@ -46,12 +47,12 @@ public class BlockItemModelWrapper implements IPerspectiveAwareModel, IFlexibleB
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getFaceQuads(EnumFacing p_177551_1_) {
|
||||
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
|
||||
return parent.getFaceQuads(p_177551_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getGeneralQuads() {
|
||||
public List<BakedQuad> getGeneralQuads() {
|
||||
return parent.getGeneralQuads();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ public class ItemBlockMeta extends ItemColored {
|
||||
return super.getUnlocalizedName(stack) + "." + name;
|
||||
}
|
||||
|
||||
public static void setMappingProperty(Block block, IProperty property) {
|
||||
public static void setMappingProperty(Block block, IProperty<?> property) {
|
||||
((ItemBlockMeta)Item.getItemFromBlock(block)).mappingProperty = property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
if(StatCollector.canTranslate(this.getUnlocalizedName(stack) + ".tooltip")) {
|
||||
tooltip.add(EnumChatFormatting.GRAY.toString() +
|
||||
LocUtils.translateRecursive(this.getUnlocalizedName(stack) + ".tooltip"));
|
||||
|
||||
@@ -93,13 +93,13 @@ public class ItemEdible extends ItemFood {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
dynamic.addInformation(stack, playerIn, tooltip, advanced);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) {
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
dynamic.getSubItems(itemIn, tab, subItems);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ItemMetaDynamic extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) {
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
for(int i = 0; i <= availabilityMask.length; i++) {
|
||||
if(isValid(i)) {
|
||||
subItems.add(new ItemStack(itemIn, 1, i));
|
||||
@@ -119,7 +119,7 @@ public class ItemMetaDynamic extends Item {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
if(StatCollector.canTranslate(this.getUnlocalizedName(stack) + ".tooltip")) {
|
||||
tooltip.add(EnumChatFormatting.GRAY.toString() +
|
||||
LocUtils.translateRecursive(this.getUnlocalizedName(stack) + ".tooltip"));
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Collection;
|
||||
|
||||
public class PropertyUnlistedDirection extends PropertyDirection implements IUnlistedProperty<EnumFacing> {
|
||||
|
||||
public PropertyUnlistedDirection(String name, Collection values) {
|
||||
public PropertyUnlistedDirection(String name, Collection<EnumFacing> values) {
|
||||
super(name, values);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user