Partial API calls fixes

This commit is contained in:
paulevsGitch 2021-12-05 05:51:51 +03:00
parent 6671b43cac
commit 2367b5d5be
9 changed files with 20 additions and 62 deletions

View file

@ -2,13 +2,13 @@
# Better End
Better End Mod for Fabric, MC 1.17.1
Better End Mod for Fabric, MC 1.18
Importing:
* Clone repo
* Edit gradle.properties if necessary
* Run command line in folder: gradlew genSources eclipse (or Another-IDE-Name)
* Run command line in folder: gradlew genSources idea (or eclipse)
* Import project to IDE
Building:

View file

@ -1,6 +1,6 @@
package ru.betterend.blocks.entities;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
//import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.Container;
@ -14,7 +14,8 @@ import ru.betterend.blocks.basis.PedestalBlock;
import ru.betterend.registry.EndBlockEntities;
import ru.betterend.registry.EndItems;
public class PedestalBlockEntity extends BlockEntity implements Container, BlockEntityClientSerializable {
// TODO Fix client serialisation
public class PedestalBlockEntity extends BlockEntity implements Container/*, BlockEntityClientSerializable*/ {
private ItemStack activeItem = ItemStack.EMPTY;
private final int maxAge = 314;
@ -110,7 +111,7 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
fromTag(tag);
}
@Override
/*@Override
public CompoundTag save(CompoundTag tag) {
tag.put("active_item", activeItem.save(new CompoundTag()));
return super.save(tag);
@ -124,7 +125,7 @@ public class PedestalBlockEntity extends BlockEntity implements Container, Block
@Override
public CompoundTag toClientTag(CompoundTag tag) {
return save(tag);
}
}*/
protected void fromTag(CompoundTag tag) {
if (tag.contains("active_item")) {

View file

@ -26,7 +26,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import ru.bclib.api.BiomeAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;

View file

@ -27,7 +27,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Blocks;
import ru.bclib.api.BiomeAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;

View file

@ -33,7 +33,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Blocks;
import ru.bclib.api.BiomeAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;

View file

@ -4,8 +4,8 @@ import net.minecraft.core.MappedRegistry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import ru.bclib.api.BiomeAPI;
import ru.bclib.api.TagAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.bclib.integration.ModIntegration;
import ru.bclib.world.features.BCLFeature;

View file

@ -15,61 +15,17 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
@Override
public void init() {
Block block = Integrations.BYG.getBlock("ivis_phylium");
/*Block block = Integrations.BYG.getBlock("ivis_phylium");
if (block != null) {
TagAPI.addTags(block, TagAPI.BLOCK_END_GROUND, TagAPI.BLOCK_GEN_TERRAIN);
}
BYGBlocks.register();
BYGFeatures.register();
BYGBiomes.register();
BYGBiomes.register();*/
}
@Override
public void addBiomes() {
BYGBiomes.addBiomes();
//Class<?> biomeClass = this.getClass("corgiaoc.byg.common.world.biome.BYGEndBiome");
//List<Object> biomes = this.getStaticFieldValue(biomeClass, "BYG_END_BIOMES");
/*if (biomes != null && biomeClass != null) {
biomes.forEach((obj) -> {
Biome biome = this.getAndExecuteRuntime(biomeClass, obj, "getBiome");
if (biome != null) {
ResourceLocation biomeID = BuiltinRegistries.BIOME.getKey(biome);
BCLBiome endBiome = BiomeAPI.getBiome(biomeID);
Biome edge = this.getAndExecuteRuntime(biomeClass, obj, "getEdge");
if (edge != null) {
ResourceLocation edgeID = BuiltinRegistries.BIOME.getKey(edge);
EndBiomes.LAND_BIOMES.removeMutableBiome(edgeID);
EndBiomes.VOID_BIOMES.removeMutableBiome(edgeID);
BCLBiome edgeBiome = BiomeAPI.getBiome(edgeID);
endBiome.setEdge(edgeBiome);
}
else {
Boolean isVoid = this.getAndExecuteRuntime(biomeClass, obj, "isVoid");
if (isVoid != null && isVoid.booleanValue()) {
EndBiomes.LAND_BIOMES.removeMutableBiome(biomeID);
EndBiomes.VOID_BIOMES.addBiomeMutable(endBiome);
}
ShufflingList<ResourceLocation> subBiomes = this.getAndExecuteRuntime(
biomeClass,
obj,
"getHills"
);
if (subBiomes != null) {
subBiomes.stream().collect(Collectors.toList()).forEach((id) -> {
BCLBiome subBiome = BiomeAPI.getBiome(id);
EndBiomes.LAND_BIOMES.removeMutableBiome(id);
EndBiomes.VOID_BIOMES.removeMutableBiome(id);
if (!endBiome.containsSubBiome(subBiome)) {
EndBiomes.SUBBIOMES.add(subBiome);
endBiome.addSubBiome(subBiome);
}
});
}
}
}
});
}*/
//BYGBiomes.addBiomes();
}
}

View file

@ -12,7 +12,7 @@ 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 ru.bclib.api.BiomeAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.betterend.client.ClientOptions;
import ru.betterend.world.biome.EndBiome;
@ -90,9 +90,10 @@ public abstract class MusicTrackerMixin {
}
private boolean be_shouldChangeSound(Music musicSound) {
return currentMusic != null && !musicSound.getEvent()
.getLocation()
.equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic();
return currentMusic != null && !musicSound
.getEvent()
.getLocation()
.equals(this.currentMusic.getLocation()) && musicSound.replaceCurrentMusic();
}
private boolean be_checkNullSound(Music musicSound) {

View file

@ -23,7 +23,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import ru.bclib.api.BiomeAPI;
import ru.bclib.api.biomes.BiomeAPI;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlocks;