This commit is contained in:
parent
f8642b9b38
commit
719ebe0920
@ -6,13 +6,13 @@ import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
|
|||||||
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
|
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.LightningRodBlock;
|
import com.thebrokenrail.energonrelics.block.LightningRodBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldProjectorBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldProjectorBlock;
|
||||||
|
import com.thebrokenrail.energonrelics.block.forcefield.IndustrialLaserProjectorBlock;
|
||||||
|
import com.thebrokenrail.energonrelics.block.forcefield.IndustrialLaserBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.RepulsorBeamBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.RepulsorBeamBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.TractorBeamBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.TractorBeamBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.util.BeamBlock;
|
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.TractorBeamProjectorBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.TractorBeamProjectorBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldBlock;
|
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.misc.VeridiumBlockBlock;
|
import com.thebrokenrail.energonrelics.block.misc.VeridiumBlockBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.forcefield.util.FieldProjectorBlock;
|
|
||||||
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
|
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.misc.ThermalGlassBlock;
|
import com.thebrokenrail.energonrelics.block.misc.ThermalGlassBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.battery.ActiveBatteryControllerBlock;
|
import com.thebrokenrail.energonrelics.block.battery.ActiveBatteryControllerBlock;
|
||||||
@ -34,6 +34,7 @@ import net.fabricmc.api.ModInitializer;
|
|||||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.MaterialColor;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -90,6 +91,9 @@ public class EnergonRelics implements ModInitializer {
|
|||||||
|
|
||||||
public static final SpecialRecipeSerializer<DuplicateNetworkChipRecipe> DUPLICATE_NETWORK_CHIP_RECIPE = new SpecialRecipeSerializer<>(DuplicateNetworkChipRecipe::new);
|
public static final SpecialRecipeSerializer<DuplicateNetworkChipRecipe> DUPLICATE_NETWORK_CHIP_RECIPE = new SpecialRecipeSerializer<>(DuplicateNetworkChipRecipe::new);
|
||||||
|
|
||||||
|
public static final Material FIELD_MATERIAL = new Material.Builder(MaterialColor.CLEAR).build();
|
||||||
|
public static final Material BEAM_MATERIAL = new Material.Builder(MaterialColor.CLEAR).replaceable().build();
|
||||||
|
|
||||||
public static final ForcefieldBlock FORCEFIELD_BLOCK = new ForcefieldBlock();
|
public static final ForcefieldBlock FORCEFIELD_BLOCK = new ForcefieldBlock();
|
||||||
public static final ForcefieldProjectorBlock FORCEFIELD_PROJECTOR_BLOCK = new ForcefieldProjectorBlock();
|
public static final ForcefieldProjectorBlock FORCEFIELD_PROJECTOR_BLOCK = new ForcefieldProjectorBlock();
|
||||||
|
|
||||||
@ -97,6 +101,9 @@ public class EnergonRelics implements ModInitializer {
|
|||||||
public static final RepulsorBeamBlock REPULSOR_BEAM_BLOCK = new RepulsorBeamBlock();
|
public static final RepulsorBeamBlock REPULSOR_BEAM_BLOCK = new RepulsorBeamBlock();
|
||||||
public static final TractorBeamProjectorBlock TRACTOR_BEAM_PROJECTOR_BLOCK = new TractorBeamProjectorBlock();
|
public static final TractorBeamProjectorBlock TRACTOR_BEAM_PROJECTOR_BLOCK = new TractorBeamProjectorBlock();
|
||||||
|
|
||||||
|
public static final IndustrialLaserBlock INDUSTRIAL_LASER_BLOCK = new IndustrialLaserBlock();
|
||||||
|
public static final IndustrialLaserProjectorBlock INDUSTRIAL_LASER_PROJECTOR_BLOCK = new IndustrialLaserProjectorBlock();
|
||||||
|
|
||||||
private static final Identifier BEEP_SOUND_ID = new Identifier(NAMESPACE, "beep");
|
private static final Identifier BEEP_SOUND_ID = new Identifier(NAMESPACE, "beep");
|
||||||
private static final SoundEvent BEEP_SOUND_EVENT = new SoundEvent(BEEP_SOUND_ID);
|
private static final SoundEvent BEEP_SOUND_EVENT = new SoundEvent(BEEP_SOUND_ID);
|
||||||
|
|
||||||
@ -152,6 +159,9 @@ public class EnergonRelics implements ModInitializer {
|
|||||||
REPULSOR_BEAM_BLOCK.register("repulsor_beam");
|
REPULSOR_BEAM_BLOCK.register("repulsor_beam");
|
||||||
TRACTOR_BEAM_PROJECTOR_BLOCK.register("tractor_beam_projector");
|
TRACTOR_BEAM_PROJECTOR_BLOCK.register("tractor_beam_projector");
|
||||||
|
|
||||||
|
INDUSTRIAL_LASER_BLOCK.register("industrial_laser");
|
||||||
|
INDUSTRIAL_LASER_PROJECTOR_BLOCK.register("industrial_laser_projector");
|
||||||
|
|
||||||
Registry.register(Registry.SOUND_EVENT, BEEP_SOUND_ID, BEEP_SOUND_EVENT);
|
Registry.register(Registry.SOUND_EVENT, BEEP_SOUND_ID, BEEP_SOUND_EVENT);
|
||||||
|
|
||||||
CREATIVE_ENERGY_SOURCE_BLOCK.register("creative_energy_source");
|
CREATIVE_ENERGY_SOURCE_BLOCK.register("creative_energy_source");
|
||||||
|
@ -52,12 +52,12 @@ public class BlockBreakerBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
world.createExplosion(null, targetPos.getX() + 0.5d, targetPos.getY() + 0.5d, targetPos.getZ() + 0.5d, 0.5f, Explosion.DestructionType.NONE);
|
world.createExplosion(null, targetPos.getX() + 0.5d, targetPos.getY() + 0.5d, targetPos.getZ() + 0.5d, 0.5f, Explosion.DestructionType.NONE);
|
||||||
Block.dropStacks(target, world, targetPos, target.getBlock().hasBlockEntity() ? world.getBlockEntity(targetPos) : null, null, new ItemStack(HardcodedConfig.BLOCK_BREAKER_ITEM));
|
Block.dropStacks(target, world, targetPos, target.getBlock().hasBlockEntity() ? world.getBlockEntity(targetPos) : null, null, new ItemStack(HardcodedConfig.BLOCK_BREAKER_ITEM));
|
||||||
world.breakBlock(targetPos, false);
|
world.breakBlock(targetPos, false);
|
||||||
|
}, (world, pos, state) -> {}));
|
||||||
progress = 0;
|
progress = 0;
|
||||||
}, (world, pos, state) -> progress = 0));
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
progress++;
|
progress++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Rotation {
|
public static class Rotation {
|
||||||
private float yaw = 0;
|
private float yaw = 0;
|
||||||
private float pitch = 0;
|
private float pitch = 0;
|
||||||
private static final String KEY = "Rotation";
|
private static final String KEY = "Rotation";
|
||||||
@ -97,7 +97,6 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
|
|
||||||
private void change(float diffYaw, float diffPitch) {
|
private void change(float diffYaw, float diffPitch) {
|
||||||
setRaw(yaw + diffYaw, pitch + diffPitch);
|
setRaw(yaw + diffYaw, pitch + diffPitch);
|
||||||
markDirty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3d getRayVector() {
|
public Vec3d getRayVector() {
|
||||||
@ -254,6 +253,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ public class LightningRodBlockEntity extends EnergyProviderBlockEntity implement
|
|||||||
} else {
|
} else {
|
||||||
cooldown--;
|
cooldown--;
|
||||||
}
|
}
|
||||||
|
markDirty();
|
||||||
return super.startTick();
|
return super.startTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,5 +31,6 @@ public class BatteryCoreBlockEntity extends BlockEntity {
|
|||||||
|
|
||||||
void setEnergy(long value) {
|
void setEnergy(long value) {
|
||||||
energy = value;
|
energy = value;
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,18 @@ public class FieldProjectorBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
this.block = block;
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setLastBlock(BlockPos pos, BlockState lastState) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long getCost() {
|
||||||
|
return HardcodedConfig.FIELD_PROJECTOR_ENERGY_REQUIRED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void energyTick() {
|
protected void energyTick() {
|
||||||
assert getWorld() != null;
|
assert getWorld() != null;
|
||||||
|
|
||||||
addAction(Action.createBlockStatePropertyAction(HardcodedConfig.FIELD_PROJECTOR_ENERGY_REQUIRED, FieldProjectorBlock.POWERED, true, false));
|
addAction(Action.createBlockStatePropertyAction(getCost(), FieldProjectorBlock.POWERED, true, false));
|
||||||
if (getCachedState().get(FieldProjectorBlock.POWERED)) {
|
if (getCachedState().get(FieldProjectorBlock.POWERED)) {
|
||||||
Direction facing = getCachedState().get(FieldProjectorBlock.FACING);
|
Direction facing = getCachedState().get(FieldProjectorBlock.FACING);
|
||||||
BlockState state = block.apply(getCachedState()).getDefaultState().with(AbstractFieldBlock.FACING, facing);
|
BlockState state = block.apply(getCachedState()).getDefaultState().with(AbstractFieldBlock.FACING, facing);
|
||||||
@ -34,6 +41,7 @@ public class FieldProjectorBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
if (targetState.isAir() || (targetState != state && targetState.getBlock() instanceof AbstractFieldBlock && targetState.get(AbstractFieldBlock.FACING) == facing)) {
|
if (targetState.isAir() || (targetState != state && targetState.getBlock() instanceof AbstractFieldBlock && targetState.get(AbstractFieldBlock.FACING) == facing)) {
|
||||||
getWorld().setBlockState(targetPos, state);
|
getWorld().setBlockState(targetPos, state);
|
||||||
} else if (targetState != state) {
|
} else if (targetState != state) {
|
||||||
|
setLastBlock(targetPos, targetState);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.block.entity.forcefield;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.block.forcefield.IndustrialLaserProjectorBlock;
|
||||||
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.explosion.Explosion;
|
||||||
|
|
||||||
|
public class IndustrialLaserBlockEntity extends FieldProjectorBlockEntity {
|
||||||
|
private BlockPos targetPos;
|
||||||
|
private BlockState targetState;
|
||||||
|
private int progress = 0;
|
||||||
|
|
||||||
|
public IndustrialLaserBlockEntity(BlockEntityType<?> type) {
|
||||||
|
super(type, state -> EnergonRelics.INDUSTRIAL_LASER_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setLastBlock(BlockPos newPos, BlockState newState) {
|
||||||
|
if (!newPos.equals(targetPos) || targetState != newState) {
|
||||||
|
targetPos = newPos;
|
||||||
|
targetState = newState;
|
||||||
|
progress = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected long getCost() {
|
||||||
|
return HardcodedConfig.INDUSTRIAL_LASER_ENERGY_REQUIRED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void energyTick() {
|
||||||
|
super.energyTick();
|
||||||
|
|
||||||
|
if (getCachedState().get(IndustrialLaserProjectorBlock.POWERED) && targetState != null && targetPos != null && IndustrialLaserRegistry.has(targetState.getBlock())) {
|
||||||
|
assert getWorld() != null;
|
||||||
|
|
||||||
|
if (progress >= HardcodedConfig.INDUSTRIAL_LASER_BEAM_TIME) {
|
||||||
|
getWorld().createExplosion(null, targetPos.getX() + 0.5d, targetPos.getY() + 0.5d, targetPos.getZ() + 0.5d, 0.5f, Explosion.DestructionType.NONE);
|
||||||
|
Block.dropStack(getWorld(), targetPos, IndustrialLaserRegistry.get(targetState.getBlock(), getWorld().random));
|
||||||
|
getWorld().breakBlock(targetPos, false);
|
||||||
|
|
||||||
|
progress = 0;
|
||||||
|
} else {
|
||||||
|
Vec3d vec = Vec3d.ofCenter(targetPos);
|
||||||
|
|
||||||
|
((ServerWorld) getWorld()).spawnParticles(ParticleTypes.FLAME, vec.getX(), vec.getY(), vec.getZ(), 2, 0.3f, 0.3f, 0.3f, 0f);
|
||||||
|
|
||||||
|
progress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
markDirty();
|
||||||
|
} else if (progress != 0) {
|
||||||
|
progress = 0;
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
super.toTag(tag);
|
||||||
|
tag.putInt("Progress", progress);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromTag(BlockState state, CompoundTag tag) {
|
||||||
|
super.fromTag(state, tag);
|
||||||
|
progress = tag.getInt("Progress");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.block.entity.forcefield;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class IndustrialLaserRegistry {
|
||||||
|
private static final Map<Block, Function<Random, ItemStack>> map = new HashMap<>();
|
||||||
|
|
||||||
|
private static void add(Block ore, Item ingot, Block storage) {
|
||||||
|
map.put(ore, random -> {
|
||||||
|
int min = HardcodedConfig.INDUSTRIAL_LASER_MIN_INGOTS_FROM_ORE;
|
||||||
|
int max = HardcodedConfig.INDUSTRIAL_LASER_MAX_INGOTS_FROM_ORE;
|
||||||
|
|
||||||
|
int count = random.nextInt(max - min + 1) + min;
|
||||||
|
|
||||||
|
return new ItemStack(ingot, count);
|
||||||
|
});
|
||||||
|
map.put(storage, random -> new ItemStack(ingot, HardcodedConfig.INDUSTRIAL_LASER_INGOTS_FROM_STORAGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean has(Block block) {
|
||||||
|
return map.containsKey(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ItemStack get(Block block, Random random) {
|
||||||
|
return map.get(block).apply(random);
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
add(Blocks.IRON_ORE, Items.IRON_INGOT, Blocks.IRON_BLOCK);
|
||||||
|
add(Blocks.GOLD_ORE, Items.GOLD_INGOT, Blocks.GOLD_BLOCK);
|
||||||
|
add(Blocks.DIAMOND_ORE, Items.DIAMOND, Blocks.DIAMOND_BLOCK);
|
||||||
|
add(Blocks.EMERALD_ORE, Items.EMERALD, Blocks.EMERALD_BLOCK);
|
||||||
|
add(EnergonRelics.VERIDIUM_ORE_BLOCK, EnergonRelics.VERIDIUM_INGOT_ITEM, EnergonRelics.VERIDIUM_BLOCK_BLOCK);
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,10 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.reactor.ReactorControllerBlock;
|
import com.thebrokenrail.energonrelics.block.reactor.ReactorControllerBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyProviderBlockEntity;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
import com.thebrokenrail.energonrelics.energy.core.util.EnergyTickable;
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -33,12 +33,14 @@ public class ReactorCoreBlockEntity extends BlockEntity implements Tickable {
|
|||||||
|
|
||||||
void startReaction(float fuelMultiplier) {
|
void startReaction(float fuelMultiplier) {
|
||||||
reactionTime = (int) ((float) HardcodedConfig.REACTOR_TIME * fuelMultiplier);
|
reactionTime = (int) ((float) HardcodedConfig.REACTOR_TIME * fuelMultiplier);
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (reactionTime > 0) {
|
if (reactionTime > 0) {
|
||||||
reactionTime--;
|
reactionTime--;
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.block.forcefield;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.block.forcefield.util.AbstractFieldBlock;
|
||||||
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.ShapeContext;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class IndustrialLaserBlock extends AbstractFieldBlock {
|
||||||
|
public IndustrialLaserBlock() {
|
||||||
|
super(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockState getProjectorBlockState() {
|
||||||
|
return EnergonRelics.INDUSTRIAL_LASER_PROJECTOR_BLOCK.getDefaultState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
|
||||||
|
super.onEntityCollision(state, world, pos, entity);
|
||||||
|
|
||||||
|
if (entity instanceof LivingEntity) {
|
||||||
|
entity.damage(DamageSource.IN_FIRE, HardcodedConfig.INDUSTRIAL_LASER_BEAM_DAMAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||||
|
return VoxelShapes.empty();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.block.forcefield;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.block.entity.forcefield.IndustrialLaserBlockEntity;
|
||||||
|
import com.thebrokenrail.energonrelics.block.forcefield.util.FieldProjectorBlock;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class IndustrialLaserProjectorBlock extends FieldProjectorBlock {
|
||||||
|
public IndustrialLaserProjectorBlock() {
|
||||||
|
super(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Function<BlockEntityType<BlockEntity>, BlockEntity> getFactory() {
|
||||||
|
return IndustrialLaserBlockEntity::new;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.forcefield.util;
|
package com.thebrokenrail.energonrelics.block.forcefield.util;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
|
import com.thebrokenrail.energonrelics.block.entity.forcefield.FieldProjectorBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
||||||
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
@ -30,7 +31,7 @@ public abstract class AbstractFieldBlock extends SimpleBlock {
|
|||||||
public static final DirectionProperty FACING = Properties.FACING;
|
public static final DirectionProperty FACING = Properties.FACING;
|
||||||
|
|
||||||
public AbstractFieldBlock(boolean hasCollision) {
|
public AbstractFieldBlock(boolean hasCollision) {
|
||||||
super((hasCollision ? FabricBlockSettings.copy(Blocks.BARRIER) : FabricBlockSettings.copy(Blocks.BARRIER).noCollision()).dropsNothing().lightLevel(state -> 4).emissiveLighting((state, world, pos) -> true).nonOpaque().sounds(BlockSoundGroup.GLASS).allowsSpawning((state, world, pos, type) -> false).solidBlock((state, world, pos) -> false).suffocates((state, world, pos) -> false).blockVision((state, world, pos) -> false));
|
super((hasCollision ? FabricBlockSettings.of(EnergonRelics.FIELD_MATERIAL) : FabricBlockSettings.of(EnergonRelics.BEAM_MATERIAL).noCollision()).strength(-1.0F, 3600000.8F).dropsNothing().nonOpaque().lightLevel(4).emissiveLighting((state, world, pos) -> true).nonOpaque().sounds(BlockSoundGroup.GLASS).allowsSpawning((state, world, pos, type) -> false).solidBlock((state, world, pos) -> false).suffocates((state, world, pos) -> false).blockVision((state, world, pos) -> false));
|
||||||
setDefaultState(getDefaultState().with(FACING, Direction.NORTH));
|
setDefaultState(getDefaultState().with(FACING, Direction.NORTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ public class FieldProjectorBlock extends FacingEnergyBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Function<BlockEntityType<BlockEntity>, BlockEntity> getFactory() {
|
protected Function<BlockEntityType<BlockEntity>, BlockEntity> getFactory() {
|
||||||
|
if (block == null) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
return type -> new FieldProjectorBlockEntity(type, block);
|
return type -> new FieldProjectorBlockEntity(type, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ public class EnergonRelicsClient implements ClientModInitializer {
|
|||||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.FORCEFIELD_BLOCK, RenderLayer.getTranslucent());
|
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.FORCEFIELD_BLOCK, RenderLayer.getTranslucent());
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.TRACTOR_BEAM_BLOCK, RenderLayer.getTranslucent());
|
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.TRACTOR_BEAM_BLOCK, RenderLayer.getTranslucent());
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.REPULSOR_BEAM_BLOCK, RenderLayer.getTranslucent());
|
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.REPULSOR_BEAM_BLOCK, RenderLayer.getTranslucent());
|
||||||
|
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.INDUSTRIAL_LASER_BLOCK, RenderLayer.getTranslucent());
|
||||||
|
|
||||||
AutoConfig.register(UserConfig.class, ReloadSerializer::new);
|
AutoConfig.register(UserConfig.class, ReloadSerializer::new);
|
||||||
|
|
||||||
|
@ -28,11 +28,18 @@ public class HardcodedConfig {
|
|||||||
public static final double LIGHTNING_ROD_CHANCE = 0.00005d;
|
public static final double LIGHTNING_ROD_CHANCE = 0.00005d;
|
||||||
public static final int LIGHTNING_ROD_COOLDOWN = 5;
|
public static final int LIGHTNING_ROD_COOLDOWN = 5;
|
||||||
|
|
||||||
public static final long FIELD_PROJECTOR_ENERGY_REQUIRED = 64;
|
public static final long FIELD_PROJECTOR_ENERGY_REQUIRED = 31;
|
||||||
public static final int FIELD_MAX_SIZE = 12;
|
public static final int FIELD_MAX_SIZE = 12;
|
||||||
|
|
||||||
public static final double TRACTOR_BEAM_MOVEMENT_MULTIPLIER = 0.95d;
|
public static final double TRACTOR_BEAM_MOVEMENT_MULTIPLIER = 0.95d;
|
||||||
public static final double TRACTOR_BEAM_PULL_FORCE = 0.065d;
|
public static final double TRACTOR_BEAM_PULL_FORCE = 0.065d;
|
||||||
|
|
||||||
|
public static final float INDUSTRIAL_LASER_BEAM_DAMAGE = 1f;
|
||||||
|
public static final long INDUSTRIAL_LASER_ENERGY_REQUIRED = 58;
|
||||||
|
public static final int INDUSTRIAL_LASER_BEAM_TIME = 126;
|
||||||
|
public static final int INDUSTRIAL_LASER_MIN_INGOTS_FROM_ORE = 1;
|
||||||
|
public static final int INDUSTRIAL_LASER_MAX_INGOTS_FROM_ORE = 3;
|
||||||
|
public static final int INDUSTRIAL_LASER_INGOTS_FROM_STORAGE = 9;
|
||||||
|
|
||||||
public static final long HOLOGRAPHIC_SKY_ENERGY_REQUIRED = 15;
|
public static final long HOLOGRAPHIC_SKY_ENERGY_REQUIRED = 15;
|
||||||
}
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "energonrelics:block/industrial_laser"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=down,powered=false": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_off",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=down,powered=true": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_on",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=east,powered=false": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_off",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=east,powered=true": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_on",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=north,powered=false": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_off"
|
||||||
|
},
|
||||||
|
"facing=north,powered=true": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_on"
|
||||||
|
},
|
||||||
|
"facing=south,powered=false": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_off",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=south,powered=true": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_on",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=up,powered=false": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_off",
|
||||||
|
"x": 270
|
||||||
|
},
|
||||||
|
"facing=up,powered=true": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_on",
|
||||||
|
"x": 270
|
||||||
|
},
|
||||||
|
"facing=west,powered=false": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_off",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=west,powered=true": {
|
||||||
|
"model": "energonrelics:block/industrial_laser_projector_on",
|
||||||
|
"y": 270
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -41,5 +41,7 @@
|
|||||||
"block.energonrelics.holographic_sky": "Holographic Sky",
|
"block.energonrelics.holographic_sky": "Holographic Sky",
|
||||||
"block.energonrelics.tractor_beam_projector": "Tractor Beam Projector",
|
"block.energonrelics.tractor_beam_projector": "Tractor Beam Projector",
|
||||||
"block.energonrelics.tractor_beam": "Tractor Beam",
|
"block.energonrelics.tractor_beam": "Tractor Beam",
|
||||||
"block.energonrelics.repulsor_beam": "Repulsor Beam"
|
"block.energonrelics.repulsor_beam": "Repulsor Beam",
|
||||||
|
"block.energonrelics.industrial_laser_projector": "Industrial Laser Projector",
|
||||||
|
"block.energonrelics.industrial_laser": "Industrial Laser"
|
||||||
}
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "energonrelics:block/industrial_laser"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/orientable",
|
||||||
|
"textures": {
|
||||||
|
"top": "energonrelics:block/field_projector_side",
|
||||||
|
"front": "energonrelics:block/industrial_laser_projector_off",
|
||||||
|
"side": "energonrelics:block/field_projector_side"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/orientable",
|
||||||
|
"textures": {
|
||||||
|
"top": "energonrelics:block/field_projector_side",
|
||||||
|
"front": "energonrelics:block/industrial_laser_projector_on",
|
||||||
|
"side": "energonrelics:block/field_projector_side"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "energonrelics:block/industrial_laser_projector_off"
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 491 B |
Binary file not shown.
After Width: | Height: | Size: 723 B |
Binary file not shown.
After Width: | Height: | Size: 713 B |
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "energonrelics:industrial_laser_projector"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "energonrelics:tractor_beam_projector"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user