mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Some refinements. Cloud block items now float on other cloud blocks
This commit is contained in:
parent
2025d5af09
commit
23266d2f3a
13 changed files with 59 additions and 3 deletions
|
@ -21,6 +21,10 @@ public interface EquineContext {
|
|||
return 0;
|
||||
}
|
||||
|
||||
default boolean collidesWithClouds() {
|
||||
return getCompositeRace().any(Race::canInteractWithClouds);
|
||||
}
|
||||
|
||||
static EquineContext of(ShapeContext context) {
|
||||
if (context == ShapeContext.absent()) {
|
||||
return Unicopia.SIDE.getPony().map(EquineContext.class::cast).orElse(ABSENT);
|
||||
|
|
|
@ -26,6 +26,7 @@ public interface UTags {
|
|||
TagKey<Item> CHANGELING_EDIBLE = item("food_types/changeling_edible");
|
||||
TagKey<Item> SPOOKED_MOB_DROPS = item("spooked_mob_drops");
|
||||
TagKey<Item> IS_DELIVERED_AGGRESSIVELY = item("is_delivered_aggressively");
|
||||
TagKey<Item> FLOATS_ON_CLOUDS = item("floats_on_clouds");
|
||||
|
||||
TagKey<Item> POLEARMS = item("polearms");
|
||||
TagKey<Item> APPLE_SEEDS = item("apple_seeds");
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.minelittlepony.unicopia.block.cloud;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.unicopia.EquineContext;
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -176,7 +175,7 @@ public class CloudBlock extends Block {
|
|||
}
|
||||
|
||||
protected boolean canInteract(BlockState state, BlockView world, BlockPos pos, EquineContext context) {
|
||||
return context.getCompositeRace().any(Race::canInteractWithClouds);
|
||||
return context.collidesWithClouds();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
|
|
@ -154,6 +154,11 @@ public class ItemImpl implements Equine<ItemEntity> {
|
|||
entity.getDataTracker().set(ITEM_RACE, Race.REGISTRY.getId(race).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesWithClouds() {
|
||||
return entity.getStack().isIn(UTags.FLOATS_ON_CLOUDS) || getSpecies().canInteractWithClouds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toNBT(NbtCompound compound) {
|
||||
compound.putString("owner_race", Race.REGISTRY.getId(getSpecies()).toString());
|
||||
|
|
|
@ -458,9 +458,15 @@ public class AirBalloonEntity extends MobEntity implements EntityCollisions.Comp
|
|||
|
||||
@Override
|
||||
public Race getSpecies() {
|
||||
return isAirworthy() && !isAscending() ? Race.PEGASUS : Race.UNSET;
|
||||
return Race.UNSET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesWithClouds() {
|
||||
return isAirworthy() && !isAscending();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getCloudWalkingStrength() {
|
||||
return isAirworthy() ? 2 : 0;
|
||||
|
|
|
@ -39,4 +39,9 @@ abstract class MixinEntityShapeContext implements EquineContext {
|
|||
public float getCloudWalkingStrength() {
|
||||
return equineContext.getCloudWalkingStrength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesWithClouds() {
|
||||
return equineContext.collidesWithClouds();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"unicopia:cloud_planks",
|
||||
"unicopia:dense_cloud",
|
||||
"unicopia:compacted_cloud",
|
||||
"unicopia:compacted_cloud_planks",
|
||||
"unicopia:unstable_cloud",
|
||||
"unicopia:soggy_cloud"
|
||||
]
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"unicopia:cloud_bed"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"unicopia:cloud_slab",
|
||||
"unicopia:dense_cloud_slab",
|
||||
"unicopia:cloud_planks_slab"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"unicopia:cloud_stairs",
|
||||
"unicopia:dense_cloud_stairs",
|
||||
"unicopia:cloud_planks_stairs"
|
||||
]
|
||||
}
|
9
src/main/resources/data/unicopia/tags/items/clouds.json
Normal file
9
src/main/resources/data/unicopia/tags/items/clouds.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"unicopia:cloud",
|
||||
"unicopia:cloud_planks",
|
||||
"unicopia:dense_cloud",
|
||||
"unicopia:unstable_cloud"
|
||||
]
|
||||
}
|
|
@ -4,8 +4,12 @@
|
|||
"unicopia:cloud",
|
||||
"unicopia:cloud_slab",
|
||||
"unicopia:cloud_stairs",
|
||||
"unicopia:cloud_planks",
|
||||
"unicopia:cloud_planks_slab",
|
||||
"unicopia:cloud_planks_stairs",
|
||||
"unicopia:dense_cloud",
|
||||
"unicopia:dense_cloud_slab",
|
||||
"unicopia:dense_cloud_stairs",
|
||||
"unicopia:unstable_cloud",
|
||||
"unicopia:cloud_pillar",
|
||||
"#unicopia:food_types/raw_fish",
|
||||
|
|
Loading…
Reference in a new issue