This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
361152e
commit 0fed524
Showing
9 changed files
with
157 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package misterx.diamondgen; | ||
|
||
import misterx.diamondgen.render.Color; | ||
import misterx.diamondgen.render.Cube; | ||
import misterx.diamondgen.render.Renderer; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Vec3i; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
||
public class SimDebrisGen { | ||
|
||
public List<Renderer> renderers = new ArrayList<>(); | ||
|
||
public boolean generate(Random random, BlockPos blockPos, int size) { | ||
int i = random.nextInt(size + 1); | ||
BlockPos.Mutable mutable = new BlockPos.Mutable(); | ||
|
||
for(int j = 0; j < i; ++j) { | ||
this.getStartPos(mutable, random, blockPos, Math.min(j, 7)); | ||
renderers.add(new Cube(mutable, new Color(255, 255, 0))); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private void getStartPos(BlockPos.Mutable mutable, Random random, BlockPos pos, int size) { | ||
int i = this.randomCoord(random, size); | ||
int j = this.randomCoord(random, size); | ||
int k = this.randomCoord(random, size); | ||
mutable.set((Vec3i)pos, i, j, k); | ||
} | ||
|
||
private int randomCoord(Random random, int size) { | ||
return Math.round((random.nextFloat() - random.nextFloat()) * (float)size); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/misterx/diamondgen/mixin/DimensionTypeMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package misterx.diamondgen.mixin; | ||
|
||
import misterx.diamondgen.SimOreGen; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.dimension.DimensionType; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(DimensionType.class) | ||
public class DimensionTypeMixin implements SimOreGen.DimensionTypeCaller { | ||
|
||
@Shadow @Final private Identifier infiniburn; | ||
|
||
@Override | ||
public Identifier getInfiniburn() { | ||
return this.infiniburn; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters