Work on fixing cover dectection
This commit is contained in:
parent
60141026ec
commit
0270a917a0
6 changed files with 45 additions and 6 deletions
|
@ -27,4 +27,6 @@ public interface IPartProvider {
|
|||
ModPart modPart);
|
||||
|
||||
public boolean isTileFromProvider(TileEntity tileEntity);
|
||||
|
||||
public IModPart getPartFromWorld(World world, Location location, String name);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package techreborn.partSystem;
|
||||
|
||||
import me.modmuss50.mods.lib.mod.IMod;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
|
@ -25,8 +26,7 @@ public class ModPartUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkOcclusion(World world, int x, int y, int z,
|
||||
Vecs3dCube cube) {
|
||||
public static boolean checkOcclusion(World world, int x, int y, int z, Vecs3dCube cube) {
|
||||
return !checkOcclusion(world, new Location(x, y, z), cube);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,15 @@ public class ModPartUtils {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IModPart getPartFromWorld(World world, Location location, String name){
|
||||
for (IPartProvider partProvider : ModPartRegistry.providers) {
|
||||
IModPart tempPart = null;
|
||||
tempPart = partProvider.getPartFromWorld(world, location, name);
|
||||
if(tempPart != null){
|
||||
return tempPart;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import techreborn.partSystem.ModPartRegistry;
|
||||
|
@ -79,7 +80,18 @@ public class QModPartFactory implements IPartFactory, IPartProvider {
|
|||
return tileEntity instanceof TileMultipart;
|
||||
}
|
||||
|
||||
public String getCreatedPartType(ItemStack item, EntityPlayer player,
|
||||
@Override
|
||||
public IModPart getPartFromWorld(World world, Location location, String name) {
|
||||
IPart part = MultipartCompatibility.getPart(world, location.getX(), location.getY(), location.getZ(), name);
|
||||
if(part != null){
|
||||
if(part instanceof QModPart){
|
||||
return ((QModPart) part).iModPart;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getCreatedPartType(ItemStack item, EntityPlayer player,
|
||||
World world, MovingObjectPosition mop, ModPart modPart) {
|
||||
return modPart.getName();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
|
@ -116,4 +117,10 @@ public class WorldProvider implements IPartProvider {
|
|||
public boolean isTileFromProvider(TileEntity tileEntity) {
|
||||
return tileEntity instanceof TileEntityModPart;
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Override
|
||||
public IModPart getPartFromWorld(World world, Location location, String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import techreborn.partSystem.ModPartRegistry;
|
||||
|
@ -65,7 +66,13 @@ public class FMPFactory implements MultiPartRegistry.IPartFactory,
|
|||
return tileEntity instanceof TileMultipart;
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO
|
||||
@Override
|
||||
public IModPart getPartFromWorld(World world, Location location, String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modID() {
|
||||
return "ForgeMultipart";
|
||||
}
|
||||
|
|
|
@ -528,12 +528,12 @@ public class CablePart extends ModPart implements IEnergyConductor {
|
|||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity tileEntity,
|
||||
ForgeDirection forgeDirection) {
|
||||
return true;
|
||||
return connectedSides.containsKey(forgeDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emitsEnergyTo(TileEntity tileEntity,
|
||||
ForgeDirection forgeDirection) {
|
||||
return true;
|
||||
return connectedSides.containsKey(forgeDirection);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue