I just want to take the time to thank you for the constant support and attention you've given this mod, I use it religiously now. I guess my only questions would be:
1. has the mod been made open source?
2. if it is open source where? GitHub?
3. if we had access to an open source version how would it get compiled, this may be easy or I'm just stupid.
sadly no there is still the startVec.conv() error and endVec.conv() error, i tried to fix this but i had no success. this is the only problem left it seems though
doing this fixed Vec3G however it broke both MultiColisionProvider and MultiColisionProviderRayTracer's startVec.conv() and endVec.conv() functions.
as for the union problem changing it out for the function with the UtilG broke that. the UtilG seems to have some problems. The new AxisAlignedBB union function doesn't have visible constructors making all of the Math.min and Math.max functions broken.
super.addCollisionBoxesToList( world, x, y, z, mask, list, collidingEntity);
}
}
and I'm still not quite understanding how to fix the:
public Vec3 conv(){
return new Vec3(getX(), getY(), getZ());
}
other than that all other errors seem to be cleared up, i got ride of all println functions because every one had an error and i figured i didn't really need any out put from that.
public abstract class BlockContainerMultiColision extends BlockContainer{
protected BlockContainerMultiColision(Material material){
super(material);
if(!(createNewTileEntity(null, 0) instanceof MultiColisionProvider))throw new IllegalStateException("BlockContainerMultiColision has to be provided with a TileEntity that implements MultiColisionProvider class!");
}
@Override
public int getRenderType(){return 80;}
@Override
public boolean isOpaqueCube(){return false;}
public boolean isFullCube(){
return false;
}
@Override
public MovingObjectPosition collisionRayTrace(World w, int x, int y, int z, Vec3 startVec, Vec3 endVec){
if(!MultiColisionProviderRayTracer.isRayTracing){
int id=MultiColisionProviderRayTracer.getRayTracedBoxId(w, x, y, z, Vec3M.conv(startVec), Vec3M.conv(endVec), getResetBoundsOptionalFix(w, x, y, z));
return MultiColisionProviderRayTracer.results[id];
}else return super.collisionRayTrace(w, x, y, z, startVec, endVec);
}
public abstract AxisAlignedBB getResetBoundsOptional(World world, int x, int y, int z);
private AxisAlignedBB getResetBoundsOptionalFix(World world, int x, int y, int z){
AxisAlignedBB result=getResetBoundsOptional(world, x, y, z);
if(result==null)return null;
result=result.union(new AxisAlignedBB(0, 0, 0, 1, 1, 1));
return result;
}
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){
AxisAlignedBB[] a=((MultiColisionProvider)world.getTileEntity(x, y, z)).getActiveBoxes();
for(int i=0;i<a.length;i++){
this.setBlockBounds((float)a.minX,(float)a.minY,(float)a.minZ,(float)a.maxX,(float)a.maxY,(float)a.maxZ);
super.addCollisionBoxesToList(world, x, y, z, state, mask, list, collidingEntity);
}
}
public void getBoxesOnSide(List<AxisAlignedBB> result,int side);
public void getExpectedBoxesOnSide(List<AxisAlignedBB> result,int side);
public AxisAlignedBB getMainBox();
public void setColisionBoxes();
public AxisAlignedBB[] getExpectedColisionBoxes();
public void setPointedBox(AxisAlignedBB box);
public AxisAlignedBB getPointedBox();
public void setPrevPointedBox(AxisAlignedBB box);
public AxisAlignedBB getPrevPointedBox();
public void detectAndSendChanges();
public AxisAlignedBB[] getActiveBoxes();
public AxisAlignedBB[] getBoxes();
public class MultiColisionProviderRayTracer{
private MultiColisionProviderRayTracer(){}
public static boolean isRayTracing=false;
public static MovingObjectPosition[] results={};
public static AxisAlignedBB[] selectedBoxes={};
public static int getRayTracedBoxId(World world, int x, int y, int z, Vec3G startVec, Vec3G endVec,AxisAlignedBB resetBoundsOptional){
TileEntity tester=world.getTileEntity(x, y, z);
if(!(tester instanceof MultiColisionProvider)){
UtilG.println("There is no instance of ISidedColisionProvider at"+"("+ x + "," + y + "," + z + ")!",UtilG.getStackTrace());
return -1;
}
results=new MovingObjectPosition[0];
selectedBoxes=new AxisAlignedBB[0];
isRayTracing=true;
//start
MultiColisionProvider tile=(MultiColisionProvider)tester;
Block block=world.getBlock(x, y, z);
AxisAlignedBB[] aciveBoxes=tile.getActiveBoxes();
if(aciveBoxes==null||aciveBoxes.length==0){
//fail switch
UtilG.println("ISidedColisionProviderRayTracer could not resolve a valid box!",UtilG.getStackTrace());
isRayTracing=false;
return -1;
}
for(int i=0;i<aciveBoxes.length;i++){
block.setBlockBounds((float)aciveBoxes.minX,(float)aciveBoxes.minY,(float)aciveBoxes.minZ,(float)aciveBoxes.maxX,(float)aciveBoxes.maxY,(float)aciveBoxes.maxZ);
results=ArrayUtils.add(results, block.collisionRayTrace(world, x, y, z, startVec.conv(), endVec.conv()));
selectedBoxes=ArrayUtils.add(selectedBoxes,aciveBoxes);
}
if(results.length==0){
if(resetBoundsOptional!=null)block.setBlockBounds((float)resetBoundsOptional.minX,(float)resetBoundsOptional.minY,(float)resetBoundsOptional.minZ,(float)resetBoundsOptional.maxX,(float)resetBoundsOptional.maxY,(float)resetBoundsOptional.maxZ);
tile.setPointedBox(null);
isRayTracing=false;
return -1;
}
double smallest=10000;
int id=0;
if(results.length>0){
for(int id1=0;id1<results.length;id1++){
MovingObjectPosition result1=results[id1];
if(result1!=null&&result1.hitVec!=null){
double distance=startVec.conv().distanceTo(result1.hitVec);
if(distance<smallest){
smallest=distance;
id=id1;
}
}
}
}
if(resetBoundsOptional!=null)block.setBlockBounds((float)resetBoundsOptional.minX,(float)resetBoundsOptional.minY,(float)resetBoundsOptional.minZ,(float)resetBoundsOptional.maxX,(float)resetBoundsOptional.maxY,(float)resetBoundsOptional.maxZ);
else if(selectedBoxes.length>0)block.setBlockBounds((float)selectedBoxes[id].minX,(float)selectedBoxes[id].minY,(float)selectedBoxes[id].minZ,(float)selectedBoxes[id].maxX,(float)selectedBoxes[id].maxY,(float)selectedBoxes[id].maxZ);
try{
tile.setPointedBox(selectedBoxes[id]);
}catch(Exception e){
UtilG.println("Error: max value without crash",selectedBoxes.length-1," and the used value is",id);
UtilG.println("selectedBoxes size",selectedBoxes.length,"results size",results.length);
e.printStackTrace();
}
isRayTracing=false;
return id;
}
public static int getPointedId(MultiColisionProvider provider){
if(provider.getPointedBox()!=null){
AxisAlignedBB box1=provider.getPointedBox();
AxisAlignedBB[] boxes=provider.getBoxes();
for(int i=0;i<boxes.length;i++){
AxisAlignedBB box2=provider.getBoxes();
if(UtilG.AxisAlignedBBEqual(box1, box2)){
return i;
}
}
}
return -1;
}
} }
I've sat here for 3 hours trying to get all of the classes to work and have as little errors as possible, but its just too much. Is there any way to make a simple rayTracing function that can create a hit box around a defined area for every pipe dependent on the output of my checkForNeighbors? I appreciate your effort but I'm really struggling to get your code working with mine.
Any suggestions on how I could create a ray tracing function?
-- or is there a way to trick minecraft into thinking that there are multiple tileentities/blocks in that one block to create more hit boxes?
0
I just want to take the time to thank you for the constant support and attention you've given this mod, I use it religiously now. I guess my only questions would be:
1. has the mod been made open source?
2. if it is open source where? GitHub?
3. if we had access to an open source version how would it get compiled, this may be easy or I'm just stupid.
0
Is there a function that will be called that i can put in a block class that will be called when the world is first loaded?
thanks!
0
no error however it doesn't have any indication that its working at all
0
sadly no there is still the startVec.conv() error and endVec.conv() error, i tried to fix this but i had no success. this is the only problem left it seems though
0
Thanks, and yeah know I really do have to learn java.
0
ok cool that works but the UtilG is still messed up it cannot be resolved or is not a field.
public abstract AxisAlignedBB getResetBoundsOptional(World world, int x, int y, int z);
private AxisAlignedBB getResetBoundsOptionalFix(World world, intx, inty, intz){
AxisAlignedBB result=getResetBoundsOptional(world, x, y, z);
if(result==null)returnnull;
result=result.UtilM.union(result, AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1));
returnresult;
}
and all startVec.conv and ended.conv have errors saying
The method conv(Vec3) in the type Vec3G is not applicable for the arguments ()
and there are two conv functions in the Vec3G
public static Vec3G conv(Vec3 look){
returnnew Vec3G(look.xCoord,look.yCoord,look.zCoord);
}
publicstatic Vec3 conv(double p_72443_0_, double p_72443_2_, double p_72443_4_)
{
return Vec3.createVectorHelper(p_72443_0_, p_72443_2_, p_72443_4_);
}
0
doing this fixed Vec3G however it broke both MultiColisionProvider and MultiColisionProviderRayTracer's startVec.conv() and endVec.conv() functions.
as for the union problem changing it out for the function with the UtilG broke that. the UtilG seems to have some problems. The new AxisAlignedBB union function doesn't have visible constructors making all of the Math.min and Math.max functions broken.
0
fixed: IBlockState - deleted
fixed: addCollisionBoxesToList - removed super. in the front of it (the parameters seemed to be correct)
don't understand how to fix the union (error shown above)
changed the Vec3 problem to:
public static Vec3 createVectorHelper(double p_72443_0_, double p_72443_2_, double p_72443_4_)
{
return new Vec3(p_72443_0_, p_72443_2_, p_72443_4_);
}
however the error still is under
new Vec3(p_72443_0_, p_72443_2_, p_72443_4_);
0
There are very few errors now,
in BlockContainerMultiColision there are three:
public abstract AxisAlignedBB getResetBoundsOptional(World world, int x, int y, int z);
private AxisAlignedBB getResetBoundsOptionalFix(World world, intx, inty, intz){
AxisAlignedBB result=getResetBoundsOptional(world, x, y, z);
if(result==null)returnnull;
result=result.union(AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1));
returnresult;
}
@Override
publicvoid addCollisionBoxesToList(World world, intx, inty, intz, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){
AxisAlignedBB[] a=((MultiColisionProvider)world.getTileEntity(x, y, z)).getActiveBoxes();
for(inti=0;i<a.length;i++){
this.setBlockBounds((float)a.minX,(float)a.minY,(float)a.minZ,(float)a.maxX,(float)a.maxY,(float)a.maxZ);
super.addCollisionBoxesToList( world, x, y, z, mask, list, collidingEntity);
}
}
and I'm still not quite understanding how to fix the:
public Vec3 conv(){
return new Vec3(getX(), getY(), getZ());
}
other than that all other errors seem to be cleared up, i got ride of all println functions because every one had an error and i figured i didn't really need any out put from that.
0
if i wanted to make a banner for my mod or signature what size would it be (in pixels)? thanks!
0
for Vec3 what do i have to do to
public Vec3 conv(){
return new Vec3(getX(), getY(), getZ());
}
to get it to work?
now onto BlockContainerMultiColision class:
errors are in red
package com.gunnthorian.colision;
import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class BlockContainerMultiColision extends BlockContainer{
protected BlockContainerMultiColision(Material material){
super(material);
if(!(createNewTileEntity(null, 0) instanceof MultiColisionProvider))throw new IllegalStateException("BlockContainerMultiColision has to be provided with a TileEntity that implements MultiColisionProvider class!");
}
@Override
public int getRenderType(){return 80;}
@Override
public boolean isOpaqueCube(){return false;}
public boolean isFullCube(){
return false;
}
@Override
public MovingObjectPosition collisionRayTrace(World w, int x, int y, int z, Vec3 startVec, Vec3 endVec){
if(!MultiColisionProviderRayTracer.isRayTracing){
int id=MultiColisionProviderRayTracer.getRayTracedBoxId(w, x, y, z, Vec3M.conv(startVec), Vec3M.conv(endVec), getResetBoundsOptionalFix(w, x, y, z));
return MultiColisionProviderRayTracer.results[id];
}else return super.collisionRayTrace(w, x, y, z, startVec, endVec);
}
public abstract AxisAlignedBB getResetBoundsOptional(World world, int x, int y, int z);
private AxisAlignedBB getResetBoundsOptionalFix(World world, int x, int y, int z){
AxisAlignedBB result=getResetBoundsOptional(world, x, y, z);
if(result==null)return null;
result=result.union(new AxisAlignedBB(0, 0, 0, 1, 1, 1));
return result;
}
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){
AxisAlignedBB[] a=((MultiColisionProvider)world.getTileEntity(x, y, z)).getActiveBoxes();
for(int i=0;i<a.length;i++){
this.setBlockBounds((float)a.minX,(float)a.minY,(float)a.minZ,(float)a.maxX,(float)a.maxY,(float)a.maxZ);
super.addCollisionBoxesToList(world, x, y, z, state, mask, list, collidingEntity);
}
}
}
and finally MultiColisionProvider:
package com.gunnthorian.colision;
import java.util.*;
import net.minecraft.block.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.world.*;
import org.apache.commons.lang3.*;
public interface MultiColisionProvider{
public void getBoxesOnSide(List<AxisAlignedBB> result,int side);
public void getExpectedBoxesOnSide(List<AxisAlignedBB> result,int side);
public AxisAlignedBB getMainBox();
public void setColisionBoxes();
public AxisAlignedBB[] getExpectedColisionBoxes();
public void setPointedBox(AxisAlignedBB box);
public AxisAlignedBB getPointedBox();
public void setPrevPointedBox(AxisAlignedBB box);
public AxisAlignedBB getPrevPointedBox();
public void detectAndSendChanges();
public AxisAlignedBB[] getActiveBoxes();
public AxisAlignedBB[] getBoxes();
public class MultiColisionProviderRayTracer{
private MultiColisionProviderRayTracer(){}
public static boolean isRayTracing=false;
public static MovingObjectPosition[] results={};
public static AxisAlignedBB[] selectedBoxes={};
public static int getRayTracedBoxId(World world, int x, int y, int z, Vec3G startVec, Vec3G endVec,AxisAlignedBB resetBoundsOptional){
TileEntity tester=world.getTileEntity(x, y, z);
if(!(tester instanceof MultiColisionProvider)){
UtilG.println("There is no instance of ISidedColisionProvider at"+"("+ x + "," + y + "," + z + ")!",UtilG.getStackTrace());
return -1;
}
results=new MovingObjectPosition[0];
selectedBoxes=new AxisAlignedBB[0];
isRayTracing=true;
//start
MultiColisionProvider tile=(MultiColisionProvider)tester;
Block block=world.getBlock(x, y, z);
AxisAlignedBB[] aciveBoxes=tile.getActiveBoxes();
if(aciveBoxes==null||aciveBoxes.length==0){
//fail switch
UtilG.println("ISidedColisionProviderRayTracer could not resolve a valid box!",UtilG.getStackTrace());
isRayTracing=false;
return -1;
}
for(int i=0;i<aciveBoxes.length;i++){
block.setBlockBounds((float)aciveBoxes.minX,(float)aciveBoxes.minY,(float)aciveBoxes.minZ,(float)aciveBoxes.maxX,(float)aciveBoxes.maxY,(float)aciveBoxes.maxZ);
results=ArrayUtils.add(results, block.collisionRayTrace(world, x, y, z, startVec.conv(), endVec.conv()));
selectedBoxes=ArrayUtils.add(selectedBoxes,aciveBoxes);
}
if(results.length==0){
if(resetBoundsOptional!=null)block.setBlockBounds((float)resetBoundsOptional.minX,(float)resetBoundsOptional.minY,(float)resetBoundsOptional.minZ,(float)resetBoundsOptional.maxX,(float)resetBoundsOptional.maxY,(float)resetBoundsOptional.maxZ);
tile.setPointedBox(null);
isRayTracing=false;
return -1;
}
double smallest=10000;
int id=0;
if(results.length>0){
for(int id1=0;id1<results.length;id1++){
MovingObjectPosition result1=results[id1];
if(result1!=null&&result1.hitVec!=null){
double distance=startVec.conv().distanceTo(result1.hitVec);
if(distance<smallest){
smallest=distance;
id=id1;
}
}
}
}
if(resetBoundsOptional!=null)block.setBlockBounds((float)resetBoundsOptional.minX,(float)resetBoundsOptional.minY,(float)resetBoundsOptional.minZ,(float)resetBoundsOptional.maxX,(float)resetBoundsOptional.maxY,(float)resetBoundsOptional.maxZ);
else if(selectedBoxes.length>0)block.setBlockBounds((float)selectedBoxes[id].minX,(float)selectedBoxes[id].minY,(float)selectedBoxes[id].minZ,(float)selectedBoxes[id].maxX,(float)selectedBoxes[id].maxY,(float)selectedBoxes[id].maxZ);
try{
tile.setPointedBox(selectedBoxes[id]);
}catch(Exception e){
UtilG.println("Error: max value without crash",selectedBoxes.length-1," and the used value is",id);
UtilG.println("selectedBoxes size",selectedBoxes.length,"results size",results.length);
e.printStackTrace();
}
isRayTracing=false;
return id;
}
public static int getPointedId(MultiColisionProvider provider){
if(provider.getPointedBox()!=null){
AxisAlignedBB box1=provider.getPointedBox();
AxisAlignedBB[] boxes=provider.getBoxes();
for(int i=0;i<boxes.length;i++){
AxisAlignedBB box2=provider.getBoxes();
if(UtilG.AxisAlignedBBEqual(box1, box2)){
return i;
}
}
}
return -1;
}
}
}
0
my Vec3G class has the least errors with only these errors:
errors: Vec3i
with solutions of creating a new class and changing the name
errors: new Vec3(getX(), getY(), getZ())
with no solutions just: The constructor Vec3(double, double, double) is not visible
ill post the rest of the class's errors when i get back from school but that is the Vec3G (equivalent to your Vec3M)
0
I'm looking on the lines of the BuildCraft hit boxes, Thermal Expansion has some really complicated stuff.
attachment 1: shows an idea of a "added on part" to the pipe that has a collision box
attachment 2: shows how when you mouse over the connection to another pipe it has its own "independant" hit box
attachment 3: shows the main part of the pipe (i have this with its collision box working)
0
I've sat here for 3 hours trying to get all of the classes to work and have as little errors as possible, but its just too much. Is there any way to make a simple rayTracing function that can create a hit box around a defined area for every pipe dependent on the output of my checkForNeighbors? I appreciate your effort but I'm really struggling to get your code working with mine.
Any suggestions on how I could create a ray tracing function?
-- or is there a way to trick minecraft into thinking that there are multiple tileentities/blocks in that one block to create more hit boxes?
0
The errors have no suggestion to fix