Code cleanup

This commit is contained in:
Bernhard Bonigl committed 2016-03-18 17:51:27 +01:00
1 parent ddea705e83
commit 9fa56c7375
23 files changed
+276 -311

No files matched your search

@@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemColored;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameData;
@@ -32,7 +32,9 @@ public class ItemBlockMeta extends ItemColored {
@Override
public String getUnlocalizedName(ItemStack stack) {
if(mappingProperty == null) return super.getUnlocalizedName(stack);
if(mappingProperty == null) {
return super.getUnlocalizedName(stack);
}
IBlockState state = block.getStateFromMeta(stack.getMetadata());
String name = state.getValue(mappingProperty).toString().toLowerCase(Locale.US);
@@ -40,7 +42,7 @@ public class ItemBlockMeta extends ItemColored {
}
public static void setMappingProperty(Block block, IProperty<?> property) {
((ItemBlockMeta)Item.getItemFromBlock(block)).mappingProperty = property;
((ItemBlockMeta) Item.getItemFromBlock(block)).mappingProperty = property;
}
@Override
@@ -62,11 +64,12 @@ public class ItemBlockMeta extends ItemColored {
final ResourceLocation loc = GameData.getBlockRegistry().getNameForObject(block);
for(Comparable o : (Collection<Comparable>)mappingProperty.getAllowedValues()) {
for(Comparable o : (Collection<Comparable>) mappingProperty.getAllowedValues()) {
int meta = block.getMetaFromState(block.getDefaultState().withProperty(mappingProperty, o));
String name = mappingProperty.getName(o);
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(loc, mappingProperty.getName() + "=" + name));
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(loc, mappingProperty
.getName() + "=" + name));
}
}
}