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;
|
private ChorusPlantBlock plantBlock;
|
||||||
|
|
||||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
@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)) {
|
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||||
info.setReturnValue(true);
|
info.setReturnValue(true);
|
||||||
info.cancel();
|
info.cancel();
|
||||||
|
@ -49,7 +49,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
|
@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)) {
|
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||||
BlockPos up = pos.up();
|
BlockPos up = pos.up();
|
||||||
if (world.isAir(up) && up.getY() < 256) {
|
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.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import net.minecraft.block.AbstractBlock;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
@ -19,15 +20,24 @@ import ru.betterend.registry.BlockRegistry;
|
||||||
import ru.betterend.registry.BlockTagRegistry;
|
import ru.betterend.registry.BlockTagRegistry;
|
||||||
import ru.betterend.util.BlocksHelper;
|
import ru.betterend.util.BlocksHelper;
|
||||||
|
|
||||||
@Mixin(ChorusPlantBlock.class)
|
@Mixin(value = ChorusPlantBlock.class, priority = 500)
|
||||||
public class ChorusPlantBlockMixin {
|
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"))
|
@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);
|
builder.add(BlocksHelper.ROOTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
@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)) {
|
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||||
info.setReturnValue(true);
|
info.setReturnValue(true);
|
||||||
info.cancel();
|
info.cancel();
|
||||||
|
@ -35,7 +45,7 @@ public class ChorusPlantBlockMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "withConnectionProperties", at = @At("RETURN"), cancellable = true)
|
@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();
|
BlockState plant = info.getReturnValue();
|
||||||
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
||||||
if (!plant.get(Properties.DOWN) && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
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;
|
private Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
|
||||||
|
|
||||||
@Inject(method = "apply", at = @At(value = "RETURN"))
|
@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);
|
recipes = EndRecipeManager.getMap(recipes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,10 +73,14 @@ public class FeatureRegistry {
|
||||||
if (path.equals("end_highlands") || path.equals("end_midlands") || path.equals("small_end_islands")) {
|
if (path.equals("end_highlands") || path.equals("end_midlands") || path.equals("small_end_islands")) {
|
||||||
int pos = GenerationStep.Feature.VEGETAL_DECORATION.ordinal();
|
int pos = GenerationStep.Feature.VEGETAL_DECORATION.ordinal();
|
||||||
if (pos < features.size()) {
|
if (pos < features.size()) {
|
||||||
|
List<Supplier<ConfiguredFeature<?, ?>>> list = features.get(pos);
|
||||||
|
// If only chorus plants are enabled
|
||||||
|
if (list.size() < 2) {
|
||||||
features.get(pos).clear();
|
features.get(pos).clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addFeature(FLAVOLITE_LAYER, features);
|
addFeature(FLAVOLITE_LAYER, features);
|
||||||
addFeature(ENDER_ORE, features);
|
addFeature(ENDER_ORE, features);
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
"ChorusFlowerBlockMixin",
|
"ChorusFlowerBlockMixin",
|
||||||
"ChorusPlantBlockMixin",
|
"ChorusPlantBlockMixin",
|
||||||
"RecipeManagerAccessor",
|
"RecipeManagerAccessor",
|
||||||
"ChunkSerializerMixin",
|
|
||||||
"MinecraftServerMixin",
|
"MinecraftServerMixin",
|
||||||
"TagGroupLoaderMixin",
|
"TagGroupLoaderMixin",
|
||||||
"EndermanEntityMixin",
|
"EndermanEntityMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue