NoCheatPlus/NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/blocks/init/vanilla/BlocksMC1_5.java

119 lines
4.7 KiB
Java
Raw Normal View History

/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
import org.bukkit.Material;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
2014-11-17 11:25:51 +01:00
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
/**
* This is an attempt to add Minecraft 1.5 blocks information without actual 1.5 dependency.
* @author mc_dev
*
*/
public class BlocksMC1_5 implements BlockPropertiesSetup {
2015-01-05 14:45:17 +01:00
public BlocksMC1_5(){
// Test if materials exist.
2017-12-06 06:37:51 +01:00
BlockInit.assertMaterialExists("REDSTONE_BLOCK");
2015-01-05 14:45:17 +01:00
}
@Override
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
/////////////////////
// New blocks
////////////////////
// 146 Trapped Chest
2017-12-06 06:37:51 +01:00
BlockInit.setAs("TRAPPED_CHEST", Material.CHEST);
2015-01-05 14:45:17 +01:00
// 147 Weighted Pressure Plate (Light)
// BlockFlags.addFlags(147, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(BridgeMaterial.LIGHT_WEIGHTED_PRESSURE_PLATE,
BridgeMaterial.STONE_PRESSURE_PLATE);
2015-01-05 14:45:17 +01:00
// 148 Weighted Pressure Plate (Heavy)
// BlockFlags.addFlags(148, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs(BridgeMaterial.HEAVY_WEIGHTED_PRESSURE_PLATE,
BridgeMaterial.STONE_PRESSURE_PLATE);
2015-01-05 14:45:17 +01:00
// HACK 1.13
Material comparator = BridgeMaterial.get("comparator");
if (comparator == null) {
// LEGACY
2015-01-05 14:45:17 +01:00
// 149 Redstone Comparator (inactive)
// BlockFlags.addFlags(149, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs("REDSTONE_COMPARATOR_OFF", "DIODE_BLOCK_OFF");
// 150 Redstone Comparator (active)
// BlockFlags.addFlags(150, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs("REDSTONE_COMPARATOR_ON", "DIODE_BLOCK_ON");
}
else {
// 1.13
BlockInit.setAs("COMPARATOR", BridgeMaterial.REPEATER);
}
2015-01-05 14:45:17 +01:00
// 151 Daylight Sensor
// BlockFlags.addFlags(151, BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockInit.setAs("DAYLIGHT_DETECTOR", Material.VINE);
2015-01-05 14:45:17 +01:00
// 152 Block of Redstone
BlockInit.setAs("REDSTONE_BLOCK", BridgeMaterial.ENCHANTING_TABLE);
2015-01-05 14:45:17 +01:00
// 153 Nether Quartz Ore
BlockInit.setAs(BridgeMaterial.NETHER_QUARTZ_ORE, Material.COAL_ORE);
2015-01-05 14:45:17 +01:00
// 154 Hopper
2017-12-06 06:37:51 +01:00
BlockInit.setAs("HOPPER", Material.COAL_ORE);
2015-01-05 14:45:17 +01:00
// TODO: Needs workaround. [workaround-flag + different purpose flag sets ?]
2017-12-06 06:37:51 +01:00
BlockFlags.addFlags("HOPPER", BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT);
2015-01-05 14:45:17 +01:00
// 155 Block of Quartz
2017-12-06 06:37:51 +01:00
BlockInit.setAs("QUARTZ_BLOCK", Material.SANDSTONE);
2015-01-05 14:45:17 +01:00
// 156 Quartz Stairs
2017-12-06 06:37:51 +01:00
BlockInit.setAs("QUARTZ_STAIRS", Material.SANDSTONE_STAIRS);
2015-01-05 14:45:17 +01:00
// 157 Activator Rail
2017-12-06 06:37:51 +01:00
BlockInit.setAs("ACTIVATOR_RAIL", Material.DETECTOR_RAIL);
2015-01-05 14:45:17 +01:00
// 158 Dropper
// BlockFlags.setFlagsAs(158, Material.DISPENSER);
2017-12-06 06:37:51 +01:00
BlockInit.setAs("DROPPER", Material.DISPENSER);
2015-01-05 14:45:17 +01:00
/////////////////////
// Changed blocks
////////////////////
// 78 Snow
2017-12-06 06:37:51 +01:00
BlockFlags.addFlags("SNOW", BlockProperties.F_HEIGHT_8_INC);
BlockFlags.removeFlags("SNOW", BlockProperties.F_HEIGHT_8SIM_INC);
2015-01-05 14:45:17 +01:00
2015-11-15 02:15:20 +01:00
StaticLog.logInfo("Added block-info for Minecraft 1.5 blocks.");
2015-01-05 14:45:17 +01:00
}
}