use of com.oitsjustjose.geolosys.blocks.BlockOreVanilla in project Geolosys by oitsjustjose.
the class ItemProPick method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote) {
player.swingArm(hand);
return EnumActionResult.PASS;
}
int xStart;
int xEnd;
int yStart;
int yEnd;
int zStart;
int zEnd;
int confAmt = Config.getInstance().proPickRange;
boolean found = false;
switch(facing) {
case UP:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = -confAmt;
yEnd = 0;
zStart = -(confAmt / 2);
zEnd = (confAmt / 2);
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case DOWN:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = 0;
yEnd = confAmt;
zStart = -(confAmt / 2);
zEnd = confAmt / 2;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case NORTH:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = 0;
zEnd = confAmt;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case SOUTH:
xStart = -(confAmt / 2);
xEnd = confAmt / 2;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = -confAmt;
zEnd = 0;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case EAST:
xStart = -(confAmt);
xEnd = 0;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = -(confAmt / 2);
zEnd = confAmt / 2;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
case WEST:
xStart = 0;
xEnd = confAmt;
yStart = -(confAmt / 2);
yEnd = confAmt / 2;
zStart = -(confAmt / 2);
zEnd = confAmt / 2;
for (int x = xStart; x <= xEnd; x++) {
for (int y = yStart; y <= yEnd; y++) {
for (int z = zStart; z <= zEnd; z++) {
IBlockState state = worldIn.getBlockState(pos.add(x, y, z));
if (state.getBlock() instanceof BlockOre || state.getBlock() instanceof BlockOreVanilla || Geolosys.getInstance().userStates.contains(state)) {
foundMessage(player, state, facing);
found = true;
break;
}
}
}
}
break;
}
if (!found) {
player.sendStatusMessage(new TextComponentString("No deposits found"), true);
}
player.swingArm(hand);
return EnumActionResult.SUCCESS;
}
use of com.oitsjustjose.geolosys.blocks.BlockOreVanilla in project Geolosys by oitsjustjose.
the class Geolosys method preInit.
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
LOGGER = event.getModLog();
MinecraftForge.EVENT_BUS.register(new Config(event.getSuggestedConfigurationFile()));
configOres = getOresConfig(event.getModConfigurationDirectory());
clientRegistry = new ClientRegistry();
MinecraftForge.EVENT_BUS.register(clientRegistry);
chunkOreGen = new ChunkData();
userStates = new ArrayList<>();
ORE = new BlockOre();
ORE_VANILLA = new BlockOreVanilla();
ORE_SAMPLE = new BlockSample();
ORE_SAMPLE_VANILLA = new BlockSampleVanilla();
CLUSTER = new ItemCluster();
ALMANAC = new ItemFieldManual();
if (Config.getInstance().enableIngots) {
INGOT = new ItemIngot();
}
if (Config.getInstance().enableCoals) {
COAL = new ItemCoal();
}
if (Config.getInstance().enableProPick) {
PRO_PICK = new ItemProPick();
}
registerGeolosysOreGen();
registerVanillaOreGen();
}
Aggregations