Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve VoxelShape Fabric Generator exporter #445

Merged
merged 2 commits into from
May 9, 2024
Merged

Improve VoxelShape Fabric Generator exporter #445

merged 2 commits into from
May 9, 2024

Conversation

SandroHc
Copy link
Contributor

@SandroHc SandroHc commented Nov 26, 2023

Improves the code generated by the VoxelShape Fabric Generator plugin by merging all individual shapes into a single one.

Old generated code:

public VoxelShape makeShape(){
	VoxelShape shape = VoxelShapes.empty();
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.1875, 0, 0.375, 0.8125, 0.8125, 0.875));
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.25, 0, 0.25, 0.75, 0.3125, 0.375));
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.125, 0, 0.4375, 0.1875, 0.4375, 0.8125));
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.8125, 0, 0.4375, 0.875, 0.4375, 0.8125));

	return shape;
}

New generated code:

public static VoxelShape makeShape() {
	return VoxelShapes.union(
		VoxelShapes.cuboid(0.1875, 0, 0.375, 0.8125, 0.8125, 0.875),
		VoxelShapes.cuboid(0.25, 0, 0.25, 0.75, 0.3125, 0.375),
		VoxelShapes.cuboid(0.125, 0, 0.4375, 0.1875, 0.4375, 0.8125),
		VoxelShapes.cuboid(0.8125, 0, 0.4375, 0.875, 0.4375, 0.8125)
	);
}

Improves the code generated by the VoxelShape Fabric Generator plugin by merging all individual shapes into a single one.

Old code generated:
```java
public VoxelShape makeShape(){
	VoxelShape shape = VoxelShapes.empty();
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.1875, 0, 0.375, 0.8125, 0.8125, 0.875));
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.25, 0, 0.25, 0.75, 0.3125, 0.375));
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.125, 0, 0.4375, 0.1875, 0.4375, 0.8125));
	shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.8125, 0, 0.4375, 0.875, 0.4375, 0.8125));

	return shape;
}
```

New generated code:
```java
public static VoxelShape makeShape() {
	return VoxelShapes.union(
		VoxelShapes.cuboid(0.1875, 0, 0.375, 0.8125, 0.8125, 0.875),
		VoxelShapes.cuboid(0.25, 0, 0.25, 0.75, 0.3125, 0.375),
		VoxelShapes.cuboid(0.125, 0, 0.4375, 0.1875, 0.4375, 0.8125),
		VoxelShapes.cuboid(0.8125, 0, 0.4375, 0.875, 0.4375, 0.8125)
	);
}
```
@JannisX11
Copy link
Owner

Looks good from my side.
@CyberStefNef permission to merge into your plugin?

@JannisX11 JannisX11 added the awaiting owner approval The original creator of the plugin or an approved maintainer needs to approve the changes label Mar 18, 2024
@JannisX11 JannisX11 merged commit e78c752 into JannisX11:master May 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting owner approval The original creator of the plugin or an approved maintainer needs to approve the changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants