Improve Balancing Of Infuser
All checks were successful
EnergonRelics/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-07-29 23:48:07 -04:00
parent ac9b49e358
commit 7bc126ba96
4 changed files with 54 additions and 6 deletions

View File

@ -1,10 +1,11 @@
package com.thebrokenrail.energonrelics.block.entity.infuser;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
@ -32,10 +33,15 @@ interface InfuserAction {
class ExplosionAction implements InfuserAction {
@Override
public void run(World world, BlockPos pos) {
BlockState oldState = world.getBlockState(pos);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.createExplosion(null, pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d, 3f, true, Explosion.DestructionType.DESTROY);
Block.dropStacks(oldState, world, pos);
}
}
class ParticleAction implements InfuserAction {
@Override
public void run(World world, BlockPos pos) {
((ServerWorld) world).spawnParticles(ParticleTypes.SMOKE, pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d, 28, 0.31f, 0.31f, 0.31f, 0f);
}
}
}

View File

@ -1,11 +1,16 @@
package com.thebrokenrail.energonrelics.block.entity.infuser;
import net.minecraft.item.DyeItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class InfuserRegistry {
@ -41,6 +46,43 @@ public class InfuserRegistry {
}
static {
add(Items.SUGAR, new InfuserEntry(51, 0.76d, new InfuserAction[]{new InfuserAction.ItemAction(Items.GLOWSTONE_DUST)}, new InfuserAction[]{new InfuserAction.ItemAction(Items.SUGAR_CANE), new InfuserAction.ExplosionAction()}));
add(Items.SUGAR, new InfuserEntry(320, 0.7d, new InfuserAction[]{new InfuserAction.ItemAction(new ItemStack(Items.GLOWSTONE_DUST, 16))}, new InfuserAction[]{new InfuserAction.ItemAction(Items.SUGAR_CANE), new InfuserAction.ExplosionAction()}));
DyeColor[] colors = DyeColor.values();
Item[] dyes = new Item[colors.length];
for (int i = 0; i < colors.length; i++) {
dyes[i] = DyeItem.byColor(colors[i]);
}
addTransform(dyes, 107, 0.6d);
addTransform(getWool(), 168, 0.5d);
add(Items.GOLDEN_APPLE, new InfuserEntry(510, 0.3d, new InfuserAction[]{new InfuserAction.ItemAction(Items.ENCHANTED_GOLDEN_APPLE)}, new InfuserAction[]{new InfuserAction.ExplosionAction()}));
add(Items.COAL, new InfuserEntry(340, 0.01d, new InfuserAction[]{new InfuserAction.ItemAction(Items.DIAMOND)}, new InfuserAction[]{new InfuserAction.ExplosionAction()}));
}
private static void addTransform(Item[] items, long cost, double successChance) {
for (Item item : items) {
InfuserAction[] success = new InfuserAction[items.length - 1];
int i = 0;
for (Item item2 : items) {
if (item != item2) {
success[i] = new InfuserAction.ItemAction(item2);
i++;
}
}
add(item, new InfuserEntry(cost, successChance, success, new InfuserAction[]{new InfuserAction.ParticleAction(), new InfuserAction.ItemAction(Items.STRING)}));
}
}
private static Item[] getWool() {
List<Item> wool = new ArrayList<>();
for (Item item : Registry.ITEM) {
Identifier id = Registry.ITEM.getId(item);
if (id.getNamespace().equals("minecraft") && id.getPath().endsWith("_wool")) {
wool.add(item);
}
}
return wool.toArray(new Item[0]);
}
}

View File

@ -43,5 +43,5 @@ public class HardcodedConfig {
public static final long HOLOGRAPHIC_SKY_ENERGY_REQUIRED = 15;
public static final int INFUSER_TIME = 160;
public static final int INFUSER_TIME = 2200;
}

View File

@ -10,7 +10,7 @@
"item": "energonrelics:circuit_board"
},
"G": {
"item": "minecraft:gold_ingot"
"item": "minecraft:gold_nugget"
},
"V": {
"item": "energonrelics:veridium_powder"