Small fix
This commit is contained in:
parent
3c1f518f22
commit
ef0cb759d4
5 changed files with 31 additions and 30 deletions
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -22,22 +21,19 @@ import net.minecraft.particle.ParticleTypes;
|
|||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class BlockVentBubbleColumn extends Block implements FluidDrainable, FluidFillable, BlockPatterned {
|
||||
public class BlockVentBubbleColumn extends Block implements FluidDrainable, FluidFillable {
|
||||
public BlockVentBubbleColumn() {
|
||||
super(FabricBlockSettings.of(Material.BUBBLE_COLUMN).nonOpaque().noCollision().dropsNothing());
|
||||
}
|
||||
|
@ -125,20 +121,4 @@ public class BlockVentBubbleColumn extends Block implements FluidDrainable, Flui
|
|||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getStill(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
return Patterns.createJson(Patterns.BLOCK_EMPTY, "stone", "stone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,44 +2,58 @@ package ru.betterend.mixin.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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.At.Shift;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.resource.NamespaceResourceManager;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
|
||||
@Mixin(NamespaceResourceManager.class)
|
||||
public abstract class NamespaceResourceManagerMixin {
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
protected List<ResourcePack> packList;
|
||||
|
||||
@Shadow
|
||||
public abstract Resource getResource(Identifier id);
|
||||
@Shadow
|
||||
public abstract List<Resource> getAllResources(Identifier id);
|
||||
|
||||
@Inject(method = "getAllResources", cancellable = true, at = @At(
|
||||
value = "NEW",
|
||||
target = "java/io/FileNotFoundException",
|
||||
shift = Shift.BEFORE))
|
||||
public void getStatesPattern(Identifier id, CallbackInfoReturnable<List<Resource>> info) {
|
||||
if (id.getNamespace().contains(BetterEnd.MOD_ID)) {
|
||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||
String[] data = id.getPath().split("/");
|
||||
if (data.length > 1) {
|
||||
Identifier blockId = BetterEnd.makeID(data[1].replace(".json", ""));
|
||||
Block block = Registry.BLOCK.get(blockId);
|
||||
if (block instanceof BlockPatterned) {
|
||||
List<Resource> resources = Lists.newArrayList();
|
||||
resources.add(this.getResource(((BlockPatterned) block).statePatternId()));
|
||||
info.setReturnValue(resources);
|
||||
info.cancel();
|
||||
Identifier stateId = ((BlockPatterned) block).statePatternId();
|
||||
try {
|
||||
List<Resource> resources = Lists.newArrayList();
|
||||
Resource stateRes = this.getResource(stateId);
|
||||
resources.add(stateRes);
|
||||
info.setReturnValue(resources);
|
||||
info.cancel();
|
||||
} catch (Exception ex) {
|
||||
BetterEnd.LOGGER.catching(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class EndFeatures {
|
|||
public static final EndFeature CHARNIA_GREEN = new EndFeature("charnia_green", new CharniaFeature(EndBlocks.CHARNIA_GREEN), 10);
|
||||
public static final EndFeature MENGER_SPONGE = new EndFeature("menger_sponge", new MengerSpongeFeature(5), 1);
|
||||
public static final EndFeature CHARNIA_RED_RARE = new EndFeature("charnia_red_rare", new CharniaFeature(EndBlocks.CHARNIA_RED), 2);
|
||||
public static final EndFeature OVERWORLD_ISLAND = EndFeature.makeOverworldIsland("overworld_island", new OverworldIslandFeature());
|
||||
public static final EndFeature OVERWORLD_ISLAND = EndFeature.makeFetureConfigured("overworld_island", new OverworldIslandFeature());
|
||||
|
||||
// Terrain //
|
||||
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);
|
||||
|
|
|
@ -114,7 +114,7 @@ public class EndFeature {
|
|||
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||
}
|
||||
|
||||
public static EndFeature makeOverworldIsland(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
public static EndFeature makeFetureConfigured(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT);
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.RAW_GENERATION, configured);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "minecraft:block/water"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue