Skip to content

Commit

Permalink
fix: incorrect part support shapes causing invalid connections
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Jul 19, 2024
1 parent 82764c2 commit dae7a5b
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
import codechicken.lib.raytracer.IndexedVoxelShape;
import codechicken.lib.raytracer.VoxelShapeCache;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Rotation;
Expand Down Expand Up @@ -33,6 +32,7 @@
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
Expand Down Expand Up @@ -281,11 +281,6 @@ public Iterable<ItemStack> getDrops() {

@Override
public VoxelShape getShape(CollisionContext context) {
return new IndexedVoxelShape(getCollisionShape(context), 0);
}

@Override
public VoxelShape getCollisionShape(CollisionContext context) {
int m = 0;
for (int s = 0; s < 6; s++) {
if (maskConnects(s)) {
Expand All @@ -295,6 +290,11 @@ public VoxelShape getCollisionShape(CollisionContext context) {
return fOShapeStates[m];
}

@Override
public VoxelShape getBlockSupportShape() {
return Shapes.empty();
}

//region Occlusion
@Override
public VoxelShape getOcclusionShape() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ public VoxelShape getShape(CollisionContext context) {
public VoxelShape getCollisionShape(CollisionContext context) {
return Shapes.block();
}

@Override
public VoxelShape getBlockSupportShape() {
return Shapes.empty();
}
//endregion

//region Occlusion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -194,6 +195,11 @@ public VoxelShape getOcclusionShape() {
return getShape(CollisionContext.empty());
}

@Override
public VoxelShape getBlockSupportShape() {
return Shapes.empty();
}

@Override
public MultipartType<?> getType() {
return type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,9 @@ protected void sendSignalUpdate() {
//endregion

//region Multipart properties
@Override
public VoxelShape getCollisionShape(CollisionContext context) {
return cShapes[getSide()];
}

@Override
public VoxelShape getShape(CollisionContext context) {
return getCollisionShape(context);
return cShapes[getSide()];
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
Expand Down Expand Up @@ -380,18 +381,18 @@ protected ItemStack getItem() {

//region Gate shapes and bounds
@Override
public VoxelShape getCollisionShape(CollisionContext context) {
public VoxelShape getShape(CollisionContext context) {
return FaceMicroblockPart.aShapes[0x10 | getSide()]; //TODO bring this in-house. No need to use cover's shape
}

@Override
public VoxelShape getShape(CollisionContext context) {
return getCollisionShape(context);
public VoxelShape getOcclusionShape() {
return oShapes[getSide()];
}

@Override
public VoxelShape getOcclusionShape() {
return oShapes[getSide()];
public VoxelShape getBlockSupportShape() {
return Shapes.empty();
}
//endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
import codechicken.lib.raytracer.IndexedVoxelShape;
import codechicken.lib.raytracer.VoxelShapeCache;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Rotation;
Expand Down Expand Up @@ -32,6 +31,7 @@
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -231,11 +231,6 @@ public Iterable<ItemStack> getDrops() {

@Override
public VoxelShape getShape(CollisionContext context) {
return new IndexedVoxelShape(getCollisionShape(context), 0);
}

@Override
public VoxelShape getCollisionShape(CollisionContext context) {
int m = 0;
for (int s = 0; s < 6; s++) {
if (maskConnects(s)) {
Expand All @@ -245,6 +240,11 @@ public VoxelShape getCollisionShape(CollisionContext context) {
return fOShapeStates[m];
}

@Override
public VoxelShape getBlockSupportShape() {
return Shapes.empty();
}

//region Occlusion
@Override
public VoxelShape getOcclusionShape() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ public VoxelShape getCollisionShape(CollisionContext context) {
return Shapes.empty();
}

@Override
public VoxelShape getBlockSupportShape() {
return Shapes.empty();
}

//region Occlusion
@Override
public VoxelShape getOcclusionShape() {
Expand Down

0 comments on commit dae7a5b

Please sign in to comment.