Search in sources :

Example 1 with EngineBlock

use of com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock in project SteamPowered by TeamMoegMC.

the class MixinFlywheel method sp$tick.

@Inject(at = @At("HEAD"), method = "tick")
public void sp$tick(CallbackInfo cbi) {
    Direction at = FlywheelBlock.getConnection(getBlockState());
    if (at != null) {
        BlockPos eng = this.getBlockPos().relative(at, 2);
        Block b = this.getWorld().getBlockState(eng).getBlock();
        if (!(b instanceof EngineBlock)) {
            FlywheelBlock.setConnection(getWorld(), getBlockPos(), getBlockState(), null);
            this.setRotation(0, 0);
        } else {
            TileEntity te = this.getWorld().getBlockEntity(eng);
            if (te instanceof EngineTileEntity) {
                if (te instanceof SteamEngineTileEntity) {
                    SteamEngineTileEntity ete = (SteamEngineTileEntity) te;
                    if (ete.getFlywheel() != this.getBlockState().getBlock())
                        this.setRotation(0, 0);
                }
            } else
                this.setRotation(0, 0);
        }
    } else
        this.setRotation(0, 0);
}
Also used : SteamEngineTileEntity(com.teammoeg.steampowered.content.engine.SteamEngineTileEntity) FlywheelTileEntity(com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity) EngineTileEntity(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity) GeneratingKineticTileEntity(com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) SteamEngineTileEntity(com.teammoeg.steampowered.content.engine.SteamEngineTileEntity) EngineTileEntity(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity) SteamEngineTileEntity(com.teammoeg.steampowered.content.engine.SteamEngineTileEntity) EngineBlock(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock) Block(net.minecraft.block.Block) FlywheelBlock(com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock) EngineBlock(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock) BlockPos(net.minecraft.util.math.BlockPos) Direction(net.minecraft.util.Direction) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with EngineBlock

use of com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock in project Create by Creators-of-Create.

the class ClientEvents method addToItemTooltip.

@SubscribeEvent
public static void addToItemTooltip(ItemTooltipEvent event) {
    if (!AllConfigs.CLIENT.tooltips.get())
        return;
    if (event.getPlayer() == null)
        return;
    ItemStack stack = event.getItemStack();
    String translationKey = stack.getItem().getDescriptionId(stack);
    if (translationKey.startsWith(ITEM_PREFIX) || translationKey.startsWith(BLOCK_PREFIX))
        if (TooltipHelper.hasTooltip(stack, event.getPlayer())) {
            List<Component> itemTooltip = event.getToolTip();
            List<Component> toolTip = new ArrayList<>();
            toolTip.add(itemTooltip.remove(0));
            TooltipHelper.getTooltip(stack).addInformation(toolTip);
            itemTooltip.addAll(0, toolTip);
        }
    if (stack.getItem() instanceof BlockItem) {
        BlockItem item = (BlockItem) stack.getItem();
        if (item.getBlock() instanceof IRotate || item.getBlock() instanceof EngineBlock) {
            List<Component> kineticStats = ItemDescription.getKineticStats(item.getBlock());
            if (!kineticStats.isEmpty()) {
                event.getToolTip().add(new TextComponent(""));
                event.getToolTip().addAll(kineticStats);
            }
        }
    }
    PonderTooltipHandler.addToTooltip(event.getToolTip(), stack);
    SequencedAssemblyRecipe.addToTooltip(event.getToolTip(), stack);
}
Also used : TextComponent(net.minecraft.network.chat.TextComponent) IRotate(com.simibubi.create.content.contraptions.base.IRotate) EngineBlock(com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock) ModList(net.minecraftforge.fml.ModList) List(java.util.List) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.world.item.ItemStack) TextComponent(net.minecraft.network.chat.TextComponent) Component(net.minecraft.network.chat.Component) BlockItem(net.minecraft.world.item.BlockItem) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

EngineBlock (com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock)2 GeneratingKineticTileEntity (com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity)1 IRotate (com.simibubi.create.content.contraptions.base.IRotate)1 FlywheelBlock (com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock)1 FlywheelTileEntity (com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity)1 EngineTileEntity (com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity)1 SteamEngineTileEntity (com.teammoeg.steampowered.content.engine.SteamEngineTileEntity)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Block (net.minecraft.block.Block)1 Component (net.minecraft.network.chat.Component)1 TextComponent (net.minecraft.network.chat.TextComponent)1 TileEntity (net.minecraft.tileentity.TileEntity)1 Direction (net.minecraft.util.Direction)1 BlockPos (net.minecraft.util.math.BlockPos)1 BlockItem (net.minecraft.world.item.BlockItem)1 ItemStack (net.minecraft.world.item.ItemStack)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1 ModList (net.minecraftforge.fml.ModList)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1