mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-08 14:36:44 +01:00
Implement tillable, properly register the structures, move cloud blocks a "gas" package
This commit is contained in:
parent
7a6b0aabb5
commit
c8a216ef24
35 changed files with 194 additions and 254 deletions
|
@ -2,7 +2,6 @@ package com.minelittlepony.unicopia;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.minelittlepony.unicopia.block.ITillable;
|
||||
import com.minelittlepony.unicopia.item.UItems;
|
||||
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
|
||||
|
||||
|
@ -10,30 +9,12 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.GrassBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO: forge events
|
||||
public class BlockInteractions {
|
||||
public boolean onBlockTilled(World world, BlockPos pos, PlayerEntity player, ItemStack hoe) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
||||
if (!(state.getBlock() instanceof ITillable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ITillable farm = ((ITillable)state.getBlock());
|
||||
|
||||
if (!farm.canBeTilled(hoe, player, world, state, pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
world.setBlockState(pos, farm.getFarmlandState(hoe, player, world, state, pos));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addAuxiliaryDrops(World world, BlockState state, BlockPos pos, List<ItemStack> drops, int fortune) {
|
||||
Block block = state.getBlock();
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package com.minelittlepony.unicopia;
|
||||
/*
|
||||
package com.minelittlepony.unicopia.world;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
||||
public class Hooks {
|
||||
|
||||
public static void onPlayerRightClickBlock(PlayerInteractEvent.RightClickBlock event) {
|
||||
|
||||
if (event.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ActionResult result = UWorld.instance().getBlocks().onBlockInteract(
|
||||
event.getWorld(), event.getWorld().getBlockState(event.getPos()), event.getPos(), event.getPlayerEntity(), event.getItemStack(), event.getFace(), event.getHand());
|
||||
|
||||
if (result != ActionResult.PASS) {
|
||||
event.setCanceled(true);
|
||||
event.setCancellationResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onBlockHarvested(BlockEvent.HarvestDropsEvent event) {
|
||||
UWorld.instance().getBlocks().addAuxiliaryDrops(event.getWorld(), event.getState(), event.getPos(), event.getDrops(), event.getFortuneLevel());
|
||||
}
|
||||
|
||||
public static void onWorldTick(TickEvent.WorldTickEvent event) {
|
||||
if (event.phase == Phase.START) {
|
||||
UWorld.instance().onUpdate(event.world);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -4,7 +4,7 @@ import java.util.Optional;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.Config;
|
||||
import com.minelittlepony.unicopia.ducks.IRaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.ducks.RaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.entity.IEntity;
|
||||
import com.minelittlepony.unicopia.entity.player.IPlayer;
|
||||
|
||||
|
@ -63,14 +63,14 @@ public class SpeciesList {
|
|||
@Nullable
|
||||
public <T extends IEntity> T getEntity(Entity entity) {
|
||||
return this.<Entity, T>getForEntity(entity)
|
||||
.map(IRaceContainerHolder::getRaceContainer)
|
||||
.map(RaceContainerHolder::getRaceContainer)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <E extends Entity, T extends IEntity> Optional<IRaceContainerHolder<T>> getForEntity(Entity entity) {
|
||||
if (entity instanceof IRaceContainerHolder) {
|
||||
return Optional.of(((IRaceContainerHolder<T>)entity));
|
||||
public <E extends Entity, T extends IEntity> Optional<RaceContainerHolder<T>> getForEntity(Entity entity) {
|
||||
if (entity instanceof RaceContainerHolder) {
|
||||
return Optional.of(((RaceContainerHolder<T>)entity));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package com.minelittlepony.unicopia;
|
||||
|
||||
import com.minelittlepony.unicopia.block.CloudDoorBlock;
|
||||
import com.minelittlepony.unicopia.block.BlockGrowingCuccoon;
|
||||
import com.minelittlepony.unicopia.block.TomatoPlantBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudAnvilBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudDoorBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudFarmlandBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudFenceBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudSlabBlock;
|
||||
import com.minelittlepony.unicopia.gas.CloudStairsBlock;
|
||||
import com.minelittlepony.unicopia.block.ChiselledChitinBlock;
|
||||
import com.minelittlepony.unicopia.block.ChitinBlock;
|
||||
import com.minelittlepony.unicopia.block.CloudAnvilBlock;
|
||||
import com.minelittlepony.unicopia.block.CloudBlock;
|
||||
import com.minelittlepony.unicopia.block.CloudFarmlandBlock;
|
||||
import com.minelittlepony.unicopia.block.CloudFenceBlock;
|
||||
import com.minelittlepony.unicopia.block.CloudSlabBlock;
|
||||
import com.minelittlepony.unicopia.block.CloudStairsBlock;
|
||||
import com.minelittlepony.unicopia.block.DiamondDoorBlock;
|
||||
import com.minelittlepony.unicopia.block.DutchDoorBlock;
|
||||
import com.minelittlepony.unicopia.block.FruitLeavesBlock;
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.function.Function;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.minelittlepony.unicopia.SpeciesList;
|
||||
import com.minelittlepony.unicopia.ducks.Colourful;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -27,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome.TemperatureGroup;
|
||||
|
||||
public class FruitLeavesBlock extends LeavesBlock implements IColourful {
|
||||
public class FruitLeavesBlock extends LeavesBlock implements Colourful {
|
||||
|
||||
public static final BooleanProperty HEAVY = BooleanProperty.of("heavy");
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Random;
|
|||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.UParticles;
|
||||
import com.minelittlepony.unicopia.gas.Gas;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -31,7 +32,7 @@ import net.minecraft.util.shape.VoxelShapes;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class GlowingGemBlock extends TorchBlock implements ICloudBlock {
|
||||
public class GlowingGemBlock extends TorchBlock implements Gas {
|
||||
|
||||
public static BooleanProperty ON = BooleanProperty.of("on");
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Blocks that can be turned into farmland when tilled.
|
||||
*/
|
||||
public interface ITillable {
|
||||
/**
|
||||
* Gets the farmland/tilled state for this block when attacked by a hoe.
|
||||
*/
|
||||
@Nonnull
|
||||
BlockState getFarmlandState(ItemStack hoe, PlayerEntity player, World world, BlockState state, BlockPos pos);
|
||||
|
||||
default boolean canBeTilled(ItemStack hoe, PlayerEntity player, World world, BlockState state, BlockPos pos) {
|
||||
return world.isAir(pos.up());
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.block;
|
|||
|
||||
import java.util.List;
|
||||
import com.minelittlepony.unicopia.UBlocks;
|
||||
import com.minelittlepony.unicopia.gas.CloudFarmlandBlock;
|
||||
import com.minelittlepony.unicopia.item.UItems;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
|
|
|
@ -14,8 +14,8 @@ import com.minelittlepony.unicopia.SpeciesList;
|
|||
import com.minelittlepony.unicopia.UBlocks;
|
||||
import com.minelittlepony.unicopia.UnicopiaCore;
|
||||
import com.minelittlepony.unicopia.ability.PowersRegistry;
|
||||
import com.minelittlepony.unicopia.block.IColourful;
|
||||
import com.minelittlepony.unicopia.client.render.DisguiseRenderer;
|
||||
import com.minelittlepony.unicopia.ducks.Colourful;
|
||||
import com.minelittlepony.unicopia.entity.player.IPlayer;
|
||||
import com.minelittlepony.unicopia.item.UItems;
|
||||
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
|
||||
|
@ -163,8 +163,8 @@ public class UnicopiaCoreClient extends InteractionManager implements ClientModI
|
|||
private static int getLeavesColor(BlockState state, @Nullable ExtendedBlockView world, @Nullable BlockPos pos, int tint) {
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (block instanceof IColourful) {
|
||||
return ((IColourful)block).getCustomTint(state, tint);
|
||||
if (block instanceof Colourful) {
|
||||
return ((Colourful)block).getCustomTint(state, tint);
|
||||
}
|
||||
|
||||
if (world != null && pos != null) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.ducks;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IColourful {
|
||||
public interface Colourful {
|
||||
int getCustomTint(BlockState state, int tint);
|
||||
}
|
|
@ -4,7 +4,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFarmland {
|
||||
public interface Farmland {
|
||||
/**
|
||||
* Gets the state used to represent this block as a piece of dirt.
|
||||
*/
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.unicopia.ducks;
|
|||
|
||||
import com.minelittlepony.unicopia.entity.ItemEntityCapabilities;
|
||||
|
||||
public interface IItemEntity extends IRaceContainerHolder<ItemEntityCapabilities> {
|
||||
public interface IItemEntity extends RaceContainerHolder<ItemEntityCapabilities> {
|
||||
|
||||
int getAge();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.minelittlepony.unicopia.magic.ICaster;
|
|||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public interface IRaceContainerHolder<T extends IEntity> {
|
||||
public interface RaceContainerHolder<T extends IEntity> {
|
||||
T getRaceContainer();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
|
@ -5,7 +5,7 @@ import java.util.function.Function;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.minelittlepony.unicopia.network.ITransmittable;
|
||||
import com.minelittlepony.unicopia.network.Transmittable;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import net.minecraft.util.Identifier;
|
|||
* Interface for things that own and can unlock pages.
|
||||
*
|
||||
*/
|
||||
public interface IPageOwner extends ITransmittable {
|
||||
public interface IPageOwner extends Transmittable {
|
||||
|
||||
@Nonnull
|
||||
Map<Identifier, PageState> getPageStates();
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.minelittlepony.unicopia.entity.FlightControl;
|
|||
import com.minelittlepony.unicopia.entity.RaceContainer;
|
||||
import com.minelittlepony.unicopia.magic.ICaster;
|
||||
import com.minelittlepony.unicopia.magic.IHeldEffect;
|
||||
import com.minelittlepony.unicopia.network.ITransmittable;
|
||||
import com.minelittlepony.unicopia.network.Transmittable;
|
||||
import com.minelittlepony.util.IInterpolator;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
|
@ -24,7 +24,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
*
|
||||
* This is the core of unicopia.
|
||||
*/
|
||||
public interface IPlayer extends ICaster<PlayerEntity>, RaceContainer<PlayerEntity>, ITransmittable, IPageOwner {
|
||||
public interface IPlayer extends ICaster<PlayerEntity>, RaceContainer<PlayerEntity>, Transmittable, IPageOwner {
|
||||
|
||||
/**
|
||||
* Gets the player's magical abilities delegate responsible for all spell casting and persisting/updating.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -19,7 +19,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CloudAnvilBlock extends AnvilBlock implements ICloudBlock {
|
||||
public class CloudAnvilBlock extends AnvilBlock implements Gas {
|
||||
@SuppressWarnings("deprecation")
|
||||
public CloudAnvilBlock() {
|
||||
super(FabricBlockSettings.of(Material.WOOL)
|
||||
|
@ -70,8 +70,8 @@ public class CloudAnvilBlock extends AnvilBlock implements ICloudBlock {
|
|||
public void onScheduledTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||
BlockState below = world.getBlockState(pos.down());
|
||||
|
||||
if (below.getBlock() instanceof ICloudBlock) {
|
||||
if (((ICloudBlock)below.getBlock()).isDense(below)) {
|
||||
if (below.getBlock() instanceof Gas) {
|
||||
if (((Gas)below.getBlock()).isDense(below)) {
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -6,6 +6,7 @@ import com.minelittlepony.unicopia.CloudType;
|
|||
import com.minelittlepony.unicopia.SpeciesList;
|
||||
import com.minelittlepony.unicopia.UBlocks;
|
||||
import com.minelittlepony.unicopia.item.MossItem;
|
||||
import com.minelittlepony.unicopia.util.HoeUtil;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -14,14 +15,14 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CloudBlock extends Block implements ICloudBlock, ITillable {
|
||||
public class CloudBlock extends Block implements Gas, HoeUtil.Tillable {
|
||||
|
||||
private final CloudType variant;
|
||||
|
||||
|
@ -33,6 +34,7 @@ public class CloudBlock extends Block implements ICloudBlock, ITillable {
|
|||
.build()
|
||||
);
|
||||
this.variant = variant;
|
||||
HoeUtil.registerTillingAction(this, UBlocks.cloud_farmland.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,8 +68,8 @@ public class CloudBlock extends Block implements ICloudBlock, ITillable {
|
|||
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState beside, Direction face) {
|
||||
if (beside.getBlock() instanceof ICloudBlock) {
|
||||
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
||||
if (beside.getBlock() instanceof Gas) {
|
||||
Gas cloud = ((Gas)beside.getBlock());
|
||||
|
||||
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
||||
return true;
|
||||
|
@ -113,14 +115,7 @@ public class CloudBlock extends Block implements ICloudBlock, ITillable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeTilled(ItemStack hoe, PlayerEntity player, World world, BlockState state, BlockPos pos) {
|
||||
return SpeciesList.instance().getPlayer(player).getSpecies().canInteractWithClouds()
|
||||
&& ITillable.super.canBeTilled(hoe, player, world, state, pos);
|
||||
public boolean canTill(ItemUsageContext context) {
|
||||
return context.getPlayer() == null || SpeciesList.instance().getPlayer(context.getPlayer()).getSpecies().canInteractWithClouds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFarmlandState(ItemStack hoe, PlayerEntity player, World world, BlockState state, BlockPos pos) {
|
||||
return UBlocks.cloud_farmland.getDefaultState();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.UMaterials;
|
||||
import com.minelittlepony.unicopia.block.AbstractDoorBlock;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
|
@ -15,7 +16,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CloudDoorBlock extends AbstractDoorBlock implements ICloudBlock {
|
||||
public class CloudDoorBlock extends AbstractDoorBlock implements Gas {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public CloudDoorBlock() {
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.UBlocks;
|
||||
import com.minelittlepony.unicopia.ducks.IFarmland;
|
||||
import com.minelittlepony.unicopia.ducks.Farmland;
|
||||
|
||||
import net.minecraft.block.BlockRenderLayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -15,7 +15,7 @@ import net.minecraft.util.math.Direction.Axis;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CloudFarmlandBlock extends FarmlandBlock implements IFarmland, ICloudBlock {
|
||||
public class CloudFarmlandBlock extends FarmlandBlock implements Farmland, Gas {
|
||||
|
||||
public CloudFarmlandBlock(Settings settings) {
|
||||
super(settings);
|
||||
|
@ -29,8 +29,8 @@ public class CloudFarmlandBlock extends FarmlandBlock implements IFarmland, IClo
|
|||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState beside, Direction face) {
|
||||
|
||||
if (beside.getBlock() instanceof ICloudBlock) {
|
||||
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
||||
if (beside.getBlock() instanceof Gas) {
|
||||
Gas cloud = ((Gas)beside.getBlock());
|
||||
|
||||
if (face.getAxis() == Axis.Y || cloud == this) {
|
||||
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CloudFenceBlock extends FenceBlock implements ICloudBlock {
|
||||
public class CloudFenceBlock extends FenceBlock implements Gas {
|
||||
|
||||
private final CloudType variant;
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.block.USlab;
|
||||
|
||||
import net.fabricmc.fabric.api.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -11,7 +12,7 @@ import net.minecraft.block.enums.SlabType;
|
|||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public class CloudSlabBlock<T extends Block & ICloudBlock> extends USlab<T> implements ICloudBlock {
|
||||
public class CloudSlabBlock<T extends Block & Gas> extends USlab<T> implements Gas {
|
||||
|
||||
public CloudSlabBlock(T modelBlock, Material material) {
|
||||
super(modelBlock, FabricBlockSettings.of(material).build());
|
||||
|
@ -25,8 +26,8 @@ public class CloudSlabBlock<T extends Block & ICloudBlock> extends USlab<T> impl
|
|||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState beside, Direction face) {
|
||||
if (isDouble(state)) {
|
||||
if (beside.getBlock() instanceof ICloudBlock) {
|
||||
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
||||
if (beside.getBlock() instanceof Gas) {
|
||||
Gas cloud = ((Gas)beside.getBlock());
|
||||
|
||||
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
||||
return true;
|
||||
|
@ -35,8 +36,8 @@ public class CloudSlabBlock<T extends Block & ICloudBlock> extends USlab<T> impl
|
|||
|
||||
return false;
|
||||
} else {
|
||||
if (beside.getBlock() instanceof ICloudBlock) {
|
||||
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
||||
if (beside.getBlock() instanceof Gas) {
|
||||
Gas cloud = ((Gas)beside.getBlock());
|
||||
|
||||
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.block.UStairs;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -11,7 +12,7 @@ import net.minecraft.entity.EntityContext;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
||||
public class CloudStairsBlock extends UStairs implements ICloudBlock {
|
||||
public class CloudStairsBlock extends UStairs implements Gas {
|
||||
|
||||
public CloudStairsBlock(BlockState inherited, Settings settings) {
|
||||
super(inherited, settings);
|
||||
|
@ -19,8 +20,8 @@ public class CloudStairsBlock extends UStairs implements ICloudBlock {
|
|||
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState beside, Direction face) {
|
||||
if (beside.getBlock() instanceof ICloudBlock) {
|
||||
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
||||
if (beside.getBlock() instanceof Gas) {
|
||||
Gas cloud = ((Gas)beside.getBlock());
|
||||
|
||||
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
||||
Direction front = state.get(FACING);
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.block;
|
||||
package com.minelittlepony.unicopia.gas;
|
||||
|
||||
import com.minelittlepony.unicopia.CloudType;
|
||||
import com.minelittlepony.unicopia.EquinePredicates;
|
||||
|
@ -20,7 +20,7 @@ import net.minecraft.util.math.Vec3d;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICloudBlock {
|
||||
public interface Gas {
|
||||
|
||||
CloudType getCloudMaterialType(BlockState blockState);
|
||||
|
||||
|
@ -51,8 +51,8 @@ public interface ICloudBlock {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (block instanceof ICloudBlock) {
|
||||
CloudType other = ((ICloudBlock)block).getCloudMaterialType(heldState);
|
||||
if (block instanceof Gas) {
|
||||
CloudType other = ((Gas)block).getCloudMaterialType(heldState);
|
||||
|
||||
if (other.canInteract(player)) {
|
||||
return false;
|
||||
|
@ -158,6 +158,6 @@ public interface ICloudBlock {
|
|||
}
|
||||
|
||||
Block above = world.getBlockState(pos.up()).getBlock();
|
||||
return !(above instanceof ICloudBlock) && above instanceof FallingBlock;
|
||||
return !(above instanceof Gas) && above instanceof FallingBlock;
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import javax.annotation.Nullable;
|
|||
import com.google.common.collect.Streams;
|
||||
import com.minelittlepony.unicopia.EquinePredicates;
|
||||
import com.minelittlepony.unicopia.SpeciesList;
|
||||
import com.minelittlepony.unicopia.ducks.IRaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.ducks.RaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.entity.IMagicals;
|
||||
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class CasterUtils {
|
|||
|
||||
if (entity instanceof LivingEntity && !(entity instanceof IMagicals)) {
|
||||
return SpeciesList.instance().getForEntity(entity)
|
||||
.map(IRaceContainerHolder::getCaster);
|
||||
.map(RaceContainerHolder::getCaster);
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
||||
import com.minelittlepony.unicopia.ducks.IFarmland;
|
||||
import com.minelittlepony.unicopia.ducks.Farmland;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -20,8 +20,8 @@ abstract class MixinFarmlandBlock extends Block {
|
|||
at = @At("HEAD"),
|
||||
cancellable = true)
|
||||
public static void setToDirt(BlockState state, World world, BlockPos pos) {
|
||||
if (state.getBlock() instanceof IFarmland) {
|
||||
BlockState dirtState = ((IFarmland)state.getBlock()).getDirtState(state, world, pos);
|
||||
if (state.getBlock() instanceof Farmland) {
|
||||
BlockState dirtState = ((Farmland)state.getBlock()).getDirtState(state, world, pos);
|
||||
world.setBlockState(pos, pushEntitiesUpBeforeBlockChange(state, dirtState, world, pos));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.minelittlepony.unicopia.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
import com.minelittlepony.unicopia.util.HoeUtil;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
||||
@Mixin(HoeItem.class)
|
||||
abstract class MixinHoeItem extends ToolItem {
|
||||
MixinHoeItem() {super(null, null);}
|
||||
|
||||
@Override
|
||||
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||
|
||||
BlockState state = context.getWorld().getBlockState(context.getBlockPos());
|
||||
if (state.getBlock() instanceof HoeUtil.Tillable) {
|
||||
if (!((HoeUtil.Tillable)state.getBlock()).canTill(context)) {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -6,7 +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 com.minelittlepony.unicopia.ducks.IRaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.ducks.RaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.entity.IEntity;
|
||||
import com.minelittlepony.unicopia.entity.LivingEntityCapabilities;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
public abstract class MixinLivingEntity extends Entity implements IRaceContainerHolder<IEntity> {
|
||||
public abstract class MixinLivingEntity extends Entity implements RaceContainerHolder<IEntity> {
|
||||
|
||||
private final IEntity caster = createRaceContainer();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.minelittlepony.unicopia.SpeciesList;
|
||||
import com.minelittlepony.unicopia.ducks.IRaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.ducks.RaceContainerHolder;
|
||||
import com.minelittlepony.unicopia.entity.IEntity;
|
||||
import com.minelittlepony.unicopia.entity.player.IPlayer;
|
||||
import com.minelittlepony.unicopia.entity.player.PlayerCapabilities;
|
||||
|
@ -23,7 +23,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.GameMode;
|
||||
|
||||
@Mixin(PlayerEntity.class)
|
||||
public abstract class MixinPlayerEntity extends LivingEntity implements IRaceContainerHolder<IPlayer> {
|
||||
public abstract class MixinPlayerEntity extends LivingEntity implements RaceContainerHolder<IPlayer> {
|
||||
private MixinPlayerEntity() { super(null, null); }
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package com.minelittlepony.unicopia.network;
|
||||
|
||||
public interface ITransmittable {
|
||||
public interface Transmittable {
|
||||
void sendCapabilities(boolean full);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package com.minelittlepony.unicopia.structure;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.AbstractTempleFeature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
|
||||
public abstract class BiomeWhitelistedFeature<C extends FeatureConfig> extends AbstractTempleFeature<C> {
|
||||
|
||||
public BiomeWhitelistedFeature(Function<Dynamic<?>, ? extends C> function_1) {
|
||||
super(function_1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStartAt(ChunkGenerator<?> generator, Random rand, int x, int z) {
|
||||
ChunkPos pos = getStart(generator, rand, x, z, 0, 0);
|
||||
if (x == pos.x && z == pos.z) {
|
||||
Biome biome = generator.getBiomeSource().getBiome(new BlockPos(x * 16 + 9, 0, z * 16 + 9));
|
||||
|
||||
if (canSpawnInBiome(biome)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract boolean canSpawnInBiome(@Nonnull Biome biome);
|
||||
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package com.minelittlepony.unicopia.structure;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.minelittlepony.unicopia.UnicopiaCore;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
|
||||
|
@ -24,21 +21,27 @@ import net.minecraft.util.math.MutableIntBoundingBox;
|
|||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.DecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.AbstractTempleFeature;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
public class CloudDungeonFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
||||
|
||||
class CloudDungeonFeature extends AbstractTempleFeature<DefaultFeatureConfig> {
|
||||
private static final BlockPos POS = new BlockPos(4, 0, 15);
|
||||
|
||||
private static final Identifier[] VARIANTS = new Identifier[] {
|
||||
new Identifier(UnicopiaCore.MODID, "cloud/temple_small"),
|
||||
new Identifier(UnicopiaCore.MODID, "cloud/house_small"),
|
||||
new Identifier(UnicopiaCore.MODID, "cloud/island_small")
|
||||
};
|
||||
|
||||
private static final List<Biome> ALLOWED_BIOMES = Arrays.<Biome>asList(
|
||||
public CloudDungeonFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func) {
|
||||
super(func);
|
||||
|
||||
Arrays.asList(
|
||||
Biomes.OCEAN,
|
||||
Biomes.WOODED_BADLANDS_PLATEAU,
|
||||
Biomes.DESERT,
|
||||
|
@ -49,10 +52,9 @@ public class CloudDungeonFeature extends BiomeWhitelistedFeature<DefaultFeatureC
|
|||
Biomes.SWAMP_HILLS,
|
||||
Biomes.ICE_SPIKES,
|
||||
Biomes.TAIGA
|
||||
);
|
||||
|
||||
public CloudDungeonFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func) {
|
||||
super(func);
|
||||
).forEach(biome -> {
|
||||
biome.addFeature(GenerationStep.Feature.LOCAL_MODIFICATIONS, Biome.configureFeature(UStructures.CLOUD_HOUSE, FeatureConfig.DEFAULT, Decorator.NOPE, DecoratorConfig.DEFAULT));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,11 +72,6 @@ public class CloudDungeonFeature extends BiomeWhitelistedFeature<DefaultFeatureC
|
|||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawnInBiome(@Nonnull Biome biome) {
|
||||
return ALLOWED_BIOMES.contains(biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureStartFactory getStructureStartFactory() {
|
||||
return Start::new;
|
||||
|
@ -103,7 +100,7 @@ public class CloudDungeonFeature extends BiomeWhitelistedFeature<DefaultFeatureC
|
|||
private final Identifier template;
|
||||
|
||||
public Piece(StructureManager manager, Identifier template, BlockPos pos, BlockRotation rotation) {
|
||||
super(UStructures.CLOUD_HOUSE, 0);
|
||||
super(UStructures.CLOUD_HOUSE_PART, 0);
|
||||
this.pos = pos;
|
||||
this.rotation = rotation;
|
||||
this.template = template;
|
||||
|
@ -112,7 +109,7 @@ public class CloudDungeonFeature extends BiomeWhitelistedFeature<DefaultFeatureC
|
|||
}
|
||||
|
||||
public Piece(StructureManager manager, CompoundTag tag) {
|
||||
super(UStructures.CLOUD_HOUSE, tag);
|
||||
super(UStructures.CLOUD_HOUSE_PART, tag);
|
||||
this.template = new Identifier(tag.getString("Template"));
|
||||
this.rotation = BlockRotation.valueOf(tag.getString("Rot"));
|
||||
init(manager);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.unicopia.structure;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -22,14 +21,17 @@ import net.minecraft.util.math.MutableIntBoundingBox;
|
|||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
import net.minecraft.world.gen.decorator.DecoratorConfig;
|
||||
import net.minecraft.world.gen.feature.AbstractTempleFeature;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
public class RuinFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
||||
|
||||
class RuinFeature extends AbstractTempleFeature<DefaultFeatureConfig> {
|
||||
private static final BlockPos POS = new BlockPos(4, 0, 15);
|
||||
|
||||
private static final Identifier[] VARIANTS = new Identifier[] {
|
||||
new Identifier(UnicopiaCore.MODID, "ground/tower"),
|
||||
new Identifier(UnicopiaCore.MODID, "ground/temple_with_book"),
|
||||
|
@ -38,7 +40,10 @@ public class RuinFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
|||
new Identifier(UnicopiaCore.MODID, "ground/wizard_tower_blue")
|
||||
};
|
||||
|
||||
private static final List<Biome> BIOMELIST = Arrays.<Biome>asList(
|
||||
public RuinFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func) {
|
||||
super(func);
|
||||
|
||||
Arrays.asList(
|
||||
Biomes.TAIGA,
|
||||
Biomes.TAIGA_HILLS,
|
||||
Biomes.GIANT_TREE_TAIGA,
|
||||
|
@ -50,10 +55,9 @@ public class RuinFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
|||
Biomes.SNOWY_TAIGA_MOUNTAINS,
|
||||
Biomes.DARK_FOREST,
|
||||
Biomes.DARK_FOREST_HILLS
|
||||
);
|
||||
|
||||
public RuinFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> func) {
|
||||
super(func);
|
||||
).forEach(biome -> {
|
||||
biome.addFeature(GenerationStep.Feature.SURFACE_STRUCTURES, Biome.configureFeature(UStructures.CLOUD_HOUSE, FeatureConfig.DEFAULT, Decorator.NOPE, DecoratorConfig.DEFAULT));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,11 +75,6 @@ public class RuinFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
|||
return 39548;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawnInBiome(Biome biome) {
|
||||
return BIOMELIST.contains(biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructureStartFactory getStructureStartFactory() {
|
||||
return Start::new;
|
||||
|
@ -104,7 +103,7 @@ public class RuinFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
|||
private final Identifier template;
|
||||
|
||||
public Piece(StructureManager manager, Identifier template, BlockPos pos, BlockRotation rotation) {
|
||||
super(UStructures.RUIN, 0);
|
||||
super(UStructures.RUIN_PART, 0);
|
||||
this.pos = pos;
|
||||
this.rotation = rotation;
|
||||
this.template = template;
|
||||
|
@ -113,7 +112,7 @@ public class RuinFeature extends BiomeWhitelistedFeature<DefaultFeatureConfig> {
|
|||
}
|
||||
|
||||
public Piece(StructureManager manager, CompoundTag tag) {
|
||||
super(UStructures.RUIN, tag);
|
||||
super(UStructures.RUIN_PART, tag);
|
||||
this.template = new Identifier(tag.getString("Template"));
|
||||
this.rotation = BlockRotation.valueOf(tag.getString("Rot"));
|
||||
init(manager);
|
||||
|
|
|
@ -5,15 +5,24 @@ import com.minelittlepony.unicopia.UnicopiaCore;
|
|||
import net.minecraft.structure.StructurePieceType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
|
||||
public interface UStructures {
|
||||
StructurePieceType CLOUD_HOUSE_PART = part("cloud_house", CloudDungeonFeature.Piece::new);
|
||||
StructurePieceType RUIN_PART = part("ruin", RuinFeature.Piece::new);
|
||||
|
||||
StructurePieceType CLOUD_HOUSE = register(CloudDungeonFeature.Piece::new, new Identifier(UnicopiaCore.MODID, "cloud_house"));
|
||||
StructurePieceType RUIN = register(RuinFeature.Piece::new, new Identifier(UnicopiaCore.MODID, "ruin"));
|
||||
StructureFeature<DefaultFeatureConfig> CLOUD_HOUSE = feature("cloud_house", new CloudDungeonFeature(DefaultFeatureConfig::deserialize));
|
||||
StructureFeature<DefaultFeatureConfig> RUIN = feature("ruin", new RuinFeature(DefaultFeatureConfig::deserialize));
|
||||
|
||||
static StructurePieceType part(String id, StructurePieceType type) {
|
||||
return Registry.register(Registry.STRUCTURE_PIECE, new Identifier(UnicopiaCore.MODID, id), type);
|
||||
}
|
||||
|
||||
static StructurePieceType register(StructurePieceType type, Identifier id) {
|
||||
return Registry.register(Registry.STRUCTURE_PIECE, id, type);
|
||||
static <C extends FeatureConfig, F extends Feature<C>> F feature(String id, F feature) {
|
||||
return Registry.register(Registry.FEATURE, new Identifier(UnicopiaCore.MODID, id), feature);
|
||||
}
|
||||
|
||||
static void bootstrap() { }
|
||||
|
|
|
@ -30,7 +30,7 @@ public class AwaitTickQueue {
|
|||
}
|
||||
}
|
||||
|
||||
public void onUpdate(World world) {
|
||||
public void tick(World world) {
|
||||
synchronized (locker) {
|
||||
delayedTasks = delayedTasks.stream().filter(DelayedTask::tick).collect(Collectors.toList());
|
||||
|
||||
|
|
21
src/main/java/com/minelittlepony/unicopia/util/HoeUtil.java
Normal file
21
src/main/java/com/minelittlepony/unicopia/util/HoeUtil.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package com.minelittlepony.unicopia.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
|
||||
public final class HoeUtil extends HoeItem {
|
||||
private HoeUtil() {
|
||||
super(null, 0, null);
|
||||
}
|
||||
|
||||
public static void registerTillingAction(Block block, BlockState tilledState) {
|
||||
TILLED_BLOCKS.put(block, tilledState);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Tillable {
|
||||
boolean canTill(ItemUsageContext context);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue