spotlessApply

This commit is contained in:
Zereff06 committed 2023-01-29 23:41:53 +02:00
1 parent 82de7905b1
commit 79e853ad0b
4 files changed
+1285 -701

No files matched your search

+139 -149
View File
@@ -2,186 +2,176 @@ package team.chisel.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import team.chisel.Chisel;
import team.chisel.config.Configurations;
import com.cricketcraft.chisel.api.ChiselTabs;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.api.carving.CarvableHelper;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
import com.cricketcraft.chisel.api.rendering.ClientUtils;
import net.minecraft.entity.EnumCreatureType;
import team.chisel.Chisel;
import com.cricketcraft.chisel.api.ChiselTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import team.chisel.config.Configurations;
public class BlockCarvable extends Block implements ICarvable {
public CarvableHelper carverHelper;
private boolean isAlpha;
public CarvableHelper carverHelper;
private boolean isAlpha;
private static final boolean canMobsSpawnOnTheChiselBlocks = Configurations.canMobsSpawnOnTheChiselBlocks;
public BlockCarvable() {
this(Material.rock);
}
public BlockCarvable() {
this(Material.rock);
}
public BlockCarvable(Material m) {
super(m);
if (m == Material.rock || m == Material.iron) {
setHarvestLevel("pickaxe", 0);
}
carverHelper = new CarvableHelper(this);
setResistance(10.0F);
setHardness(2.0F);
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
}
public BlockCarvable(Material m) {
super(m);
if (m == Material.rock || m == Material.iron) {
setHarvestLevel("pickaxe", 0);
}
carverHelper = new CarvableHelper(this);
setResistance(10.0F);
setHardness(2.0F);
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
}
public BlockCarvable setStained(boolean a) {
this.isAlpha = a;
return this;
}
public BlockCarvable setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return isAlpha ? 1 : 0;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return carverHelper.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return carverHelper.getIcon(world, x, y, z, side);
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
public int damageDropped(int i) {
return i;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons(Chisel.MOD_ID, this, register);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
carverHelper.registerBlockIcons(Chisel.MOD_ID, this, register);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
carverHelper.registerSubBlocks(this, tabs, list);
}
@Override
public int getRenderType() {
return ClientUtils.renderCTMId;
}
@Override
public int getRenderType() {
return ClientUtils.renderCTMId;
}
@Override
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
return carverHelper.getVariation(metadata);
}
@Override
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
return carverHelper.getVariation(metadata);
}
@Override
public IVariationInfo getManager(int meta) {
return carverHelper.getVariation(meta);
}
@Override
public IVariationInfo getManager(int meta) {
return carverHelper.getVariation(meta);
}
public static class SoundType extends Block.SoundType {
public static class SoundType extends Block.SoundType {
public final String soundNameStep;
public final String soundNameBreak;
public final String soundNamePlace;
public final String soundNameStep;
public final String soundNameBreak;
public final String soundNamePlace;
/**
* Creates a SoundType with automatic names for step and break sounds. Sound names dig.soundName and step.soundName must be specified in the sounds.json
*
* @param soundName
* block of the sound. Will automatically be expanded to "mod:dig.soundName" and "mod:step.soundName" respectively)
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundName, float volume, float frequency) {
super(soundName, volume, frequency);
this.soundNameStep = null;
this.soundNameBreak = null;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with automatic names for step and break sounds. Sound names dig.soundName and
* step.soundName must be specified in the sounds.json
*
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
* "mod:step.soundName" respectively)
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundName, float volume, float frequency) {
super(soundName, volume, frequency);
this.soundNameStep = null;
this.soundNameBreak = null;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the sounds.json
*
* @param soundNameBreak
* block break sound
* @param soundNameStep
* block step sound
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with manual names for step and break sounds. Sound names must be specified in the
* sounds.json
*
* @param soundNameBreak block break sound
* @param soundNameStep block step sound
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = null;
}
/**
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the sounds.json
*
* @param soundNameBreak
* block break sound
* @param soundNameStep
* block step sound
* @param soundNamePlace
* block place sound
* @param volume
* default 1.0f
* @param frequency
* default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = soundNamePlace;
}
/**
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the
* sounds.json
*
* @param soundNameBreak block break sound
* @param soundNameStep block step sound
* @param soundNamePlace block place sound
* @param volume default 1.0f
* @param frequency default 1.0f
*/
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume,
float frequency) {
super(soundNameStep, volume, frequency);
this.soundNameStep = soundNameStep;
this.soundNameBreak = soundNameBreak;
this.soundNamePlace = soundNamePlace;
}
@Override
public String getBreakSound() {
if (soundNameBreak == null)
return Chisel.MOD_ID + ":dig." + this.soundName;
else
return this.soundNameBreak;
}
@Override
public String getBreakSound() {
if (soundNameBreak == null) return Chisel.MOD_ID + ":dig." + this.soundName;
else return this.soundNameBreak;
}
@Override
public String getStepResourcePath() {
if (soundNameStep == null)
return Chisel.MOD_ID + ":step." + this.soundName;
else
return this.soundNameStep;
}
@Override
public String getStepResourcePath() {
if (soundNameStep == null) return Chisel.MOD_ID + ":step." + this.soundName;
else return this.soundNameStep;
}
@Override
public String func_150496_b() {
if (soundNamePlace == null) return getBreakSound();
else return this.soundNamePlace;
}
}
@Override
public String func_150496_b() {
if (soundNamePlace == null)
return getBreakSound();
else
return this.soundNamePlace;
}
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
return canMobsSpawnOnTheChiselBlocks;
@@ -15,172 +15,305 @@ import team.chisel.ctmlib.CTM;
public class Configurations {
public static Configuration config;
public static Configuration config;
public static boolean configExists;
public static boolean configExists;
public static double concreteVelocityMult;
public static boolean ghostCloud;
public static int factoryBlockAmount;
public static boolean allowMossy;
public static boolean allowSmoothStone;
public static boolean chiselRecipe;
public static boolean enableFMP;
public static boolean chiselStoneToCobbleBricks;
public static boolean chiselBackToVanillaLeaves;
public static boolean canMobsSpawnOnTheChiselBlocks;
public static double concreteVelocityMult;
public static boolean ghostCloud;
public static int factoryBlockAmount;
public static boolean allowMossy;
public static boolean allowSmoothStone;
public static boolean chiselRecipe;
public static boolean enableFMP;
public static boolean chiselStoneToCobbleBricks;
public static boolean chiselBackToVanillaLeaves;
public static boolean canMobsSpawnOnTheChiselBlocks;
public static int marbleAmount;
public static int limestoneAmount;
public static int graniteAmount;
public static int dioriteAmount;
public static int andesiteAmount;
public static int marbleAmount;
public static int limestoneAmount;
public static int graniteAmount;
public static int dioriteAmount;
public static int andesiteAmount;
public static int particlesTickrate;
public static boolean oldPillars;
public static boolean disableCTM;
public static boolean connectInsideCTM;
public static boolean blockDescriptions;
public static boolean imTooGoodForDescriptions;
public static int particlesTickrate;
public static boolean oldPillars;
public static boolean disableCTM;
public static boolean connectInsideCTM;
public static boolean blockDescriptions;
public static boolean imTooGoodForDescriptions;
public static boolean allowChiselDamage;
public static int ironChiselMaxDamage;
public static int diamondChiselMaxDamage;
public static int obsidianChiselMaxDamage;
public static int netherStarChiselMaxDamage;
public static boolean ironChiselCanLeftClick;
public static boolean ironChiselHasModes;
public static int ironChiselAttackDamage;
public static int diamondChiselAttackDamage;
public static int obsidianChiselAttackDamage;
public static int netherStarChiselAttackDamage;
public static boolean allowChiselCrossColors;
public static boolean allowChiselDamage;
public static int ironChiselMaxDamage;
public static int diamondChiselMaxDamage;
public static int obsidianChiselMaxDamage;
public static int netherStarChiselMaxDamage;
public static boolean ironChiselCanLeftClick;
public static boolean ironChiselHasModes;
public static int ironChiselAttackDamage;
public static int diamondChiselAttackDamage;
public static int obsidianChiselAttackDamage;
public static int netherStarChiselAttackDamage;
public static boolean allowChiselCrossColors;
public static boolean useRoadLineTool;
public static String getRoadLineTool;
public static int roadLineToolLevel;
public static boolean useRoadLineTool;
public static String getRoadLineTool;
public static int roadLineToolLevel;
public static int[] configColors = new int[ItemDye.field_150923_a.length];
public static int[] configColors = new int[ItemDye.field_150923_a.length];
public static boolean fullBlockConcrete;
public static boolean fullBlockConcrete;
public static Map<String, Boolean> features = new HashMap<>();
public static Map<String, Boolean> features = new HashMap<>();
public static boolean refreshConfig() {
public static boolean refreshConfig() {
String category;
String category;
/* general */
category = "general";
concreteVelocityMult = config.get(category, "concreteVelocityMult", 1.35, "The factor that concrete increases your velocity. Default is 1.35, set to 1 for no change.").getDouble();
fullBlockConcrete = config.get(category, "fullBlockConcrete", false, "Should concrete be a full block. This will also unavoidably disable speed increase if set to true.").getBoolean(false);
ghostCloud = config.get(category, "doesCloudRenderLikeGhost", true).getBoolean(true);
factoryBlockAmount = config.get(category, "amountYouGetFromFactoryBlockCrafting", 32).getInt(32);
allowMossy = config.get(category, "allowBrickToMossyInChisel", true, "If true, you can chisel stone brick to mossy stone brick.").getBoolean(true);
allowSmoothStone = config.get(category, "allowSmoothStoneToStoneBricksAndBack", true).getBoolean(true);
chiselRecipe = config.get(category, "chiselAlternateRecipe", false, "Use alternative crafting recipe for the chisel").getBoolean(false);
enableFMP = config.get(category, "enableFMP", true, "Do you want to enable FMP").getBoolean(true);
chiselStoneToCobbleBricks = config.get(category, "chiselStoneToCobbleBricks", true, "Chisel stone to cobblestone and bricks by left clicking.").getBoolean(false);
chiselBackToVanillaLeaves = config
.get(category, "chiselBackToVanillaLeaves", false, "If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.").getBoolean(false);
canMobsSpawnOnTheChiselBlocks = config.get(category, "canMobsSpawnOnTheChiselBlocks", false, "Can mobs Spawn on the Chisel Blocks").getBoolean();
/* general */
category = "general";
concreteVelocityMult = config
.get(
category,
"concreteVelocityMult",
1.35,
"The factor that concrete increases your velocity. Default is 1.35, set to 1 for no change.")
.getDouble();
fullBlockConcrete = config.get(
category,
"fullBlockConcrete",
false,
"Should concrete be a full block. This will also unavoidably disable speed increase if set to true.")
.getBoolean(false);
ghostCloud = config.get(category, "doesCloudRenderLikeGhost", true).getBoolean(true);
factoryBlockAmount = config.get(category, "amountYouGetFromFactoryBlockCrafting", 32).getInt(32);
allowMossy = config.get(
category,
"allowBrickToMossyInChisel",
true,
"If true, you can chisel stone brick to mossy stone brick.").getBoolean(true);
allowSmoothStone = config.get(category, "allowSmoothStoneToStoneBricksAndBack", true).getBoolean(true);
chiselRecipe = config
.get(category, "chiselAlternateRecipe", false, "Use alternative crafting recipe for the chisel")
.getBoolean(false);
enableFMP = config.get(category, "enableFMP", true, "Do you want to enable FMP").getBoolean(true);
chiselStoneToCobbleBricks = config.get(
category,
"chiselStoneToCobbleBricks",
true,
"Chisel stone to cobblestone and bricks by left clicking.").getBoolean(false);
chiselBackToVanillaLeaves = config.get(
category,
"chiselBackToVanillaLeaves",
false,
"If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.")
.getBoolean(false);
canMobsSpawnOnTheChiselBlocks = config
.get(category, "canMobsSpawnOnTheChiselBlocks", false, "Can mobs Spawn on the Chisel Blocks")
.getBoolean();
/* worldgen */
category = "worldgen";
marbleAmount = config.get(category, "marbleAmount", 7, "Amount of marble to generate in the world; use 0 for none").getInt(7);
limestoneAmount = config.get(category, "limestoneAmount", 8, "Amount of limestone to generate in the world; use 0 for none").getInt(8);
graniteAmount = config.get(category, "graniteAmount", 8, "Amount of granite to generate in the world; use 0 for none.").getInt(8);
dioriteAmount = config.get(category, "dioriteAmount", 8, "Amount of diorite to generate in the world; use 0 for none.").getInt(8);
andesiteAmount = config.get(category, "andesiteAmount", 8, "Amount of andesite to generate in the world; use 0 for none.").getInt(8);
/* worldgen */
category = "worldgen";
marbleAmount = config
.get(category, "marbleAmount", 7, "Amount of marble to generate in the world; use 0 for none")
.getInt(7);
limestoneAmount = config
.get(category, "limestoneAmount", 8, "Amount of limestone to generate in the world; use 0 for none")
.getInt(8);
graniteAmount = config
.get(category, "graniteAmount", 8, "Amount of granite to generate in the world; use 0 for none.")
.getInt(8);
dioriteAmount = config
.get(category, "dioriteAmount", 8, "Amount of diorite to generate in the world; use 0 for none.")
.getInt(8);
andesiteAmount = config
.get(category, "andesiteAmount", 8, "Amount of andesite to generate in the world; use 0 for none.")
.getInt(8);
/* client */
category = "client";
particlesTickrate = config.get(category, "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1);
oldPillars = config.get(category, "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false);
disableCTM = !config.get(category, "connectedTextures", true, "Enable connected textures").getBoolean(true);
CTM.disableObscuredFaceCheckConfig = connectInsideCTM = config.get(category, "connectInsideCTM", false,
"Choose whether the inside corner is disconnected on a CTM block - http://imgur.com/eUywLZ4").getBoolean(false);
blockDescriptions = config.get(category, "tooltipsUseBlockDescriptions", true, "Make variations of blocks have the same name, and use the description in tooltip to distinguish them.")
.getBoolean(true);
imTooGoodForDescriptions = config.get(category, "imTooGoodForBlockDescriptions", false, "For those people who just hate block descriptions on the world gen!").getBoolean();
/* client */
category = "client";
particlesTickrate = config
.get(category, "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1);
oldPillars = config.get(category, "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false);
disableCTM = !config.get(category, "connectedTextures", true, "Enable connected textures").getBoolean(true);
CTM.disableObscuredFaceCheckConfig = connectInsideCTM = config
.get(
category,
"connectInsideCTM",
false,
"Choose whether the inside corner is disconnected on a CTM block - http://imgur.com/eUywLZ4")
.getBoolean(false);
blockDescriptions = config.get(
category,
"tooltipsUseBlockDescriptions",
true,
"Make variations of blocks have the same name, and use the description in tooltip to distinguish them.")
.getBoolean(true);
imTooGoodForDescriptions = config.get(
category,
"imTooGoodForBlockDescriptions",
false,
"For those people who just hate block descriptions on the world gen!").getBoolean();
/* chisel */
category = "chisel";
allowChiselDamage = config.get(category, "allowChiselDamage", true, "Should the chisel be damageable and take damage when it chisels something.").getBoolean();
ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel.");
diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel.");
obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel.");
netherStarChiselMaxDamage = config.getInt("netherStarChiselMaxDamage", category, 32767, 1, Short.MAX_VALUE, "The max damage of the nether star chisel.");
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean();
allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean();
/* chisel */
category = "chisel";
allowChiselDamage = config.get(
category,
"allowChiselDamage",
true,
"Should the chisel be damageable and take damage when it chisels something.").getBoolean();
ironChiselMaxDamage = config.getInt(
"ironChiselMaxDamage",
category,
500,
1,
Short.MAX_VALUE,
"The max damage of the standard iron chisel.");
diamondChiselMaxDamage = config.getInt(
"diamondChiselMaxDamage",
category,
5000,
1,
Short.MAX_VALUE,
"The max damage of the diamond chisel.");
obsidianChiselMaxDamage = config.getInt(
"obsidianChiselMaxDamage",
category,
2500,
1,
Short.MAX_VALUE,
"The max damage of the obsidian chisel.");
netherStarChiselMaxDamage = config.getInt(
"netherStarChiselMaxDamage",
category,
32767,
1,
Short.MAX_VALUE,
"The max damage of the nether star chisel.");
ironChiselCanLeftClick = config
.get(
category,
"ironChiselCanLeftClick",
true,
"If this is true, the iron chisel can left click chisel blocks. If false, it cannot.")
.getBoolean();
ironChiselHasModes = config
.get(
category,
"ironChiselHasModes",
false,
"If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.")
.getBoolean();
allowChiselCrossColors = config.get(
category,
"allowChiselCrossColors",
true,
"Should someone be able to chisel something into a different color.").getBoolean();
ironChiselAttackDamage = config
.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.").getInt();
diamondChiselAttackDamage = config.get(category, "diamondChiselAttackDamage", 2,
"The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
obsidianChiselAttackDamage = config.get(category, "obsidianChiselAttackDamage", 4,
"The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt();
netherStarChiselAttackDamage = config.get(category, "netherStarChiselAttackDamage", 6,
"The extra attack damage points (in half hearts) that the nether star chisel inflicts when it is used to attack an entity.").getInt();
ironChiselAttackDamage = config.get(
category,
"ironChiselAttackDamage",
2,
"The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.")
.getInt();
diamondChiselAttackDamage = config.get(
category,
"diamondChiselAttackDamage",
2,
"The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.")
.getInt();
obsidianChiselAttackDamage = config.get(
category,
"obsidianChiselAttackDamage",
4,
"The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.")
.getInt();
netherStarChiselAttackDamage = config.get(
category,
"netherStarChiselAttackDamage",
6,
"The extra attack damage points (in half hearts) that the nether star chisel inflicts when it is used to attack an entity.")
.getInt();
/* block */
category = "block";
useRoadLineTool = config.get(category, "useRoadLineTool", false, "Should the road line require a tool to break (If false, road lines can be broken in Adventure)").getBoolean();
getRoadLineTool = config.get(category, "getRoadLineTool", "pickaxe", "The tool that is able to break roadLines (requires useRoadLineTool to be true to take effect)").getString();
roadLineToolLevel = config.get(category, "roadLineToolLevel", 0,
"The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0")
.getInt();
/* block */
category = "block";
useRoadLineTool = config.get(
category,
"useRoadLineTool",
false,
"Should the road line require a tool to break (If false, road lines can be broken in Adventure)")
.getBoolean();
getRoadLineTool = config
.get(
category,
"getRoadLineTool",
"pickaxe",
"The tool that is able to break roadLines (requires useRoadLineTool to be true to take effect)")
.getString();
roadLineToolLevel = config.get(
category,
"roadLineToolLevel",
0,
"The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0")
.getInt();
/* hexColors */
category = "hexColors";
/* hexColors */
category = "hexColors";
for (int i = 0; i < ItemDye.field_150923_a.length; i++) {
// tterrag... don't kill me over this formatting.
String temp = config.get(category, "hex" + ItemDye.field_150923_a[i], "#" + Integer.toHexString(ItemDye.field_150922_c[i]),
Character.toUpperCase(ItemDye.field_150923_a[i].charAt(0)) + ItemDye.field_150923_a[i].substring(1) + " color for hex block overlay #RRGGBB").getString();
// Or this
try {
configColors[i] = Integer.decode(temp);
} catch (NumberFormatException e) {
Chisel.logger.warn("Configuration error, " + temp + " was not recognized as a color. Using default: #" + Integer.toHexString(ItemDye.field_150922_c[i]));
configColors[i] = ItemDye.field_150922_c[i];
}
}
for (int i = 0; i < ItemDye.field_150923_a.length; i++) {
// tterrag... don't kill me over this formatting.
String temp = config.get(
category,
"hex" + ItemDye.field_150923_a[i],
"#" + Integer.toHexString(ItemDye.field_150922_c[i]),
Character.toUpperCase(ItemDye.field_150923_a[i].charAt(0)) + ItemDye.field_150923_a[i].substring(1)
+ " color for hex block overlay #RRGGBB")
.getString();
// Or this
try {
configColors[i] = Integer.decode(temp);
} catch (NumberFormatException e) {
Chisel.logger.warn(
"Configuration error, " + temp
+ " was not recognized as a color. Using default: #"
+ Integer.toHexString(ItemDye.field_150922_c[i]));
configColors[i] = ItemDye.field_150922_c[i];
}
}
/* features */
for (Features feature : Features.values()) {
features.put(featureName(feature), config.get("features", featureName(feature), true).getBoolean(true));
}
/* features */
for (Features feature : Features.values()) {
features.put(featureName(feature), config.get("features", featureName(feature), true).getBoolean(true));
}
if (config.hasChanged()) {
config.save();
}
return true;
}
if (config.hasChanged()) {
config.save();
}
return true;
}
public static boolean featureEnabled(Features feature) {
return features.getOrDefault(featureName(feature), false);
}
public static boolean featureEnabled(Features feature) {
return features.getOrDefault(featureName(feature), false);
}
/**
* Makes the old camelCase names from the new CONSTANT_CASE names
*/
public static String featureName(Features feature) {
String[] words = feature.name().toLowerCase(Locale.ENGLISH).split("_");
if (words.length == 1) {
return words[0];
}
/**
* Makes the old camelCase names from the new CONSTANT_CASE names
*/
public static String featureName(Features feature) {
String[] words = feature.name().toLowerCase(Locale.ENGLISH).split("_");
if (words.length == 1) {
return words[0];
}
String ret = words[0];
for (int i = 1; i < words.length; i++) {
ret += StringUtils.capitalize(words[i]);
}
return ret;
}
String ret = words[0];
for (int i = 1; i < words.length; i++) {
ret += StringUtils.capitalize(words[i]);
}
return ret;
}
@Deprecated
public static boolean featureEnabled(String feature) {
return false;
}
@Deprecated
public static boolean featureEnabled(String feature) {
return false;
}
}
@@ -2,61 +2,58 @@ package team.chisel.item;
import java.util.List;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
import net.minecraft.util.StatCollector;
import team.chisel.config.Configurations;
import team.chisel.utils.General;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import team.chisel.config.Configurations;
import team.chisel.utils.General;
import com.cricketcraft.chisel.api.ICarvable;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
public class ItemCarvable extends ItemBlock {
public ItemCarvable(Block block) {
super(block);
setMaxDamage(0);
setHasSubtypes(true);
}
public ItemCarvable(Block block) {
super(block);
setMaxDamage(0);
setHasSubtypes(true);
}
private static final boolean canMobsSpawnOnTheChiselBlocks = Configurations.canMobsSpawnOnTheChiselBlocks;
@Override
public int getMetadata(int i) {
return i;
}
@Override
public int getMetadata(int i) {
return i;
}
@Override
public IIcon getIconFromDamage(int damage) {
return Block.getBlockFromItem(this).getIcon(2, damage);
}
@Override
public IIcon getIconFromDamage(int damage) {
return Block.getBlockFromItem(this).getIcon(2, damage);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) {
if (!Configurations.blockDescriptions)
return;
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) {
if (!Configurations.blockDescriptions) return;
Item item = General.getItem(stack);
if (item == null)
return;
Item item = General.getItem(stack);
if (item == null) return;
Block block = Block.getBlockFromItem(this);
if (!(block instanceof ICarvable))
return;
Block block = Block.getBlockFromItem(this);
if (!(block instanceof ICarvable)) return;
ICarvable carvable = (ICarvable) block;
IVariationInfo var = carvable.getManager(stack.getItemDamage());
if (var == null)
return;
ICarvable carvable = (ICarvable) block;
IVariationInfo var = carvable.getManager(stack.getItemDamage());
if (var == null) return;
lines.add(var.getDescription());
lines.add(var.getDescription());
if (!canMobsSpawnOnTheChiselBlocks)
lines.add(StatCollector.translateToLocal("item.chisel.nomobspawnsonthisblock.desc"));
}
}
}