-
Notifications
You must be signed in to change notification settings - Fork 3
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
960186e
commit 9f00d51
Showing
107 changed files
with
1,813 additions
and
385 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
68 changes: 68 additions & 0 deletions
68
src/client/java/dev/spiritstudios/hollow/render/block/EchoingPotBlockEntityRenderer.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,68 @@ | ||
package dev.spiritstudios.hollow.render.block; | ||
|
||
import dev.spiritstudios.hollow.block.entity.EchoingPotBlockEntity; | ||
import net.minecraft.block.entity.DecoratedPotBlockEntity; | ||
import net.minecraft.client.render.RenderLayers; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.block.BlockRenderManager; | ||
import net.minecraft.client.render.block.entity.BlockEntityRenderer; | ||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraft.util.math.RotationAxis; | ||
|
||
import java.util.Objects; | ||
|
||
public class EchoingPotBlockEntityRenderer implements BlockEntityRenderer<EchoingPotBlockEntity> { | ||
private final BlockRenderManager renderManager; | ||
|
||
public EchoingPotBlockEntityRenderer(BlockEntityRendererFactory.Context context) { | ||
this.renderManager = context.getRenderManager(); | ||
} | ||
|
||
@Override | ||
public void render(EchoingPotBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { | ||
matrices.push(); | ||
|
||
DecoratedPotBlockEntity.WobbleType wobbleType = entity.lastWobbleType; | ||
if (wobbleType != null && entity.getWorld() != null) { | ||
float wobbleProgress = ((float) (entity.getWorld().getTime() - entity.lastWobbleTime) + tickDelta) / (float) wobbleType.lengthInTicks; | ||
if (wobbleProgress >= 0.0F && wobbleProgress <= 1.0F) { | ||
if (wobbleType == DecoratedPotBlockEntity.WobbleType.POSITIVE) { | ||
float progressRadians = wobbleProgress * MathHelper.TAU; | ||
|
||
matrices.multiply( | ||
RotationAxis.POSITIVE_X.rotation((-1.5F * (MathHelper.cos(progressRadians) + 0.5F) * MathHelper.sin(progressRadians / 2.0F)) * 0.015625F), | ||
0.5F, 0.0F, 0.5F | ||
); | ||
|
||
matrices.multiply( | ||
RotationAxis.POSITIVE_Z.rotation(MathHelper.sin(progressRadians) * 0.015625F), | ||
0.5F, 0.0F, 0.5F | ||
); | ||
} else matrices.multiply( | ||
RotationAxis.POSITIVE_Y.rotation(MathHelper.sin(-wobbleProgress * 3.0F * MathHelper.PI) * 0.125F * (1.0F - wobbleProgress)), | ||
0.5F, 0.0F, 0.5F | ||
); | ||
} | ||
} | ||
|
||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayers.getBlockLayer(entity.getCachedState())); | ||
|
||
renderManager.getModelRenderer().render( | ||
entity.getWorld(), | ||
renderManager.getModel(entity.getCachedState()), | ||
entity.getCachedState(), | ||
entity.getPos(), | ||
matrices, | ||
vertexConsumer, | ||
true, | ||
Objects.requireNonNull(entity.getWorld()).getRandom(), | ||
light, | ||
overlay | ||
); | ||
|
||
matrices.pop(); | ||
} | ||
} |
160 changes: 160 additions & 0 deletions
160
src/main/generated/assets/hollow/blockstates/blue_wildflower.json
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,160 @@ | ||
{ | ||
"multipart": [ | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_1" | ||
}, | ||
"when": { | ||
"facing": "north", | ||
"flower_amount": "1|2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_1", | ||
"y": 90 | ||
}, | ||
"when": { | ||
"facing": "east", | ||
"flower_amount": "1|2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_1", | ||
"y": 180 | ||
}, | ||
"when": { | ||
"facing": "south", | ||
"flower_amount": "1|2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_1", | ||
"y": 270 | ||
}, | ||
"when": { | ||
"facing": "west", | ||
"flower_amount": "1|2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_2" | ||
}, | ||
"when": { | ||
"facing": "north", | ||
"flower_amount": "2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_2", | ||
"y": 90 | ||
}, | ||
"when": { | ||
"facing": "east", | ||
"flower_amount": "2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_2", | ||
"y": 180 | ||
}, | ||
"when": { | ||
"facing": "south", | ||
"flower_amount": "2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_2", | ||
"y": 270 | ||
}, | ||
"when": { | ||
"facing": "west", | ||
"flower_amount": "2|3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_3" | ||
}, | ||
"when": { | ||
"facing": "north", | ||
"flower_amount": "3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_3", | ||
"y": 90 | ||
}, | ||
"when": { | ||
"facing": "east", | ||
"flower_amount": "3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_3", | ||
"y": 180 | ||
}, | ||
"when": { | ||
"facing": "south", | ||
"flower_amount": "3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_3", | ||
"y": 270 | ||
}, | ||
"when": { | ||
"facing": "west", | ||
"flower_amount": "3|4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_4" | ||
}, | ||
"when": { | ||
"facing": "north", | ||
"flower_amount": "4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_4", | ||
"y": 90 | ||
}, | ||
"when": { | ||
"facing": "east", | ||
"flower_amount": "4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_4", | ||
"y": 180 | ||
}, | ||
"when": { | ||
"facing": "south", | ||
"flower_amount": "4" | ||
} | ||
}, | ||
{ | ||
"apply": { | ||
"model": "hollow:block/blue_wildflower_4", | ||
"y": 270 | ||
}, | ||
"when": { | ||
"facing": "west", | ||
"flower_amount": "4" | ||
} | ||
} | ||
] | ||
} |
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,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "hollow:block/cattail" | ||
} | ||
} | ||
} |
Oops, something went wrong.