Search in sources :

Example 1 with TileEntityAlienDefenderBeacon

use of stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon in project MorePlanets by SteveKunG.

the class BlockAlienDefenderBeacon method onBlockPlacedBy.

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack itemStack) {
    TileEntity tile = world.getTileEntity(pos);
    world.setBlockState(pos, this.getDefaultState());
    if (!world.isRemote) {
        if (placer instanceof EntityPlayer) {
            EntityPlayer player = (EntityPlayer) placer;
            if (tile instanceof TileEntityAlienDefenderBeacon) {
                TileEntityAlienDefenderBeacon beacon = (TileEntityAlienDefenderBeacon) tile;
                beacon.creativeSpawn = player.capabilities.isCreativeMode;
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TileEntityAlienDefenderBeacon(stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon)

Example 2 with TileEntityAlienDefenderBeacon

use of stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon in project MorePlanets by SteveKunG.

the class TileEntityItemStackRendererMP method renderByItem.

@Override
public void renderByItem(ItemStack itemStack) {
    Block block = Block.getBlockFromItem(itemStack.getItem());
    if (block == DionaBlocks.DIONA_ANCIENT_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDionaAncientChest());
    } else if (block == DionaBlocks.DIONA_TREASURE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDionaTreasureChest());
    } else if (block == ChalosBlocks.CHALOS_ANCIENT_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityChalosAncientChest());
    } else if (block == ChalosBlocks.CHALOS_TREASURE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityChalosTreasureChest());
    } else if (block == DionaBlocks.ZELIUS_EGG) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityZeliusEgg());
        GlStateManager.enableBlend();
    } else if (block == DionaBlocks.LARGE_INFECTED_CRYSTALLIZE) {
        TileEntityLargeInfectedCrystallizeRenderer.INSTANCE.render();
    } else if (block == MPBlocks.DARK_ENERGY_RECEIVER) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDarkEnergyReceiver());
    } else if (itemStack.getItem() == DionaItems.INFECTED_CRYSTALLIZE_BOMB) {
        RenderInfectedCrystallizeBomb.INSTANCE.render();
    } else if (block == NibiruBlocks.NIBIRU_ANCIENT_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityNibiruAncientChest());
    } else if (block == NibiruBlocks.NIBIRU_TREASURE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityNibiruTreasureChest());
    } else if (block == ChalosBlocks.CHEESE_SPORE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityCheeseSporeChest());
    } else if (block == NibiruBlocks.INFECTED_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityInfectedChest());
    } else if (block == NibiruBlocks.MULTALIC_CRYSTAL) {
        TileEntityMultalicCrystalRenderer.INSTANCE.render();
    } else if (block == DionaBlocks.DARK_ENERGY_CORE) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDarkEnergyCore());
        GlStateManager.enableBlend();
    } else if (block == NibiruBlocks.ALIEN_BERRY_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityAlienBerryChest());
    } else if (block == NibiruBlocks.JUICER_EGG) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityJuicerEgg());
        TileEntityJuicerEggRenderer.renderItem(null, true);
    } else if (block == NibiruBlocks.NUCLEAR_WASTE_TANK) {
        TileEntityNuclearWasteTankRenderer.INSTANCE.render();
    } else if (block == NibiruBlocks.VEIN_FRAME) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityVeinFrame());
        GlStateManager.enableBlend();
    } else if (block == DionaBlocks.DARK_ENERGY_GENERATOR) {
        TileEntityDarkEnergyGeneratorRenderer.INSTANCE.render();
    } else if (block == MPBlocks.BLACK_HOLE_STORAGE) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityBlackHoleStorage());
        GlStateManager.enableBlend();
    } else if (block == MPBlocks.ALIEN_DEFENDER_BEACON) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityAlienDefenderBeacon());
        GlStateManager.enableBlend();
        GlStateManager.enableCull();
    } else if (block == MPBlocks.SHIELD_GENERATOR) {
        TileEntityShieldGeneratorRenderer.INSTANCE.render();
    } else {
        this.old.renderByItem(itemStack);
    }
}
Also used : TileEntityCheeseSporeChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityCheeseSporeChest) TileEntityChalosTreasureChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosTreasureChest) TileEntityDionaTreasureChest(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaTreasureChest) TileEntityDarkEnergyReceiver(stevekung.mods.moreplanets.tileentity.TileEntityDarkEnergyReceiver) TileEntityDionaAncientChest(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaAncientChest) TileEntityDarkEnergyCore(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore) TileEntityBlackHoleStorage(stevekung.mods.moreplanets.tileentity.TileEntityBlackHoleStorage) TileEntityChalosAncientChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosAncientChest) Block(net.minecraft.block.Block) TileEntityAlienDefenderBeacon(stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon) TileEntityZeliusEgg(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityZeliusEgg)

Example 3 with TileEntityAlienDefenderBeacon

use of stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon in project MorePlanets by SteveKunG.

the class RenderAlienDefenderBeacon method renderItem.

@Override
public void renderItem(ItemStack itemStack, ItemCameraTransforms.TransformType type) {
    ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityAlienDefenderBeacon());
    GlStateManager.enableBlend();
    GlStateManager.enableCull();
}
Also used : TileEntityAlienDefenderBeacon(stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon)

Example 4 with TileEntityAlienDefenderBeacon

use of stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon in project MorePlanets by SteveKunG.

the class ItemAlienDefenderReinforcement method onItemRightClick.

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack itemStack = player.getHeldItem(hand);
    int range = 16;
    Vec3d playerEye = player.getPositionEyes(1.0F);
    Vec3d playerLook = player.getLook(1.0F);
    Vec3d lookRange = playerEye.addVector(playerLook.x * range, playerLook.y * range, playerLook.z * range);
    RayTraceResult moving = world.rayTraceBlocks(playerEye, lookRange);
    boolean disable = false;
    if (moving != null && disable) {
        BlockPos pos = moving.getBlockPos();
        if (world.isAirBlock(pos.up())) {
            if (world.isRemote) {
                FMLClientHandler.instance().getClient().ingameGUI.setOverlayMessage(new JsonUtil().text(I18n.format("gui.alien_defender_beacon.message")).setStyle(new JsonUtil().colorFromConfig("yellow")).getFormattedText(), false);
                player.swingArm(hand);
            } else {
                world.setBlockState(pos.up(), MPBlocks.ALIEN_DEFENDER_BEACON.getDefaultState());
                TileEntityAlienDefenderBeacon beacon = (TileEntityAlienDefenderBeacon) world.getTileEntity(pos.up());
                beacon.bossCountdown = 200 + world.rand.nextInt(400);
                if (!player.capabilities.isCreativeMode) {
                    itemStack.shrink(1);
                }
            }
        } else {
            if (world.isRemote) {
                FMLClientHandler.instance().getClient().ingameGUI.setOverlayMessage(new JsonUtil().text(I18n.format("gui.not_air_block.message")).setStyle(new JsonUtil().red()).getFormattedText(), false);
                player.swingArm(hand);
            }
        }
    } else {
        if (world.isRemote && disable) {
            FMLClientHandler.instance().getClient().ingameGUI.setOverlayMessage(new JsonUtil().text(I18n.format("gui.target_too_far.message", range)).setStyle(new JsonUtil().red()).getFormattedText(), false);
            player.swingArm(hand);
        }
    }
    return new ActionResult<>(EnumActionResult.PASS, itemStack);
}
Also used : ActionResult(net.minecraft.util.ActionResult) EnumActionResult(net.minecraft.util.EnumActionResult) RayTraceResult(net.minecraft.util.math.RayTraceResult) TileEntityAlienDefenderBeacon(stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d) JsonUtil(stevekung.mods.moreplanets.util.JsonUtil)

Aggregations

TileEntityAlienDefenderBeacon (stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon)4 Block (net.minecraft.block.Block)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ActionResult (net.minecraft.util.ActionResult)1 EnumActionResult (net.minecraft.util.EnumActionResult)1 BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1 Vec3d (net.minecraft.util.math.Vec3d)1 TileEntityChalosAncientChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosAncientChest)1 TileEntityChalosTreasureChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosTreasureChest)1 TileEntityCheeseSporeChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityCheeseSporeChest)1 TileEntityDarkEnergyCore (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore)1 TileEntityDionaAncientChest (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaAncientChest)1 TileEntityDionaTreasureChest (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaTreasureChest)1 TileEntityZeliusEgg (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityZeliusEgg)1 TileEntityBlackHoleStorage (stevekung.mods.moreplanets.tileentity.TileEntityBlackHoleStorage)1 TileEntityDarkEnergyReceiver (stevekung.mods.moreplanets.tileentity.TileEntityDarkEnergyReceiver)1 JsonUtil (stevekung.mods.moreplanets.util.JsonUtil)1