-
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
329284d
commit 2366dea
Showing
25 changed files
with
363 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/generated/assets/trailiertales/blockstates/ectoplasm_block.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,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "trailiertales:block/ectoplasm_block" | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/generated/assets/trailiertales/models/item/ectoplasm_block.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,3 @@ | ||
{ | ||
"parent": "trailiertales:block/ectoplasm_block" | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/generated/data/minecraft/tags/block/fall_damage_resetting.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,5 @@ | ||
{ | ||
"values": [ | ||
"trailiertales:ectoplasm_block" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/generated/data/minecraft/tags/block/impermeable.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,5 @@ | ||
{ | ||
"values": [ | ||
"trailiertales:ectoplasm_block" | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/generated/data/trailiertales/advancement/recipes/misc/ectoplasm.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,32 @@ | ||
{ | ||
"parent": "minecraft:recipes/root", | ||
"criteria": { | ||
"has_ectoplasm_block": { | ||
"conditions": { | ||
"items": [ | ||
{ | ||
"items": "trailiertales:ectoplasm_block" | ||
} | ||
] | ||
}, | ||
"trigger": "minecraft:inventory_changed" | ||
}, | ||
"has_the_recipe": { | ||
"conditions": { | ||
"recipe": "minecraft:ectoplasm" | ||
}, | ||
"trigger": "minecraft:recipe_unlocked" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"has_the_recipe", | ||
"has_ectoplasm_block" | ||
] | ||
], | ||
"rewards": { | ||
"recipes": [ | ||
"minecraft:ectoplasm" | ||
] | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/generated/data/trailiertales/advancement/recipes/misc/ectoplasm_block.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,32 @@ | ||
{ | ||
"parent": "minecraft:recipes/root", | ||
"criteria": { | ||
"has_ectoplasm": { | ||
"conditions": { | ||
"items": [ | ||
{ | ||
"items": "trailiertales:ectoplasm" | ||
} | ||
] | ||
}, | ||
"trigger": "minecraft:inventory_changed" | ||
}, | ||
"has_the_recipe": { | ||
"conditions": { | ||
"recipe": "minecraft:ectoplasm_block" | ||
}, | ||
"trigger": "minecraft:recipe_unlocked" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"has_the_recipe", | ||
"has_ectoplasm" | ||
] | ||
], | ||
"rewards": { | ||
"recipes": [ | ||
"minecraft:ectoplasm_block" | ||
] | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/generated/data/trailiertales/loot_table/blocks/ectoplasm_block.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,20 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "trailiertales:ectoplasm_block" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/generated/data/trailiertales/recipe/ectoplasm.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,13 @@ | ||
{ | ||
"type": "minecraft:crafting_shapeless", | ||
"category": "misc", | ||
"ingredients": [ | ||
{ | ||
"item": "trailiertales:ectoplasm_block" | ||
} | ||
], | ||
"result": { | ||
"count": 9, | ||
"id": "trailiertales:ectoplasm" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/generated/data/trailiertales/recipe/ectoplasm_block.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,18 @@ | ||
{ | ||
"type": "minecraft:crafting_shaped", | ||
"category": "misc", | ||
"key": { | ||
"#": { | ||
"item": "trailiertales:ectoplasm" | ||
} | ||
}, | ||
"pattern": [ | ||
"###", | ||
"###", | ||
"###" | ||
], | ||
"result": { | ||
"count": 1, | ||
"id": "trailiertales:ectoplasm_block" | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
src/main/java/net/frozenblock/trailiertales/block/EctoplasmBlock.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,43 @@ | ||
package net.frozenblock.trailiertales.block; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.*; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.material.PushReaction; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.Shapes; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class EctoplasmBlock extends HalfTransparentBlock { | ||
public static final VoxelShape COLLISION_SHAPE = Shapes.empty(); | ||
public static final int LIGHT_BLOCK = 2; | ||
public static final double GRAVITY_SLOWDOWN = 0.4D; | ||
public static final MapCodec<EctoplasmBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> instance.group( | ||
propertiesCodec() | ||
).apply(instance, EctoplasmBlock::new)); | ||
|
||
public EctoplasmBlock(@NotNull Properties properties) { | ||
super(properties.pushReaction(PushReaction.DESTROY)); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
protected MapCodec<? extends EctoplasmBlock> codec() { | ||
return CODEC; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public VoxelShape getCollisionShape(@NotNull BlockState blockState, @NotNull BlockGetter blockGetter, @NotNull BlockPos blockPos, @NotNull CollisionContext collisionContext) { | ||
return COLLISION_SHAPE; | ||
} | ||
|
||
@Override | ||
public int getLightBlock(@NotNull BlockState blockState, @NotNull BlockGetter blockGetter, @NotNull BlockPos blockPos) { | ||
return LIGHT_BLOCK; | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/net/frozenblock/trailiertales/impl/InEctoplasmBlockInterface.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,7 @@ | ||
package net.frozenblock.trailiertales.impl; | ||
|
||
public interface InEctoplasmBlockInterface { | ||
void trailierTales$setClipInEctoplasm(boolean clipInEctoplasm); | ||
|
||
boolean trailierTales$wasClipInEctoplasm(); | ||
} |
65 changes: 65 additions & 0 deletions
65
...ain/java/net/frozenblock/trailiertales/mixin/common/ectoplasm_block/BlockGetterMixin.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,65 @@ | ||
package net.frozenblock.trailiertales.mixin.common.ectoplasm_block; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.frozenblock.trailiertales.block.EctoplasmBlock; | ||
import net.frozenblock.trailiertales.impl.InEctoplasmBlockInterface; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.ClipContext; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
import net.minecraft.world.phys.Vec3; | ||
import net.minecraft.world.phys.shapes.EntityCollisionContext; | ||
import net.minecraft.world.phys.shapes.Shapes; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(BlockGetter.class) | ||
public interface BlockGetterMixin { | ||
|
||
@Shadow | ||
BlockState getBlockState(BlockPos var1); | ||
|
||
@Inject(method = "clip", at = @At("HEAD")) | ||
default void trailierTales$setClipInEctoplasmBlock(ClipContext context, CallbackInfoReturnable<BlockHitResult> info) { | ||
if (context.collisionContext instanceof EntityCollisionContext entityCollisionContext) { | ||
Entity entity = entityCollisionContext.getEntity(); | ||
if (entity instanceof InEctoplasmBlockInterface inEctoplasmBlockInterface) { | ||
BlockState eyeState = getBlockState(BlockPos.containing(entity.getEyePosition())); | ||
if (eyeState != null) { | ||
inEctoplasmBlockInterface.trailierTales$setClipInEctoplasm(eyeState.getBlock() instanceof EctoplasmBlock); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@WrapOperation( | ||
method = "method_17743", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/level/BlockGetter;clipWithInteractionOverride(Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/phys/shapes/VoxelShape;Lnet/minecraft/world/level/block/state/BlockState;)Lnet/minecraft/world/phys/BlockHitResult;" | ||
) | ||
) | ||
default BlockHitResult trailierTales$ectoplasmBlockClip( | ||
BlockGetter instance, Vec3 startVec, Vec3 endVec, BlockPos pos, VoxelShape shape, BlockState state, Operation<BlockHitResult> operation, | ||
ClipContext context | ||
) { | ||
if (context.collisionContext instanceof EntityCollisionContext entityCollisionContext) { | ||
if ( | ||
entityCollisionContext.getEntity() instanceof InEctoplasmBlockInterface inEctoplasmBlockInterface | ||
&& inEctoplasmBlockInterface.trailierTales$wasClipInEctoplasm() | ||
&& state.getBlock() instanceof EctoplasmBlock | ||
) { | ||
shape = Shapes.empty(); | ||
} | ||
} | ||
return operation.call(instance, startVec, endVec, pos, shape, state); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/net/frozenblock/trailiertales/mixin/common/ectoplasm_block/EntityMixin.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,25 @@ | ||
package net.frozenblock.trailiertales.mixin.common.ectoplasm_block; | ||
|
||
import net.frozenblock.trailiertales.impl.InEctoplasmBlockInterface; | ||
import net.minecraft.world.entity.Entity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
@Mixin(Entity.class) | ||
public class EntityMixin implements InEctoplasmBlockInterface { | ||
|
||
@Unique | ||
private boolean trailierTales$clipInEctoplasm; | ||
|
||
@Unique | ||
@Override | ||
public void trailierTales$setClipInEctoplasm(boolean clipInEctoplasm) { | ||
this.trailierTales$clipInEctoplasm = clipInEctoplasm; | ||
} | ||
|
||
@Unique | ||
@Override | ||
public boolean trailierTales$wasClipInEctoplasm() { | ||
return this.trailierTales$clipInEctoplasm; | ||
} | ||
} |
Oops, something went wrong.