Compare commits

..

23 Commits

Author SHA1 Message Date
9e40de85e3 Merge pull request 'new block and better additivity' (#24) from dev into master
All checks were successful
deploy / deploy (push) Successful in 6m2s
Reviewed-on: #24
2024-07-01 23:32:00 +02:00
abc7031989 Merge pull request 'More merging logic + 11 new block + Fix server / client sync' (#23) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m39s
Reviewed-on: #23
2024-06-19 14:42:54 +02:00
ef76408b80 Merge pull request 'fix and new block' (#22) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m32s
Reviewed-on: #22
2024-06-16 18:22:10 +02:00
73bf27bdda Merge pull request 'fix: more checks on ThemedEntity Class (Always more to fix)' (#21) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m8s
Reviewed-on: #21
2024-06-14 17:17:37 +02:00
402caaf549 Merge pull request 'fix: more injection fix + bad culling' (#20) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m5s
Reviewed-on: #20
2024-06-14 16:53:17 +02:00
4eddb32190 Merge pull request 'fix: injection remapping issues fixed + additional check' (#19) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m11s
Reviewed-on: #19
2024-06-14 00:37:13 +02:00
53f962da1b Merge pull request 'changed version' (#18) from dev into master
All checks were successful
deploy / deploy (push) Successful in 6m17s
Reviewed-on: #18
2024-06-13 23:10:51 +02:00
5517d813e7 Merge pull request 'added new blocks and further axiom support' (#17) from dev into master
Some checks failed
deploy / deploy (push) Has been cancelled
Reviewed-on: #17
2024-06-13 22:55:09 +02:00
f6b403d852 Merge pull request 'feat: added support for ReFramed block entities with axiom' (#16) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m16s
Reviewed-on: #16
2024-05-23 12:34:22 +02:00
aa3cf6d511 Merge pull request 'fix: falling block entities calling can replace crashing logic side' (#15) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m59s
Reviewed-on: #15
2024-05-23 00:47:20 +02:00
cfdbfd3a6a Merge pull request 'Improvement for cache fixing issues + 4 new blocks' (#14) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m39s
Reviewed-on: #14
2024-05-14 15:53:28 +02:00
ac2f7def0c Merge pull request '1.5.8 cache fix' (#13) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m13s
Reviewed-on: #13
2024-04-16 19:21:50 +02:00
44f03b2c96 Merge pull request 'New minor version with fix for caching on dynamic models' (#12) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m25s
Reviewed-on: #12
2024-04-15 20:58:47 +02:00
f1af00738e Merge pull request 'version 1.5.6 fix for server imports + support for continuity and MoreCulling compat' (#11) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m44s
Reviewed-on: #11
2024-03-25 16:33:09 +01:00
186cca3e27 Merge pull request 'v1.5 new shapes + self culling + caching + coding tools/cleanup' (#10) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m42s
Reviewed-on: #10
2024-03-14 22:30:29 +01:00
d43d9456ee Merge pull request 'moved and created data generation for all elements other than models + removed block that aren't working' (#9) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m48s
Reviewed-on: #9
2024-03-05 21:56:03 +01:00
2957a899db Merge pull request 'Sound support + OffHand camo.' (#8) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m6s
Reviewed-on: #8
2024-03-04 17:04:13 +01:00
f3578a4da5 Merge pull request 'Indium suppor + github runner' (#7) from dev into master
Some checks failed
deploy / deploy (push) Failing after 5m3s
Reviewed-on: #7
2024-03-03 21:34:52 +01:00
28ae110e14 Merge pull request 'Double frames' (#6) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m14s
Reviewed-on: #6
2024-03-02 02:02:47 +01:00
6dc0cf7fdf Merge pull request 'Athena support + stair improvements + coloration' (#5) from dev into master
All checks were successful
deploy / deploy (push) Successful in 5m13s
Reviewed-on: #5
2024-02-26 17:05:24 +01:00
b30177a5c7 Merge pull request 'Fix mixin trying to inject code in server not available (because the class is client only)' (#3) from dev into master
All checks were successful
deploy / deploy (push) Successful in 4m57s
Reviewed-on: #3
2024-02-17 22:31:39 +01:00
1e132c71ef Merge pull request 'Add data generation before publishing' (#2) from dev into master
All checks were successful
deploy / deploy (push) Successful in 3m56s
Reviewed-on: #2
2024-02-16 22:29:53 +01:00
0233b3fa49 Merge pull request '1.0-SNAPSHOT' (#1) from dev into master
All checks were successful
deploy / deploy (push) Successful in 3m23s
Reviewed-on: #1
2024-02-16 21:50:02 +01:00
11 changed files with 0 additions and 298 deletions

View File

@ -44,7 +44,6 @@ sourceSets {
}
loom {
accessWidenerPath = file("src/main/resources/reframed.accesswidener")
runs {
// This adds a new gradle task that runs the datagen API: "gradlew runDatagen"
datagen {

View File

@ -103,7 +103,6 @@ public class ReFramed implements ModInitializer {
BLUEPRINT = registerItem("blueprint" , new ReFramedBlueprintItem(new Item.Settings()));
BLUEPRINT_WRITTEN = registerItem("blueprint_written" , new ReFramedBlueprintWrittenItem(new Item.Settings().maxCount(1)));
registerBlock("test", new TestBlock(cp(Blocks.OAK_PLANKS).nonOpaque())); // TODO remove
REFRAMED_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, id("camo"),
BlockEntityType.Builder.create(

View File

@ -1,36 +0,0 @@
package fr.adrien1106.reframed.block;
import fr.adrien1106.reframed.client.voxel.MorphVoxel;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
public class TestBlock extends Block {
public static MorphVoxel voxel = new MorphVoxel(createCuboidShape(1, 1, 1, 15, 15, 15),
new Vec3d[] {
new Vec3d(0, 0, 0),
new Vec3d(1, 0, 0),
new Vec3d(1, 1, 1),
new Vec3d(0, 1, 1),
new Vec3d(0, 1, 1),
new Vec3d(1, 1, 1),
new Vec3d(1, 0, 1),
new Vec3d(0, 0, 1)
});
public TestBlock(Settings settings) {
super(settings);
}
@Override
@SuppressWarnings("deprecation")
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return voxel;
}
}

View File

@ -1,7 +0,0 @@
package fr.adrien1106.reframed.client.util;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
public record RaycastResult(Vec3d pos, Direction face, boolean inside) {
}

View File

@ -1,42 +0,0 @@
package fr.adrien1106.reframed.client.voxel;
import fr.adrien1106.reframed.client.util.RaycastResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import java.util.List;
import java.util.Objects;
public class MorphBox extends Box {
protected List<Triangle> triangles;
public MorphBox(List<Triangle> triangles) {
super(new BlockPos(0, 0, 0));
this.triangles = triangles;
}
public RaycastResult triangleRaycast(Vec3d min, Vec3d max) {
return triangles.stream()
.map(triangle -> {
Vec3d inter = triangle.intersection(min, max);
if (inter == null) return null;
return new RaycastResult(
inter,
triangle.face(),
false
);
})
.filter(Objects::nonNull)
.findFirst()
.orElseGet(() -> isInside(min) ? new RaycastResult(
min,
triangles.get(0).face(),
true
) : null);
}
public boolean isInside(Vec3d point) {
return triangles.stream().allMatch(triangle -> triangle.after(point));
}
}

View File

@ -1,100 +0,0 @@
package fr.adrien1106.reframed.client.voxel;
import fr.adrien1106.reframed.client.util.RaycastResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.*;
import net.minecraft.util.shape.SimpleVoxelShape;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.IntStream;
import java.util.stream.Stream;
/**
* Represents a VoxelShape that can be morphed using its 8 vertices.
* the vertices are distributed as follows:
* <pre><code>
* E--------F ABCD -> NORTH
* ^ /| /| EFGH -> SOUTH
* |/ | / | AHED -> EAST
* D--------C | BCGF -> WEST
* | |/ | | ABGH -> DOWN
* | H-----|--G CDFE -> UP
* | / | /
* |/ |/
* A--------B->
* </code></pre>
*/
public class MorphVoxel extends SimpleVoxelShape {
private static final int[][] EDGE_INDICES = {
{0, 1},
{1, 2},
{2, 3},
{3, 0},
{0, 7},
{1, 6},
{2, 5},
{3, 4},
{4, 5},
{5, 6},
{6, 7},
{7, 4}
};
private static final int[][] FACE_INDICES = {
{7, 6, 1, 0},
{5, 4, 3, 2},
{0, 1, 2, 3},
{4, 5, 6, 7},
{0, 3, 4, 7},
{6, 5, 2, 1}
};
protected final Vec3d[] v;
MorphBox box;
public MorphVoxel(VoxelShape wrapper, Vec3d[] vertices) {
super(wrapper.voxels);
List<Triangle> triangles = new ArrayList<>();
Stream.of(Direction.values()).forEach(dir -> {
int i = dir.ordinal();
List<Vec3d> v = IntStream.range(0, 4).mapToObj(j -> { // remove matching vertices
if (vertices[FACE_INDICES[i][j]].equals(vertices[FACE_INDICES[i][(j+1)%4]])) return null;
return vertices[FACE_INDICES[i][j]];
}).filter(Objects::nonNull).toList();
if (v.size() < 3) return; // skip if there are less than 3 vertices (e.g. a line/dot)
triangles.add(Triangle.of(dir,v));
});
box = new MorphBox(triangles);
v = vertices;
}
@Nullable
@Override
public BlockHitResult raycast(Vec3d start, Vec3d end, BlockPos pos) {
RaycastResult result = box.triangleRaycast(start.subtract(pos.getX(), pos.getY(), pos.getZ()), end.subtract(pos.getX(), pos.getY(), pos.getZ()));
return result == null
? null
: new BlockHitResult(
result.pos().add(pos.getX(), pos.getY(), pos.getZ()),
result.face(),
pos,
result.inside()
);
}
@Override
public void forEachEdge(VoxelShapes.BoxConsumer consumer) {
IntStream.range(0, 12).forEach(i -> {
Vec3d a = v[EDGE_INDICES[i][0]];
Vec3d b = v[EDGE_INDICES[i][1]];
consumer.consume(a.x, a.y, a.z, b.x, b.y, b.z);
});
}
}

View File

@ -1,78 +0,0 @@
package fr.adrien1106.reframed.client.voxel;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import java.util.List;
import java.util.stream.IntStream;
/**
* Represents a Face of a MorphVoxel.
* @param v - list of vertices on the same plane
* @param e - list of the outer edges
* @param n - normal of the face
* @param face - the direction of the face
*/
public record Triangle(Vec3d[] v, Vec3d[] e, Vec3d n, Direction face) {
/**
* Creates a Triangle from a list of vertices.
* @param face - the direction of the face
* @param vertices - list of vertices on the same plane
* @return the Triangle
*/
public static Triangle of(Direction face, List<Vec3d> vertices) {
assert vertices.size() >= 3;
Vec3d[] v = vertices.toArray(new Vec3d[0]);
// compute the edges
Vec3d[] e = new Vec3d[v.length];
IntStream.range(0, v.length).forEach(i -> e[i] = v[(i + 1) % v.length].subtract(v[i]));
// compute the normal
Vec3d n = v[1].subtract(v[0]).crossProduct(v[2].subtract(v[0])).normalize();
return new Triangle(v, e, n, face);
}
/**
* Computes the intersection of a ray with the triangle.
* @param start - the start of the ray
* @param end - the end of the ray
* @return the intersection point or null if there is no intersection
*/
public Vec3d intersection(Vec3d start, Vec3d end) {
Vec3d start_v0 = start.subtract(v[0]);
Vec3d end_v1 = end.subtract(v[1]);
// check if the ray intersects the plane
if (n.dotProduct(start_v0) * n.dotProduct(end_v1) >= 0) return null;
Vec3d ray = end.subtract(start);
double direction = n.dotProduct(ray);
// plane normal is facing away from the ray
if (direction < 0) return null;
// get Intersection point
double t = -n.dotProduct(start_v0) / direction;
Vec3d intersection = start.add(ray.multiply(t));
// check if the intersection is inside the triangle
for (int i = 0; i < v.length; i++) {
Vec3d edge = e[i];
Vec3d edge_intersection = intersection.subtract(v[i]);
if (edge_intersection.length() < 1e-6) break; // intersection is on the vertex
double a = n.dotProduct(edge.crossProduct(edge_intersection));
if (a <= 0) return null; // intersection is outside the triangle
if (a <= edge.length() * 1e-6) break; // intersection is on the edge
}
return intersection;
}
public boolean after(Vec3d point) {
return n.dotProduct(point.subtract(v[0])) > 0;
}
}

View File

@ -53,8 +53,6 @@ public class GBlockstate extends FabricModelProvider {
providers.put(ReFramedPostBlock.class, new Post());
providers.put(ReFramedFenceBlock.class, new Fence());
providers.put(ReFramedPostFenceBlock.class, new PostFence());
providers.put(TestBlock.class, new Test());
}
public GBlockstate(FabricDataOutput output) {

View File

@ -1,26 +0,0 @@
package fr.adrien1106.reframed.generator.block;
import fr.adrien1106.reframed.generator.BlockStateProvider;
import fr.adrien1106.reframed.generator.GBlockstate;
import net.minecraft.block.Block;
import net.minecraft.data.client.BlockStateSupplier;
import net.minecraft.data.client.VariantsBlockStateSupplier;
import net.minecraft.util.Identifier;
import static net.minecraft.data.client.VariantSettings.Rotation.R0;
public class Test implements BlockStateProvider {
@Override
public BlockStateSupplier getMultipart(Block block) {
return VariantsBlockStateSupplier.create(
block,
GBlockstate.variant(
new Identifier("block/barrier"),
true,
R0, R0
)
);
}
}

View File

@ -25,7 +25,6 @@
"mixins": [
"reframed.mixins.json"
],
"accessWidener": "reframed.accesswidener",
"depends": {
"minecraft": "${minecraft_version}",
"fabricloader": "^${loader_version}",

View File

@ -1,4 +0,0 @@
accessWidener v2 named
accessible field net/minecraft/util/shape/VoxelShape voxels Lnet/minecraft/util/shape/VoxelSet;
extendable class net/minecraft/util/shape/SimpleVoxelShape