Improve REI Plugin
All checks were successful
EnergonRelics/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-07-30 18:57:20 -04:00
parent 7d224ea353
commit 573cd4dd24
5 changed files with 39 additions and 24 deletions

View File

@ -13,6 +13,7 @@ import net.minecraft.block.ShapeContext;
import net.minecraft.block.enums.DoubleBlockHalf;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.Properties;
@ -126,4 +127,9 @@ public class LightningRodBlock extends SimpleBlock {
super.onBreak(world, pos, state, player);
}
@Override
public Item asItem() {
return EnergonRelics.LIGHTNING_ROD_BASE_BLOCK.asItem();
}
}

View File

@ -25,18 +25,18 @@ public class InfuserCategory implements RecipeCategory<InfuserDisplay> {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
List<Widget> widgets = new ArrayList<>();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 18)));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.chance", new DecimalFormat("###.##").format(display.successChance * 100d))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 14), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.cost", display.cost)).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 17)).animationDurationTicks(HardcodedConfig.INFUSER_TIME));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 18)).entries(display.getInputEntries().get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 18)).entries(display.getOutputEntries()).disableBackground().markOutput());
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 26)));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width / 2, bounds.y + 9), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.chance", new DecimalFormat("###.##").format(display.successChance * 100d))).noShadow().centered().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width / 2, bounds.y + 18), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.cost", display.cost)).noShadow().centered().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 25)).animationDurationTicks(HardcodedConfig.INFUSER_TIME));
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 26)).entries(display.getInputEntries().get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 26)).entries(display.getOutputEntries()).disableBackground().markOutput());
return widgets;
}
@Override
public int getDisplayHeight() {
return 58;
return 66;
}
@Override

View File

@ -1,5 +1,6 @@
package com.thebrokenrail.energonrelics.energy.core.util;
import com.thebrokenrail.energonrelics.EnergonRelics;
import com.thebrokenrail.energonrelics.component.NetworkComponent;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
@ -18,7 +19,7 @@ public class EnergyTicker {
public static void tick(World world) {
if (Objects.requireNonNull(world.getServer()).getThread() == Thread.currentThread()) {
world.getProfiler().push("energyTicker");
world.getProfiler().push(EnergonRelics.NAMESPACE);
NetworkComponent.getInstance((ServerWorld) world).clearCache();

View File

@ -4,6 +4,7 @@ import com.thebrokenrail.energonrelics.block.forcefield.util.BeamBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
@ -19,12 +20,18 @@ import java.util.function.Predicate;
@Mixin(Entity.class)
public abstract class MixinEntity {
@Shadow public abstract Box getBoundingBox();
@Shadow
public abstract Box getBoundingBox();
@Shadow public abstract World getEntityWorld();
@Shadow
public abstract World getEntityWorld();
@Shadow
public abstract MinecraftServer getServer();
@Unique
private boolean isTouching(Predicate<Block> test) {
if (getServer() == null || getServer().getThread() == Thread.currentThread()) {
Box box = getBoundingBox();
int i = MathHelper.floor(box.minX);
int j = MathHelper.ceil(box.maxX);
@ -42,6 +49,7 @@ public abstract class MixinEntity {
}
}
}
}
return false;
}

View File

@ -51,6 +51,6 @@
"text.energonrelics.battery_core_tooltip": "%s Energon",
"text.energonrelics.multimeter_separator": ", ",
"category.rei.energonrelics.infuser.chance": "%s%% Chance",
"category.rei.energonrelics.infuser.cost": "Costing %s Energon",
"category.rei.energonrelics.infuser.cost": "%s Energon",
"category.rei.energonrelics.infuser.name": "Infuser"
}