Lasers respect FTB Claims
This commit is contained in:
parent
ef6c5c7a57
commit
8e7d051e76
|
@ -131,6 +131,10 @@ repositories {
|
|||
name = "ic2"
|
||||
url = "http://maven.ic2.player.to/"
|
||||
}
|
||||
maven {
|
||||
name = "curse"
|
||||
url = "https://www.cursemaven.com/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -145,4 +149,5 @@ dependencies {
|
|||
compile "codechicken:NotEnoughItems:${config.version.minecraft}-${config.version.nei}:dev"
|
||||
compile "mcp.mobius.waila:Waila:1.5.8_dev3_1.7.10"
|
||||
compile "net.industrial-craft:industrialcraft-2:2.2.654-experimental:dev"
|
||||
compile "curse.maven:ftbu-237102:2291494"
|
||||
}
|
||||
|
|
|
@ -3,8 +3,9 @@ package edx.core
|
|||
import cpw.mods.fml.common.Mod.EventHandler
|
||||
import cpw.mods.fml.common.event.{FMLInitializationEvent, FMLPostInitializationEvent, FMLPreInitializationEvent}
|
||||
import cpw.mods.fml.common.network.NetworkRegistry
|
||||
import cpw.mods.fml.common.{Mod, SidedProxy}
|
||||
import cpw.mods.fml.common.{Loader, Mod, SidedProxy}
|
||||
import edx.basic.BasicContent
|
||||
import edx.core.ftbcompat.{FTBCompatOff, FTBCompatOn, IFTBCompat}
|
||||
import edx.core.handler.TextureHookHandler
|
||||
import edx.core.resource.AutoResourceFactory
|
||||
import edx.electrical.ElectricalContent
|
||||
|
@ -32,6 +33,7 @@ object Electrodynamics
|
|||
/** Packets */
|
||||
val packetHandler = ResonantEngine.packetHandler
|
||||
val loadables = new LoadableHandler
|
||||
var ftbcompat: IFTBCompat = new FTBCompatOff
|
||||
|
||||
@SidedProxy(clientSide = "edx.core.ClientProxy", serverSide = "edx.core.CommonProxy")
|
||||
var proxy: CommonProxy = _
|
||||
|
@ -62,6 +64,9 @@ object Electrodynamics
|
|||
@EventHandler
|
||||
def init(evt: FMLInitializationEvent)
|
||||
{
|
||||
if (Loader.isModLoaded("FTBU")) {
|
||||
ftbcompat = new FTBCompatOn
|
||||
}
|
||||
ResonantPartFactory.init()
|
||||
AutoResourceFactory.init()
|
||||
loadables.init()
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package edx.core.ftbcompat;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FTBCompatOff implements IFTBCompat {
|
||||
@Override
|
||||
public boolean canDestroyBlock(Vec3 blockpos, Vec3 laserpos, World world) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package edx.core.ftbcompat;
|
||||
|
||||
import ftb.utils.world.LMWorldServer;
|
||||
import ftb.utils.world.claims.ClaimedChunk;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FTBCompatOn implements IFTBCompat {
|
||||
@Override
|
||||
public boolean canDestroyBlock(Vec3 blockpos, Vec3 laserpos, World world) {
|
||||
int bcx = ((int) blockpos.xCoord) >> 4;
|
||||
int bcz = ((int) blockpos.zCoord) >> 4;
|
||||
int lcx = ((int) laserpos.xCoord) >> 4;
|
||||
int lcz = ((int) laserpos.zCoord) >> 4;
|
||||
|
||||
ClaimedChunk bchunk = LMWorldServer.inst.claimedChunks.getChunk(world.provider.dimensionId, bcx, bcz);
|
||||
ClaimedChunk lchunk = LMWorldServer.inst.claimedChunks.getChunk(world.provider.dimensionId, lcx, lcz);
|
||||
|
||||
if (bchunk == null) {
|
||||
return true;
|
||||
} else if (lchunk == null) {
|
||||
return false;
|
||||
} else {
|
||||
return bchunk.ownerID == lchunk.ownerID;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package edx.core.ftbcompat;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFTBCompat {
|
||||
|
||||
boolean canDestroyBlock(Vec3 blockpos, Vec3 laserpos, World world);
|
||||
|
||||
}
|
|
@ -88,7 +88,7 @@ object Laser
|
|||
/**
|
||||
* Attempt to burn block
|
||||
*/
|
||||
if (!world.isRemote)
|
||||
if (!world.isRemote && Electrodynamics.ftbcompat.canDestroyBlock(hitBlockPos.toVec3, start.toVec3, world))
|
||||
{
|
||||
val hardness = hitBlock.getBlockHardness(world, hitBlockPos.x.toInt, hitBlockPos.y.toInt, hitBlockPos.z.toInt)
|
||||
|
||||
|
|
Loading…
Reference in New Issue