Fix Spawn Protection
This commit is contained in:
parent
221f6e2336
commit
378a0662c8
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
**1.0.14**
|
||||
* Fix Spawn Protection
|
||||
|
||||
**1.0.13**
|
||||
* Fix Bugs
|
||||
|
||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
||||
fabric_loader_version = 0.7.10+build.191
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.13
|
||||
mod_version = 1.0.14
|
||||
maven_group = com.thebrokenrail
|
||||
archives_base_name = reliccraft
|
||||
|
||||
|
@ -9,9 +9,12 @@ import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.SpawnType;
|
||||
import net.minecraft.entity.mob.ZombieEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.thrown.ThrownPotionEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
@ -78,6 +81,9 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
ThrownPotionEntity entity = new ThrownPotionEntity(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
entity.setItemStack(PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.STRONG_HARMING));
|
||||
world.spawnEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +95,13 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos) && world.canPlayerModifyAt((PlayerEntity) attacker, attacker.getBlockPos().down())) {
|
||||
BlockState state1 = world.getBlockState(attacker.getBlockPos().down());
|
||||
BlockState state2 = world.getBlockState(pos);
|
||||
world.setBlockState(attacker.getBlockPos().down(), state2);
|
||||
world.setBlockState(pos, state1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
@ -109,16 +117,20 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, Entity target) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, target.getBlockPos())) {
|
||||
target.remove();
|
||||
target.kill();
|
||||
world.setBlockState(target.getBlockPos(), Blocks.DIRT.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class NetherAction implements Action {
|
||||
@Override
|
||||
@ -137,9 +149,11 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||
world.setBlockState(pos, Blocks.LAVA.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class EndAction implements Action {
|
||||
@Override
|
||||
@ -154,9 +168,11 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||
world.setBlockState(pos, Blocks.END_STONE.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class DiamondAction extends ConversionAction {
|
||||
@Override
|
||||
@ -212,7 +228,7 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (world.getBlockState(pos).getBlock() == getTargetBlock()) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos) && world.getBlockState(pos).getBlock() == getTargetBlock()) {
|
||||
world.setBlockState(pos, getConvertedBlock().getDefaultState());
|
||||
}
|
||||
}
|
||||
@ -248,21 +264,25 @@ public class Actions {
|
||||
public static class BedrockAction implements Action {
|
||||
@Override
|
||||
public int getCost() {
|
||||
return 90;
|
||||
return 95;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, Entity target) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, attacker.getBlockPos())) {
|
||||
target.remove();
|
||||
target.kill();
|
||||
world.setBlockState(target.getBlockPos(), Blocks.BEDROCK.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||
world.setBlockState(pos, Blocks.BEDROCK.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class HealAction implements Action {
|
||||
@Override
|
||||
@ -279,6 +299,9 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
ThrownPotionEntity entity = new ThrownPotionEntity(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
entity.setItemStack(PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.STRONG_HEALING));
|
||||
world.spawnEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,10 +353,12 @@ public class Actions {
|
||||
|
||||
@Override
|
||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||
int blockID = new Random().nextInt(Registry.BLOCK.getIds().size());
|
||||
Block block = Registry.BLOCK.get(blockID);
|
||||
world.setBlockState(pos, block.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost() {
|
||||
|
Reference in New Issue
Block a user