-
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.
fixed [Dungeons have Archives Placeholder Blocks](#3) fixed [Herald Controller does not generate](#1)
- Loading branch information
1 parent
883bd27
commit ff75448
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/main/java/implementslegend/mod/vaultfaster/mixin/HeraldFix.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,63 @@ | ||
package implementslegend.mod.vaultfaster.mixin; | ||
|
||
import implementslegend.mod.vaultfaster.IndexedBlock; | ||
import iskallia.vault.block.HeraldControllerBlock; | ||
import iskallia.vault.core.world.data.entity.PartialCompoundNbt; | ||
import iskallia.vault.core.world.data.tile.PartialBlockState; | ||
import iskallia.vault.core.world.data.tile.PartialTile; | ||
import iskallia.vault.core.world.template.StructureTemplate; | ||
import iskallia.vault.init.ModBlocks; | ||
import kotlin.jvm.internal.Ref; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.core.FrontAndTop; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.nbt.ListTag; | ||
import net.minecraft.nbt.StringTag; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.JigsawBlock; | ||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; | ||
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.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
import java.lang.ref.Reference; | ||
import java.util.List; | ||
|
||
@Mixin(StructureTemplate.class) | ||
public class HeraldFix { | ||
|
||
@Shadow private String path; | ||
|
||
@Inject(method = "loadPalette",at= @At(value = "INVOKE", target = "Liskallia/vault/core/world/template/StructureTemplate;getOrderedTiles(Ljava/util/List;Ljava/util/List;Ljava/util/List;)Ljava/util/List;"),locals = LocalCapture.CAPTURE_FAILHARD,remap = false) | ||
private void herald(ListTag paletteNBT, ListTag blocksNBT, CallbackInfo ci, List<PartialTile> normal, List<PartialTile> withNBT, List<PartialTile> withSpecialShape){ | ||
if(path.equals("config/the_vault/gen/1.0/structures/vault/starts/herald.nbt")) { | ||
var pos = new BlockPos.MutableBlockPos(0,0,0); | ||
var found = new Ref.BooleanRef(); | ||
withNBT.forEach((it) -> { | ||
if(((IndexedBlock)it.getState().getBlock()).getRegistryIndex()== ((IndexedBlock)ModBlocks.PLACEHOLDER).getRegistryIndex()){ | ||
it.setState(PartialBlockState.of(ModBlocks.HERALD_CONTROLLER.defaultBlockState().setValue(HeraldControllerBlock.HALF, DoubleBlockHalf.LOWER))); | ||
it.setEntity(PartialCompoundNbt.of(new CompoundTag())); | ||
pos.set(it.getPos()).move(Direction.UP); | ||
} | ||
|
||
}); | ||
withNBT.forEach((it) -> { | ||
if(pos.equals(it.getPos())){ | ||
it.setState(PartialBlockState.of(ModBlocks.HERALD_CONTROLLER.defaultBlockState().setValue(HeraldControllerBlock.HALF, DoubleBlockHalf.UPPER))); | ||
it.setEntity(PartialCompoundNbt.of(new CompoundTag())); | ||
found.element=true; | ||
} | ||
}); | ||
if(!found.element){ | ||
withNBT.add(PartialTile.of( | ||
PartialBlockState.of(ModBlocks.HERALD_CONTROLLER.defaultBlockState().setValue(HeraldControllerBlock.HALF, DoubleBlockHalf.UPPER)), | ||
PartialCompoundNbt.of(new CompoundTag()),pos)); | ||
} | ||
} | ||
} | ||
} |
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