Fixes
This commit is contained in:
parent
35f9c02d76
commit
bc7217aff3
6 changed files with 23 additions and 56 deletions
|
@ -41,7 +41,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
private ChorusPlantBlock plantBlock;
|
||||
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
private void canPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
private void beCanPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
|
@ -49,7 +49,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
|
||||
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
|
||||
private void onTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
private void beOnTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||
BlockPos up = pos.up();
|
||||
if (world.isAir(up) && up.getY() < 256) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
@ -19,15 +20,24 @@ import ru.betterend.registry.BlockRegistry;
|
|||
import ru.betterend.registry.BlockTagRegistry;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
@Mixin(ChorusPlantBlock.class)
|
||||
public class ChorusPlantBlockMixin {
|
||||
@Mixin(value = ChorusPlantBlock.class, priority = 500)
|
||||
public abstract class ChorusPlantBlockMixin extends Block {
|
||||
public ChorusPlantBlockMixin(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void beOnInit(AbstractBlock.Settings settings, CallbackInfo info) {
|
||||
this.setDefaultState(this.getDefaultState().with(BlocksHelper.ROOTS, false));
|
||||
}
|
||||
|
||||
@Inject(method = "appendProperties", at = @At("TAIL"))
|
||||
private void addProperties(StateManager.Builder<Block, BlockState> builder, CallbackInfo info) {
|
||||
private void beAddProperties(StateManager.Builder<Block, BlockState> builder, CallbackInfo info) {
|
||||
builder.add(BlocksHelper.ROOTS);
|
||||
}
|
||||
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
private void canPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
private void beCanPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
|
@ -35,7 +45,7 @@ public class ChorusPlantBlockMixin {
|
|||
}
|
||||
|
||||
@Inject(method = "withConnectionProperties", at = @At("RETURN"), cancellable = true)
|
||||
private void withConnectionProperties(BlockView world, BlockPos pos, CallbackInfoReturnable<BlockState> info) {
|
||||
private void beConnectionProperties(BlockView world, BlockPos pos, CallbackInfoReturnable<BlockState> info) {
|
||||
BlockState plant = info.getReturnValue();
|
||||
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
||||
if (!plant.get(Properties.DOWN) && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.LongArrayTag;
|
||||
import net.minecraft.structure.StructureStart;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.ChunkSerializer;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
@Mixin(ChunkSerializer.class)
|
||||
public class ChunkSerializerMixin {
|
||||
@Overwrite
|
||||
private static CompoundTag writeStructures(ChunkPos pos, Map<StructureFeature<?>, StructureStart<?>> structureStarts, Map<StructureFeature<?>, LongSet> structureReferences) {
|
||||
CompoundTag tagResult = new CompoundTag();
|
||||
CompoundTag tagStarts = new CompoundTag();
|
||||
Iterator<Entry<StructureFeature<?>, StructureStart<?>>> startsIterator = structureStarts.entrySet().iterator();
|
||||
|
||||
while (startsIterator.hasNext()) {
|
||||
Entry<StructureFeature<?>, StructureStart<?>> start = startsIterator.next();
|
||||
tagStarts.put((start.getKey()).getName(), (start.getValue()).toTag(pos.x, pos.z));
|
||||
}
|
||||
|
||||
tagResult.put("Starts", tagStarts);
|
||||
CompoundTag tagReferences = new CompoundTag();
|
||||
Iterator<Entry<StructureFeature<?>, LongSet>> refIterator = structureReferences.entrySet().iterator();
|
||||
|
||||
while (refIterator.hasNext()) {
|
||||
Entry<StructureFeature<?>, LongSet> feature = refIterator.next();
|
||||
// Structures sometimes can be null
|
||||
if (feature.getKey() != null) {
|
||||
tagReferences.put((feature.getKey()).getName(), new LongArrayTag(feature.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
tagResult.put("References", tagReferences);
|
||||
return tagResult;
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public class RecipeManagerMixin {
|
|||
private Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
|
||||
|
||||
@Inject(method = "apply", at = @At(value = "RETURN"))
|
||||
private void setRecipes(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
|
||||
private void beSetRecipes(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
|
||||
recipes = EndRecipeManager.getMap(recipes);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,11 @@ public class FeatureRegistry {
|
|||
if (path.equals("end_highlands") || path.equals("end_midlands") || path.equals("small_end_islands")) {
|
||||
int pos = GenerationStep.Feature.VEGETAL_DECORATION.ordinal();
|
||||
if (pos < features.size()) {
|
||||
features.get(pos).clear();
|
||||
List<Supplier<ConfiguredFeature<?, ?>>> list = features.get(pos);
|
||||
// If only chorus plants are enabled
|
||||
if (list.size() < 2) {
|
||||
features.get(pos).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
"ChorusFlowerBlockMixin",
|
||||
"ChorusPlantBlockMixin",
|
||||
"RecipeManagerAccessor",
|
||||
"ChunkSerializerMixin",
|
||||
"MinecraftServerMixin",
|
||||
"TagGroupLoaderMixin",
|
||||
"EndermanEntityMixin",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue