Shadow walker
This commit is contained in:
parent
60f50767cf
commit
452fbf0497
7 changed files with 45 additions and 4 deletions
|
@ -9,7 +9,6 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
|
|
||||||
import ru.betterend.blocks.basis.BlockPedestal;
|
import ru.betterend.blocks.basis.BlockPedestal;
|
||||||
import ru.betterend.blocks.entities.InfusionPedestalEntity;
|
import ru.betterend.blocks.entities.InfusionPedestalEntity;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.loot.context.LootContextParameters;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.BooleanProperty;
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
import net.minecraft.state.property.EnumProperty;
|
import net.minecraft.state.property.EnumProperty;
|
||||||
|
import net.minecraft.tag.BlockTags;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
@ -128,7 +129,7 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
|
||||||
BlockPos pos = context.getBlockPos();
|
BlockPos pos = context.getBlockPos();
|
||||||
BlockState upState = world.getBlockState(pos.up());
|
BlockState upState = world.getBlockState(pos.up());
|
||||||
BlockState downState = world.getBlockState(pos.down());
|
BlockState downState = world.getBlockState(pos.down());
|
||||||
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN);
|
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN) || upState.isIn(BlockTags.WALLS);
|
||||||
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
||||||
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
||||||
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
||||||
|
@ -160,7 +161,7 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
|
||||||
if (direction != Direction.UP && direction != Direction.DOWN) return state;
|
if (direction != Direction.UP && direction != Direction.DOWN) return state;
|
||||||
BlockState upState = world.getBlockState(pos.up());
|
BlockState upState = world.getBlockState(pos.up());
|
||||||
BlockState downState = world.getBlockState(pos.down());
|
BlockState downState = world.getBlockState(pos.down());
|
||||||
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN);
|
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN) || upState.isIn(BlockTags.WALLS);
|
||||||
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
||||||
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
||||||
if (direction == Direction.UP) {
|
if (direction == Direction.UP) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
import net.minecraft.entity.passive.SchoolingFishEntity;
|
import net.minecraft.entity.passive.SchoolingFishEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
@ -60,7 +61,7 @@ public class EntityEndFish extends SchoolingFishEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemStack getFishBucketItem() {
|
protected ItemStack getFishBucketItem() {
|
||||||
return null;
|
return new ItemStack(Items.WATER_BUCKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,11 +9,13 @@ import net.minecraft.entity.EntityType.EntityFactory;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.SpawnGroup;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
import net.minecraft.entity.attribute.DefaultAttributeContainer.Builder;
|
import net.minecraft.entity.attribute.DefaultAttributeContainer.Builder;
|
||||||
|
import net.minecraft.entity.mob.HostileEntity;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.entity.EntityDragonfly;
|
import ru.betterend.entity.EntityDragonfly;
|
||||||
import ru.betterend.entity.EntityEndFish;
|
import ru.betterend.entity.EntityEndFish;
|
||||||
import ru.betterend.entity.EntityEndSlime;
|
import ru.betterend.entity.EntityEndSlime;
|
||||||
|
import ru.betterend.entity.EntityShadowWalker;
|
||||||
import ru.betterend.util.MHelper;
|
import ru.betterend.util.MHelper;
|
||||||
import ru.betterend.util.SpawnHelper;
|
import ru.betterend.util.SpawnHelper;
|
||||||
|
|
||||||
|
@ -21,10 +23,12 @@ public class EndEntities {
|
||||||
public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), true, MHelper.color(32, 42, 176), MHelper.color(115, 225, 249));
|
public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), true, MHelper.color(32, 42, 176), MHelper.color(115, 225, 249));
|
||||||
public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 2F, 2F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), false, MHelper.color(28, 28, 28), MHelper.color(99, 11, 99));
|
public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 2F, 2F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), false, MHelper.color(28, 28, 28), MHelper.color(99, 11, 99));
|
||||||
public static final EntityType<EntityEndFish> END_FISH = register("end_fish", SpawnGroup.WATER_AMBIENT, 0.5F, 0.5F, EntityEndFish::new, EntityEndFish.createMobAttributes(), true, MHelper.color(3, 50, 76), MHelper.color(120, 206, 255));
|
public static final EntityType<EntityEndFish> END_FISH = register("end_fish", SpawnGroup.WATER_AMBIENT, 0.5F, 0.5F, EntityEndFish::new, EntityEndFish.createMobAttributes(), true, MHelper.color(3, 50, 76), MHelper.color(120, 206, 255));
|
||||||
|
public static final EntityType<EntityShadowWalker> SHADOW_WALKER = register("shadow_walker", SpawnGroup.MONSTER, 0.6F, 1.95F, EntityShadowWalker::new, EntityShadowWalker.createMobAttributes(), true, MHelper.color(30, 30, 30), MHelper.color(5, 5, 5));
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
SpawnHelper.restrictionLand(END_SLIME, EntityEndSlime::canSpawn);
|
SpawnHelper.restrictionLand(END_SLIME, EntityEndSlime::canSpawn);
|
||||||
SpawnHelper.restrictionWater(END_FISH, EntityEndFish::canSpawn);
|
SpawnHelper.restrictionWater(END_FISH, EntityEndFish::canSpawn);
|
||||||
|
SpawnHelper.restrictionWater(SHADOW_WALKER, HostileEntity::canSpawnInDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static <T extends Entity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity) {
|
protected static <T extends Entity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.entity.EntityType;
|
||||||
import ru.betterend.entity.render.RendererEntityDragonfly;
|
import ru.betterend.entity.render.RendererEntityDragonfly;
|
||||||
import ru.betterend.entity.render.RendererEntityEndFish;
|
import ru.betterend.entity.render.RendererEntityEndFish;
|
||||||
import ru.betterend.entity.render.RendererEntityEndSlime;
|
import ru.betterend.entity.render.RendererEntityEndSlime;
|
||||||
|
import ru.betterend.entity.render.RendererEntityShadowWalker;
|
||||||
|
|
||||||
public class EndEntitiesRenders {
|
public class EndEntitiesRenders {
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ public class EndEntitiesRenders {
|
||||||
register(EndEntities.DRAGONFLY, RendererEntityDragonfly.class);
|
register(EndEntities.DRAGONFLY, RendererEntityDragonfly.class);
|
||||||
register(EndEntities.END_SLIME, RendererEntityEndSlime.class);
|
register(EndEntities.END_SLIME, RendererEntityEndSlime.class);
|
||||||
register(EndEntities.END_FISH, RendererEntityEndFish.class);
|
register(EndEntities.END_FISH, RendererEntityEndFish.class);
|
||||||
|
register(EndEntities.SHADOW_WALKER, RendererEntityShadowWalker.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(EntityType<?> type, Class<? extends MobEntityRenderer<?, ?>> renderer) {
|
private static void register(EntityType<?> type, Class<? extends MobEntityRenderer<?, ?>> renderer) {
|
||||||
|
|
|
@ -22,6 +22,9 @@ public class EndSounds {
|
||||||
|
|
||||||
// Entity
|
// Entity
|
||||||
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly");
|
public static final SoundEvent ENTITY_DRAGONFLY = register("entity", "dragonfly");
|
||||||
|
public static final SoundEvent ENTITY_SHADOW_WALKER = register("entity", "shadow_walker");
|
||||||
|
public static final SoundEvent ENTITY_SHADOW_WALKER_DAMAGE = register("entity", "shadow_walker_damage");
|
||||||
|
public static final SoundEvent ENTITY_SHADOW_WALKER_DEATH = register("entity", "shadow_walker_death");
|
||||||
|
|
||||||
public static void register() {}
|
public static void register() {}
|
||||||
|
|
||||||
|
|
|
@ -152,5 +152,36 @@
|
||||||
"stream": false
|
"stream": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"betterend.entity.shadow_walker": {
|
||||||
|
"category": "entity",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "betterend:entity/shadow_walker/shadow_walker_1",
|
||||||
|
"stream": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "betterend:entity/shadow_walker/shadow_walker_2",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"betterend.entity.shadow_walker_damage": {
|
||||||
|
"category": "entity",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "betterend:entity/shadow_walker/shadow_walker_damage",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"betterend.entity.shadow_walker_death": {
|
||||||
|
"category": "entity",
|
||||||
|
"sounds": [
|
||||||
|
{
|
||||||
|
"name": "betterend:entity/shadow_walker/shadow_walker_death",
|
||||||
|
"stream": false
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue