Add PoeticRainbow Texture Set
@ -1,3 +1,5 @@
|
|||||||
|
![Poster](images/poster.png)
|
||||||
|
|
||||||
# EnergonRelics
|
# EnergonRelics
|
||||||
TBD
|
TBD
|
||||||
|
|
||||||
@ -5,4 +7,5 @@ TBD
|
|||||||
[View Changelog](CHANGELOG.md)
|
[View Changelog](CHANGELOG.md)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
- ``@PoeticRainbow#5928`` on Discord For The Logo
|
- ``@PoeticRainbow#5928`` on Discord For The Logo And Poster
|
||||||
|
- ``@PoeticRainbow#5928`` on Discord For Their Texture Set
|
24
TODO
@ -1,24 +0,0 @@
|
|||||||
Network Chips:
|
|
||||||
- Contain a Network ID In NBT
|
|
||||||
- When Held, Highlights Supported Blocks
|
|
||||||
- When Right-Cliking On A Supported-Block Add it To The Network
|
|
||||||
Energy Recievers:
|
|
||||||
- Conatin network ID(s)
|
|
||||||
- Requests a certain amount of power every tick
|
|
||||||
- Spreads out power ewuest over all networks
|
|
||||||
- Chunk loads unloaded networks
|
|
||||||
- No energy transfer speed restrictions
|
|
||||||
Energy Providers:
|
|
||||||
- Contaisn Network Chip
|
|
||||||
- Can only provide power to recievers within 60 blocks
|
|
||||||
- Can be an energy reciever
|
|
||||||
Battery:
|
|
||||||
- Surrounded on all but one sides by Battery casing, last side covered by battery controller
|
|
||||||
- Energy reiever for charging
|
|
||||||
- Energy prvodier for usage
|
|
||||||
- Highlight covers entire multi-block
|
|
||||||
Reactor:
|
|
||||||
- Temporary battery
|
|
||||||
- Refreshes battery every 10 ticks, no fuel set battery to 0, if fuel fill battery
|
|
||||||
|
|
||||||
On each tick an energy receiver can add an "action", an action has a success function, a fail function, and a cost, the action is propagated up to the energy provider, which will either execute the success function and deduct the energy amount, or execute the fail function.
|
|
Before Width: | Height: | Size: 530 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 634 B |
Before Width: | Height: | Size: 527 B |
12
build.gradle
@ -16,9 +16,17 @@ minecraft {
|
|||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_build}:v2"
|
mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_build}:v2"
|
||||||
modCompile "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
|
||||||
|
|
||||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
||||||
|
|
||||||
|
modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
|
||||||
|
|
||||||
|
modImplementation "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
|
||||||
|
include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
|
||||||
|
|
||||||
|
modImplementation "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}"
|
||||||
|
include "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
@ -14,3 +14,6 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_api_version = 0.14.6+build.377-1.16
|
fabric_api_version = 0.14.6+build.377-1.16
|
||||||
|
modmenu_version = 1.14.5+build.30
|
||||||
|
cloth_config_version = 4.6.0
|
||||||
|
autoconfig_version = 3.2.0-unstable
|
||||||
|
@ -13,8 +13,11 @@ import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
|||||||
import com.thebrokenrail.energonrelics.block.SolarPanelBlock;
|
import com.thebrokenrail.energonrelics.block.SolarPanelBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.SwitchBlock;
|
import com.thebrokenrail.energonrelics.block.SwitchBlock;
|
||||||
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
import com.thebrokenrail.energonrelics.block.util.SimpleBlock;
|
||||||
|
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
||||||
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
import com.thebrokenrail.energonrelics.item.MultimeterItem;
|
||||||
import com.thebrokenrail.energonrelics.item.NetworkChipItem;
|
import com.thebrokenrail.energonrelics.item.NetworkChipItem;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
||||||
import net.fabricmc.api.ModInitializer;
|
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;
|
||||||
|
@ -26,7 +26,7 @@ public class DefensiveLaserBlock extends EnergyProviderBlock {
|
|||||||
public static final BooleanProperty POWERED = Properties.POWERED;
|
public static final BooleanProperty POWERED = Properties.POWERED;
|
||||||
|
|
||||||
public DefensiveLaserBlock() {
|
public DefensiveLaserBlock() {
|
||||||
super(FabricBlockSettings.of(Material.GLASS, MaterialColor.BLACK).requiresTool().strength(50.0F, 1200.0F));
|
super(FabricBlockSettings.of(Material.GLASS, MaterialColor.BLACK).requiresTool().strength(50.0F, 1200.0F).nonOpaque().allowsSpawning((state, world, pos, type) -> false).solidBlock((state, world, pos) -> false).suffocates((state, world, pos) -> false).lightLevel(state -> state.get(POWERED) ? 7 : 0));
|
||||||
setDefaultState(getDefaultState().with(POWERED, false));
|
setDefaultState(getDefaultState().with(POWERED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
|
import com.thebrokenrail.energonrelics.block.DefensiveLaserBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
||||||
@ -157,7 +157,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
|
|
||||||
private Predicate<LivingEntity> getTargetPredicate(boolean useCurrentRotation) {
|
private Predicate<LivingEntity> getTargetPredicate(boolean useCurrentRotation) {
|
||||||
return entity -> {
|
return entity -> {
|
||||||
if (entity.isAlive() && (!(entity instanceof PlayerEntity) || !((PlayerEntity) entity).isCreative()) && !entity.isInvisible() && entity.getPos().distanceTo(getPosVec()) <= Config.DEFENSIVE_LASER_RANGE) {
|
if (entity.isAlive() && (!(entity instanceof PlayerEntity) || !((PlayerEntity) entity).isCreative()) && !entity.isInvisible() && entity.getPos().distanceTo(getPosVec()) <= HardcodedConfig.DEFENSIVE_LASER_RANGE) {
|
||||||
Vec3d entityPos = entity.getPos();
|
Vec3d entityPos = entity.getPos();
|
||||||
Vec3d start;
|
Vec3d start;
|
||||||
if (useCurrentRotation) {
|
if (useCurrentRotation) {
|
||||||
@ -174,7 +174,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<LivingEntity> getEntities(Predicate<LivingEntity> predicate) {
|
private List<LivingEntity> getEntities(Predicate<LivingEntity> predicate) {
|
||||||
return Objects.requireNonNull(getWorld()).getEntitiesByClass(LivingEntity.class, new Box(getPos()).expand(Config.DEFENSIVE_LASER_RANGE), predicate);
|
return Objects.requireNonNull(getWorld()).getEntitiesByClass(LivingEntity.class, new Box(getPos()).expand(HardcodedConfig.DEFENSIVE_LASER_RANGE), predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Entity getDummyEntity() {
|
private Entity getDummyEntity() {
|
||||||
@ -187,7 +187,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
Vec3d posVec = getPosVec(pos);
|
Vec3d posVec = getPosVec(pos);
|
||||||
Vec3d collision = null;
|
Vec3d collision = null;
|
||||||
for (LivingEntity entity : entities) {
|
for (LivingEntity entity : entities) {
|
||||||
Optional<Vec3d> optional = entity.getBoundingBox().rayTrace(posVec, posVec.add(rotation.getRayVector().multiply(Config.DEFENSIVE_LASER_RANGE)));
|
Optional<Vec3d> optional = entity.getBoundingBox().rayTrace(posVec, posVec.add(rotation.getRayVector().multiply(HardcodedConfig.DEFENSIVE_LASER_RANGE)));
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
Vec3d vec = optional.get();
|
Vec3d vec = optional.get();
|
||||||
if (collision == null || vec.distanceTo(posVec) < collision.distanceTo(posVec)) {
|
if (collision == null || vec.distanceTo(posVec) < collision.distanceTo(posVec)) {
|
||||||
@ -198,7 +198,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
|
|
||||||
Vec3d rotationVec = rotation.getRayVector();
|
Vec3d rotationVec = rotation.getRayVector();
|
||||||
Vec3d start = rotationVec.add(posVec);
|
Vec3d start = rotationVec.add(posVec);
|
||||||
Vec3d end = rotationVec.multiply(Config.DEFENSIVE_LASER_RANGE).add(posVec);
|
Vec3d end = rotationVec.multiply(HardcodedConfig.DEFENSIVE_LASER_RANGE).add(posVec);
|
||||||
HitResult result = world.rayTrace(new RayTraceContext(start, end, RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.ANY, getDummyEntity()));
|
HitResult result = world.rayTrace(new RayTraceContext(start, end, RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.ANY, getDummyEntity()));
|
||||||
if (result.getType() != HitResult.Type.MISS && (collision == null || result.getPos().distanceTo(posVec) < collision.distanceTo(posVec))) {
|
if (result.getType() != HitResult.Type.MISS && (collision == null || result.getPos().distanceTo(posVec) < collision.distanceTo(posVec))) {
|
||||||
collision = result.getPos();
|
collision = result.getPos();
|
||||||
@ -206,31 +206,31 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
|
|
||||||
double distance;
|
double distance;
|
||||||
if (collision != null) {
|
if (collision != null) {
|
||||||
world.createExplosion(null, collision.getX(), collision.getY(), collision.getZ(), 1, Explosion.DestructionType.NONE);
|
world.createExplosion(null, collision.getX(), collision.getY(), collision.getZ(), 2f, Explosion.DestructionType.NONE);
|
||||||
|
|
||||||
distance = posVec.distanceTo(collision);
|
distance = posVec.distanceTo(collision);
|
||||||
} else {
|
} else {
|
||||||
distance = Config.DEFENSIVE_LASER_RANGE;
|
distance = HardcodedConfig.DEFENSIVE_LASER_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
double multiplier = 6d;
|
double multiplier = 4d;
|
||||||
distance = distance * multiplier;
|
distance = distance * multiplier;
|
||||||
for (int i = 0; i < distance; i++) {
|
for (int i = 0; i < distance; i++) {
|
||||||
Vec3d vec = rotationVec.multiply(i / multiplier).add(posVec);
|
Vec3d vec = rotationVec.multiply(i / multiplier).add(posVec);
|
||||||
((ServerWorld) world).spawnParticles(ParticleTypes.END_ROD, vec.getX(), vec.getY(), vec.getZ(), 1, 0, 0, 0, 0.1f);
|
((ServerWorld) world).spawnParticles(ParticleTypes.END_ROD, vec.getX(), vec.getY(), vec.getZ(), 1, 0, 0, 0, 0.4f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tickEnergy() {
|
protected void tickEnergy() {
|
||||||
assert getWorld() != null;
|
assert getWorld() != null;
|
||||||
addAction(Action.createBlockStatePropertyAction(Config.DEFENSIVE_LASER_IDLE_ENERGY_REQUIRED, DefensiveLaserBlock.POWERED, true, false));
|
addAction(Action.createBlockStatePropertyAction(HardcodedConfig.DEFENSIVE_LASER_IDLE_ENERGY_REQUIRED, DefensiveLaserBlock.POWERED, true, false));
|
||||||
if (getCachedState().get(DefensiveLaserBlock.POWERED)) {
|
if (getCachedState().get(DefensiveLaserBlock.POWERED)) {
|
||||||
if (countdown > 0) {
|
if (countdown > 0) {
|
||||||
countdown--;
|
countdown--;
|
||||||
}
|
}
|
||||||
if (countdown == 1) {
|
if (countdown == 1) {
|
||||||
addAction(new Action(Config.DEFENSIVE_LASER_FIRE_ENERGY_REQUIRED, (world, pos, state) -> {
|
addAction(new Action(HardcodedConfig.DEFENSIVE_LASER_FIRE_ENERGY_REQUIRED, (world, pos, state) -> {
|
||||||
firing = false;
|
firing = false;
|
||||||
fire(world, pos);
|
fire(world, pos);
|
||||||
}, (world, pos, state) -> firing = false));
|
}, (world, pos, state) -> firing = false));
|
||||||
@ -246,7 +246,7 @@ public class DefensiveLaserBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getTargetPredicate(false).test(target)) {
|
if (getTargetPredicate(false).test(target)) {
|
||||||
Optional<Vec3d> optional = target.getBoundingBox().rayTrace(getPosVec(), getPosVec().add(rotation.getRayVector().multiply(Config.DEFENSIVE_LASER_RANGE)));
|
Optional<Vec3d> optional = target.getBoundingBox().rayTrace(getPosVec(), getPosVec().add(rotation.getRayVector().multiply(HardcodedConfig.DEFENSIVE_LASER_RANGE)));
|
||||||
if (optional.isPresent() && getTargetPredicate(true).test(target)) {
|
if (optional.isPresent() && getTargetPredicate(true).test(target)) {
|
||||||
countdown = COUNTDOWN;
|
countdown = COUNTDOWN;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
import com.thebrokenrail.energonrelics.block.EnergonLightBlock;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
||||||
@ -13,6 +13,6 @@ public class EnergonLightBlockEntity extends EnergyReceiverBlockEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tickEnergy() {
|
protected void tickEnergy() {
|
||||||
addAction(Action.createBlockStatePropertyAction(Config.ENERGON_LIGHT_ENERGY_REQUIRED, EnergonLightBlock.POWERED, true, false));
|
addAction(Action.createBlockStatePropertyAction(HardcodedConfig.ENERGON_LIGHT_ENERGY_REQUIRED, EnergonLightBlock.POWERED, true, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity;
|
package com.thebrokenrail.energonrelics.block.entity;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
import com.thebrokenrail.energonrelics.energy.helper.EnergyGeneratorBlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
@ -30,7 +30,7 @@ public class SolarPanelBlockEntity extends EnergyGeneratorBlockEntity {
|
|||||||
public long getDisplayEnergy() {
|
public long getDisplayEnergy() {
|
||||||
if (hasWorld() && Objects.requireNonNull(getWorld()).getDimension().hasSkyLight()) {
|
if (hasWorld() && Objects.requireNonNull(getWorld()).getDimension().hasSkyLight()) {
|
||||||
int light = getLight();
|
int light = getLight();
|
||||||
return (long) ((float) Config.SOLAR_PANEL_MAX_ENERGY_OUTPUT * ((float) light / 15f));
|
return (long) ((float) HardcodedConfig.SOLAR_PANEL_MAX_ENERGY_OUTPUT * ((float) light / 15f));
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.battery;
|
package com.thebrokenrail.energonrelics.block.entity.battery;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
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.energy.core.EnergyReceiverBlockEntity;
|
import com.thebrokenrail.energonrelics.energy.core.EnergyReceiverBlockEntity;
|
||||||
@ -48,7 +48,7 @@ public class PassiveBatteryControllerBlockEntity extends EnergyReceiverBlockEnti
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tickEnergy() {
|
protected void tickEnergy() {
|
||||||
long charge = Config.BATTERY_CHARGE_RATE;
|
long charge = HardcodedConfig.BATTERY_CHARGE_RATE;
|
||||||
if (!isActiveController()) {
|
if (!isActiveController()) {
|
||||||
addAction(new Action(charge, (world, pos, state) -> {
|
addAction(new Action(charge, (world, pos, state) -> {
|
||||||
BlockEntity entity = world.getBlockEntity(pos);
|
BlockEntity entity = world.getBlockEntity(pos);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
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;
|
||||||
@ -55,9 +55,13 @@ public class ReactorControllerBlockEntity extends EnergyGeneratorBlockEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getDisplayEnergy() {
|
public long getDisplayEnergy() {
|
||||||
Reactor reactor = getReactor();
|
if (getCachedState().get(ReactorControllerBlock.POWERED)) {
|
||||||
if (reactor != null && reactor.core.isReacting()) {
|
Reactor reactor = getReactor();
|
||||||
return Config.REACTOR_ENERGY_OUTPUT;
|
if (reactor != null && reactor.core.isReacting()) {
|
||||||
|
return HardcodedConfig.REACTOR_ENERGY_OUTPUT;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
package com.thebrokenrail.energonrelics.block.entity.reactor;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
@ -32,7 +32,7 @@ public class ReactorCoreBlockEntity extends BlockEntity implements Tickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void startReaction() {
|
void startReaction() {
|
||||||
reactionTime = Config.REACTOR_TIME;
|
reactionTime = HardcodedConfig.REACTOR_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,18 +2,42 @@ package com.thebrokenrail.energonrelics.client;
|
|||||||
|
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.block.util.EnergyProviderBlock;
|
import com.thebrokenrail.energonrelics.block.util.EnergyProviderBlock;
|
||||||
|
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class EnergonRelicsClient implements ClientModInitializer {
|
public class EnergonRelicsClient implements ClientModInitializer {
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
private static class ReloadSerializer<T extends ConfigData> extends GsonConfigSerializer<T> {
|
||||||
|
public ReloadSerializer(Config definition, Class<T> configClass) {
|
||||||
|
super(definition, configClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(T config) throws SerializationException {
|
||||||
|
super.serialize(config);
|
||||||
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
if (client.getResourceManager() != null) {
|
||||||
|
client.reloadResources();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
EnergyProviderBlock.initRenderer();
|
EnergyProviderBlock.initRenderer();
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.THERMAL_GLASS_BLOCK, RenderLayer.getCutout());
|
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.THERMAL_GLASS_BLOCK, RenderLayer.getCutout());
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.DEFENSIVE_LASER_BLOCK, RenderLayer.getCutout());
|
BlockRenderLayerMap.INSTANCE.putBlock(EnergonRelics.DEFENSIVE_LASER_BLOCK, RenderLayer.getCutout());
|
||||||
|
|
||||||
|
AutoConfig.register(UserConfig.class, ReloadSerializer::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.client;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
||||||
|
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||||
|
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class ModMenu implements ModMenuApi {
|
||||||
|
@Override
|
||||||
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
|
return screen -> AutoConfig.getConfigScreen(UserConfig.class, screen).get();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.client.config;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
@Config(name = EnergonRelics.NAMESPACE)
|
||||||
|
public class UserConfig implements ConfigData {
|
||||||
|
public enum TextureSet {
|
||||||
|
TheBrokenRail,
|
||||||
|
PoeticRainbow;
|
||||||
|
|
||||||
|
public String namespace() {
|
||||||
|
return EnergonRelics.NAMESPACE + '-' + name().toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextureSet textureSet = TextureSet.TheBrokenRail;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics;
|
package com.thebrokenrail.energonrelics.config;
|
||||||
|
|
||||||
public class Config {
|
public class HardcodedConfig {
|
||||||
public static final int POWER_RANGE = 64;
|
public static final int POWER_RANGE = 64;
|
||||||
|
|
||||||
public static final int ENERGON_LIGHT_ENERGY_REQUIRED = 5;
|
public static final int ENERGON_LIGHT_ENERGY_REQUIRED = 5;
|
||||||
@ -12,7 +12,7 @@ public class Config {
|
|||||||
public static final int REACTOR_TIME = 2400;
|
public static final int REACTOR_TIME = 2400;
|
||||||
public static final int REACTOR_ENERGY_OUTPUT = 250;
|
public static final int REACTOR_ENERGY_OUTPUT = 250;
|
||||||
|
|
||||||
public static final int DEFENSIVE_LASER_RANGE = 18;
|
public static final int DEFENSIVE_LASER_RANGE = 28;
|
||||||
public static final int DEFENSIVE_LASER_IDLE_ENERGY_REQUIRED = 32;
|
public static final int DEFENSIVE_LASER_IDLE_ENERGY_REQUIRED = 32;
|
||||||
public static final int DEFENSIVE_LASER_FIRE_ENERGY_REQUIRED = 64;
|
public static final int DEFENSIVE_LASER_FIRE_ENERGY_REQUIRED = 64;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.thebrokenrail.energonrelics.energy.core;
|
package com.thebrokenrail.energonrelics.energy.core;
|
||||||
|
|
||||||
import com.thebrokenrail.energonrelics.Config;
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||||||
import com.thebrokenrail.energonrelics.EnergonRelics;
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
import com.thebrokenrail.energonrelics.component.NetworkComponent;
|
||||||
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
import com.thebrokenrail.energonrelics.energy.core.util.Action;
|
||||||
@ -55,7 +55,7 @@ public class EnergyProviderBlockEntity extends BlockEntity implements EnergyProv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isWithinDistance(Vec3d pos) {
|
public final boolean isWithinDistance(Vec3d pos) {
|
||||||
return getPos().isWithinDistance(pos, Config.POWER_RANGE);
|
return getPos().isWithinDistance(pos, HardcodedConfig.POWER_RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack stack = ItemStack.EMPTY;
|
private ItemStack stack = ItemStack.EMPTY;
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.thebrokenrail.energonrelics.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||||||
|
import com.thebrokenrail.energonrelics.client.config.UserConfig;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.resource.AbstractFileResourcePack;
|
||||||
|
import net.minecraft.resource.ResourceType;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
@Mixin(AbstractFileResourcePack.class)
|
||||||
|
public class MixinAbstractFileResourcePack {
|
||||||
|
@Inject(at = @At("HEAD"), method = "open", cancellable = true)
|
||||||
|
public void injectOpen(ResourceType type, Identifier id, CallbackInfoReturnable<InputStream> info) {
|
||||||
|
if (id.getNamespace().equals(EnergonRelics.NAMESPACE)) {
|
||||||
|
try {
|
||||||
|
Identifier newID = new Identifier(AutoConfig.getConfigHolder(UserConfig.class).getConfig().textureSet.namespace(), id.getPath());
|
||||||
|
InputStream in = ((AbstractFileResourcePack) (Object) this).open(type, newID);
|
||||||
|
if (in != null) {
|
||||||
|
info.setReturnValue(in);
|
||||||
|
}
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("HEAD"), method = "contains", cancellable = true)
|
||||||
|
public void injectContains(ResourceType type, Identifier id, CallbackInfoReturnable<Boolean> info) {
|
||||||
|
if (id.getNamespace().equals(EnergonRelics.NAMESPACE)) {
|
||||||
|
Identifier newID = new Identifier(AutoConfig.getConfigHolder(UserConfig.class).getConfig().textureSet.namespace(), id.getPath());
|
||||||
|
boolean out = ((AbstractFileResourcePack) (Object) this).contains(type, newID);
|
||||||
|
if (out) {
|
||||||
|
info.setReturnValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/orientable",
|
||||||
|
"textures": {
|
||||||
|
"top": "energonrelics:block/thermal_casing",
|
||||||
|
"front": "energonrelics:block/active_battery_controller",
|
||||||
|
"side": "energonrelics:block/thermal_casing"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/orientable",
|
||||||
|
"textures": {
|
||||||
|
"top": "energonrelics:block/thermal_casing",
|
||||||
|
"front": "energonrelics:block/passive_battery_controller",
|
||||||
|
"side": "energonrelics:block/thermal_casing"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/orientable",
|
||||||
|
"textures": {
|
||||||
|
"top": "energonrelics:block/thermal_casing",
|
||||||
|
"front": "energonrelics:block/reactor_controller",
|
||||||
|
"side": "energonrelics:block/thermal_casing"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/orientable",
|
||||||
|
"textures": {
|
||||||
|
"top": "energonrelics:block/thermal_casing",
|
||||||
|
"front": "energonrelics:block/reactor_controller",
|
||||||
|
"side": "energonrelics:block/thermal_casing"
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 514 B |
After Width: | Height: | Size: 549 B |
After Width: | Height: | Size: 525 B |
After Width: | Height: | Size: 525 B |
After Width: | Height: | Size: 595 B |
After Width: | Height: | Size: 578 B |
After Width: | Height: | Size: 261 B |
After Width: | Height: | Size: 426 B |
@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"powered=false": {
|
||||||
"model": "energonrelics:block/defensive_laser"
|
"model": "energonrelics:block/defensive_laser_off"
|
||||||
|
},
|
||||||
|
"powered=true": {
|
||||||
|
"model": "energonrelics:block/defensive_laser_on"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,5 +21,7 @@
|
|||||||
"block.energonrelics.veridium_ore": "Veridium Ore",
|
"block.energonrelics.veridium_ore": "Veridium Ore",
|
||||||
"block.energonrelics.veridium_block": "Veridium Block",
|
"block.energonrelics.veridium_block": "Veridium Block",
|
||||||
"item.energonrelics.defensive_laser_core": "Defensive laser Core",
|
"item.energonrelics.defensive_laser_core": "Defensive laser Core",
|
||||||
"block.energonrelics.defensive_laser": "Defensive Laser"
|
"block.energonrelics.defensive_laser": "Defensive Laser",
|
||||||
|
"text.autoconfig.energonrelics.title": "EnergonRelics",
|
||||||
|
"text.autoconfig.energonrelics.option.textureSet": "Texture Set"
|
||||||
}
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "energonrelics:block/defensive_laser_off"
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/cube_all",
|
"parent": "minecraft:block/cube_all",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "energonrelics:block/defensive_laser"
|
"all": "energonrelics:block/defensive_laser_on"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"parent": "energonrelics:block/defensive_laser"
|
"parent": "energonrelics:block/defensive_laser_on"
|
||||||
}
|
}
|
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 775 B |
After Width: | Height: | Size: 752 B |
@ -3,6 +3,7 @@
|
|||||||
"package": "com.thebrokenrail.energonrelics.mixin",
|
"package": "com.thebrokenrail.energonrelics.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"client": [
|
"client": [
|
||||||
|
"MixinAbstractFileResourcePack"
|
||||||
],
|
],
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinDefaultBiomeFeatures",
|
"MixinDefaultBiomeFeatures",
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"com.thebrokenrail.energonrelics.client.EnergonRelicsClient"
|
"com.thebrokenrail.energonrelics.client.EnergonRelicsClient"
|
||||||
|
],
|
||||||
|
"modmenu": [
|
||||||
|
"com.thebrokenrail.energonrelics.client.ModMenu"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|