This commit is contained in:
parent
891f2c2fa8
commit
a53e0dbff8
@ -5,16 +5,16 @@ import com.thebrokenrail.energonrelics.block.CreativeEnergySourceBlock;
|
||||
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
|
||||
import com.thebrokenrail.energonrelics.block.HolographicSkyBlock;
|
||||
import com.thebrokenrail.energonrelics.block.LightningRodBlock;
|
||||
import com.thebrokenrail.energonrelics.block.VeridiumBlockBlock;
|
||||
import com.thebrokenrail.energonrelics.block.misc.VeridiumBlockBlock;
|
||||
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldBlock;
|
||||
import com.thebrokenrail.energonrelics.block.forcefield.ForcefieldProjectorBlock;
|
||||
import com.thebrokenrail.energonrelics.block.structure.StructureGeneratorBlock;
|
||||
import com.thebrokenrail.energonrelics.block.ThermalGlassBlock;
|
||||
import com.thebrokenrail.energonrelics.block.misc.ThermalGlassBlock;
|
||||
import com.thebrokenrail.energonrelics.block.battery.ActiveBatteryControllerBlock;
|
||||
import com.thebrokenrail.energonrelics.block.reactor.ReactorControllerBlock;
|
||||
import com.thebrokenrail.energonrelics.block.reactor.ReactorCoreBlock;
|
||||
import com.thebrokenrail.energonrelics.block.reactor.ReactorInputBlock;
|
||||
import com.thebrokenrail.energonrelics.block.ThermalCasingBlock;
|
||||
import com.thebrokenrail.energonrelics.block.misc.ThermalCasingBlock;
|
||||
import com.thebrokenrail.energonrelics.block.battery.PassiveBatteryControllerBlock;
|
||||
import com.thebrokenrail.energonrelics.block.battery.BatteryCoreBlock;
|
||||
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.BlockBreakerBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -17,7 +17,7 @@ import net.minecraft.world.WorldAccess;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockBreakerBlock extends FacingEnergyProviderBlock {
|
||||
public class BlockBreakerBlock extends FacingEnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
|
||||
public BlockBreakerBlock() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.CreativeEnergySourceBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
@ -9,7 +9,7 @@ import net.minecraft.block.entity.BlockEntityType;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class CreativeEnergySourceBlock extends EnergyProviderBlock {
|
||||
public class CreativeEnergySourceBlock extends EnergyBlock {
|
||||
public CreativeEnergySourceBlock() {
|
||||
super(FabricBlockSettings.copy(Blocks.BEDROCK).dropsNothing());
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.DefensiveLaserBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import com.thebrokenrail.energonrelics.client.block.entity.render.DefensiveLaserBlockEntityRenderer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
@ -26,7 +26,7 @@ import net.minecraft.world.BlockView;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DefensiveLaserBlock extends EnergyProviderBlock {
|
||||
public class DefensiveLaserBlock extends EnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
|
||||
public DefensiveLaserBlock() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.EnergonLightBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -15,7 +15,7 @@ import net.minecraft.state.property.Properties;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class EnergonLightBlock extends EnergyProviderBlock {
|
||||
public class EnergonLightBlock extends EnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
|
||||
public EnergonLightBlock() {
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.HolographicSkyBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.client.block.entity.render.DefensiveLaserBlockEntityRenderer;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import com.thebrokenrail.energonrelics.client.block.entity.render.HolographicSkyBlockEntityRenderer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
@ -29,7 +28,7 @@ import net.minecraft.world.BlockView;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class HolographicSkyBlock extends EnergyProviderBlock {
|
||||
public class HolographicSkyBlock extends EnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
public static final IntProperty LIGHT_LEVEL = IntProperty.of("light_level", 0, 15);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.LightningRodBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
@ -19,7 +19,7 @@ import net.minecraft.world.BlockView;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class LightningRodBlock extends EnergyProviderBlock {
|
||||
public class LightningRodBlock extends EnergyBlock {
|
||||
public LightningRodBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE, MaterialColor.BLUE_TERRACOTTA).nonOpaque().allowsSpawning((state, world, pos, type) -> false).solidBlock((state, world, pos) -> false).suffocates((state, world, pos) -> false).emissiveLighting((state, world, pos) -> true).lightLevel(10).requiresTool().strength(1.5f, 6.0f).blockVision((state, world, pos) -> false));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.SolarPanelBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
@ -11,7 +11,7 @@ import net.minecraft.sound.BlockSoundGroup;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SolarPanelBlock extends EnergyProviderBlock {
|
||||
public class SolarPanelBlock extends EnergyBlock {
|
||||
public SolarPanelBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE, MaterialColor.BLUE_TERRACOTTA).sounds(BlockSoundGroup.GLASS).requiresTool().strength(1.5f, 6.0f));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.SwitchBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -20,7 +20,7 @@ import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SwitchBlock extends EnergyProviderBlock {
|
||||
public class SwitchBlock extends EnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
|
||||
public SwitchBlock() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block.battery;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.battery.ActiveBatteryControllerBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
@ -10,7 +10,7 @@ import net.minecraft.block.entity.BlockEntityType;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ActiveBatteryControllerBlock extends FacingEnergyProviderBlock {
|
||||
public class ActiveBatteryControllerBlock extends FacingEnergyBlock {
|
||||
public ActiveBatteryControllerBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE, MaterialColor.ORANGE_TERRACOTTA).requiresTool().strength(1.5f, 6.0f));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block.battery;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.battery.PassiveBatteryControllerBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
@ -10,7 +10,7 @@ import net.minecraft.block.entity.BlockEntityType;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PassiveBatteryControllerBlock extends FacingEnergyProviderBlock {
|
||||
public class PassiveBatteryControllerBlock extends FacingEnergyBlock {
|
||||
public PassiveBatteryControllerBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE, MaterialColor.RED_TERRACOTTA).requiresTool().strength(1.5f, 6.0f));
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ public class PassiveBatteryControllerBlockEntity extends EnergyReceiverBlockEnti
|
||||
battery.setEnergy(battery.getEnergy() + amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block.forcefield;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.forcefield.ForcefieldProjectorBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -14,7 +14,7 @@ import net.minecraft.state.property.Properties;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ForcefieldProjectorBlock extends FacingEnergyProviderBlock {
|
||||
public class ForcefieldProjectorBlock extends FacingEnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
|
||||
public ForcefieldProjectorBlock() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
package com.thebrokenrail.energonrelics.block.misc;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
@ -1,4 +1,4 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
package com.thebrokenrail.energonrelics.block.misc;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
||||
import net.fabricmc.api.EnvType;
|
@ -1,4 +1,4 @@
|
||||
package com.thebrokenrail.energonrelics.block;
|
||||
package com.thebrokenrail.energonrelics.block.misc;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.block.reactor;
|
||||
|
||||
import com.thebrokenrail.energonrelics.block.entity.reactor.ReactorControllerBlockEntity;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.FacingEnergyBlock;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -22,7 +22,7 @@ import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ReactorControllerBlock extends FacingEnergyProviderBlock {
|
||||
public class ReactorControllerBlock extends FacingEnergyBlock {
|
||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||
|
||||
public ReactorControllerBlock() {
|
||||
|
@ -25,10 +25,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class EnergyProviderBlock extends SimpleBlockWithEntity {
|
||||
private static final List<EnergyProviderBlock> blocks = new ArrayList<>();
|
||||
public abstract class EnergyBlock extends SimpleBlockWithEntity {
|
||||
private static final List<EnergyBlock> blocks = new ArrayList<>();
|
||||
|
||||
public EnergyProviderBlock(Settings settings) {
|
||||
public EnergyBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public abstract class EnergyProviderBlock extends SimpleBlockWithEntity {
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public static void initRenderer() {
|
||||
for (EnergyProviderBlock block : blocks) {
|
||||
for (EnergyBlock block : blocks) {
|
||||
BlockEntityRendererRegistry.INSTANCE.register(block.type, block.getRenderer());
|
||||
}
|
||||
}
|
@ -11,10 +11,10 @@ import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class FacingEnergyProviderBlock extends EnergyProviderBlock {
|
||||
public abstract class FacingEnergyBlock extends EnergyBlock {
|
||||
public static final DirectionProperty FACING = Properties.FACING;
|
||||
|
||||
public FacingEnergyProviderBlock(Settings settings) {
|
||||
public FacingEnergyBlock(Settings settings) {
|
||||
super(settings);
|
||||
setDefaultState(getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.thebrokenrail.energonrelics.client;
|
||||
|
||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyProviderBlock;
|
||||
import com.thebrokenrail.energonrelics.block.util.energy.EnergyBlock;
|
||||
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||
@ -36,7 +36,7 @@ public class EnergonRelicsClient implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
EnergyProviderBlock.initRenderer();
|
||||
EnergyBlock.initRenderer();
|
||||
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.THERMAL_GLASS_BLOCK, RenderLayer.getCutout());
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.DEFENSIVE_LASER_BLOCK, RenderLayer.getCutout());
|
||||
|
@ -40,6 +40,8 @@ public abstract class EnergyReceiverBlockEntity extends EnergyProviderBlockEntit
|
||||
} else {
|
||||
action.pay(0);
|
||||
}
|
||||
|
||||
action.finish();
|
||||
}
|
||||
|
||||
protected void addAction(Action action) {
|
||||
|
@ -37,6 +37,7 @@ public class Action {
|
||||
void expandPayments(int amount);
|
||||
long amountOwed();
|
||||
void pay(long amount);
|
||||
void finish();
|
||||
}
|
||||
|
||||
public static class PropagatedActionImpl implements PropagatedAction {
|
||||
@ -81,5 +82,12 @@ public class Action {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
if (payments < expectedPayments) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"#G#",
|
||||
"GBG",
|
||||
"#G#"
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "energonrelics:circuit_board"
|
||||
},
|
||||
"G": {
|
||||
"item": "minecraft:glass"
|
||||
},
|
||||
"B": {
|
||||
"item": "minecraft:blaze_powder"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "energonrelics:holographic_sky",
|
||||
"count": 2
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"G V",
|
||||
"I#I",
|
||||
" I "
|
||||
],
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "energonrelics:circuit_board"
|
||||
},
|
||||
"I": {
|
||||
"item": "minecraft:iron_ingot"
|
||||
},
|
||||
"G": {
|
||||
"item": "minecraft:gold_ingot"
|
||||
},
|
||||
"V": {
|
||||
"item": "energonrelics:veridium_ingot"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "energonrelics:multimeter",
|
||||
"count": 1
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user