2021-02-27 21:24:26 +01:00
|
|
|
/*
|
|
|
|
* This file ("ActuallyAdditions.java") is part of the Actually Additions mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
|
|
|
* © 2015-2017 Ellpeck
|
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod;
|
|
|
|
|
2021-08-31 00:44:39 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
2021-02-27 21:24:26 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
|
2022-01-05 18:31:40 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
2021-02-27 21:24:26 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
2021-03-01 18:11:34 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
|
2021-02-27 21:24:26 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.client.gui.ScreenManager;
|
|
|
|
import net.minecraft.client.network.play.ClientPlayNetHandler;
|
2022-01-05 18:31:40 +01:00
|
|
|
import net.minecraft.client.renderer.RenderType;
|
|
|
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraft.network.play.client.CPlayerDiggingPacket;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraft.util.math.BlockRayTraceResult;
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
|
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
|
|
|
|
|
|
|
public class ActuallyAdditionsClient {
|
|
|
|
|
|
|
|
public static void setup() {
|
2021-08-22 17:09:06 +02:00
|
|
|
ScreenManager.register(ActuallyContainers.BAG_CONTAINER.get(), GuiBag::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.BIO_REACTOR_CONTAINER.get(), GuiBioReactor::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.BREAKER_CONTAINER.get(), GuiBreaker::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.CANOLA_PRESS_CONTAINER.get(), GuiCanolaPress::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.COAL_GENERATOR_CONTAINER.get(), GuiCoalGenerator::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.COFFEE_MACHINE_CONTAINER.get(), GuiCoffeeMachine::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.DIRECTIONAL_BREAKER_CONTAINER.get(), GuiDirectionalBreaker::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.DRILL_CONTAINER.get(), GuiDrill::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.DROPPER_CONTAINER.get(), GuiDropper::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.ENERVATOR_CONTAINER.get(), GuiEnervator::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.ENERGIZER_CONTAINER.get(), GuiEnergizer::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FARMER_CONTAINER.get(), GuiFarmer::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FEEDER_CONTAINER.get(), GuiFeeder::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FERMENTING_BARREL_CONTAINER.get(), GuiFermentingBarrel::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FILTER_CONTAINER.get(), GuiFilter::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FIREWORK_BOX_CONTAINER.get(), GuiFireworkBox::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FLUID_COLLECTOR_CONTAINER.get(), GuiFluidCollector::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.FURNACE_DOUBLE_CONTAINER.get(), GuiFurnaceDouble::new);
|
2021-11-21 18:36:46 +01:00
|
|
|
ScreenManager.register(ActuallyContainers.GRINDER_CONTAINER.get(), CrusherScreen::new);
|
2021-08-22 17:09:06 +02:00
|
|
|
ScreenManager.register(ActuallyContainers.LASER_RELAY_ITEM_WHITELIST_CONTAINER.get(), GuiLaserRelayItemWhitelist::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.MINER_CONTAINER.get(), GuiMiner::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.OIL_GENERATOR_CONTAINER.get(), GuiOilGenerator::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.PHANTOM_PLACER_CONTAINER.get(), GuiPhantomPlacer::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
|
|
|
|
ScreenManager.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
|
2021-02-27 21:24:26 +01:00
|
|
|
// From old proxy
|
|
|
|
InitEntities.initClient();
|
|
|
|
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
|
|
|
MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler());
|
|
|
|
MinecraftForge.EVENT_BUS.register(new SpecialRenderInit());
|
|
|
|
|
|
|
|
setupSpecialRenders();
|
|
|
|
|
|
|
|
RenderWorm.fixItemStack();// todo: remove
|
2022-01-05 18:31:40 +01:00
|
|
|
setupRenderLayers();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void setupRenderLayers() {
|
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.CANOLA_OIL.get(), RenderType.translucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.CANOLA_OIL.getFlowing(), RenderType.translucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.get(), RenderType.translucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.getFlowing(), RenderType.translucent());
|
2022-04-02 04:50:39 +02:00
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.get(), RenderType.translucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.getFlowing(), RenderType.translucent());
|
2022-01-05 18:31:40 +01:00
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.get(), RenderType.translucent());
|
|
|
|
RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.getFlowing(), RenderType.translucent());
|
2022-01-08 19:54:43 +01:00
|
|
|
|
|
|
|
RenderTypeLookup.setRenderLayer(ActuallyBlocks.CANOLA.get(), RenderType.cutout());
|
2022-01-09 00:10:34 +01:00
|
|
|
RenderTypeLookup.setRenderLayer(ActuallyBlocks.RICE.get(), RenderType.cutout());
|
|
|
|
RenderTypeLookup.setRenderLayer(ActuallyBlocks.FLAX.get(), RenderType.cutout());
|
|
|
|
RenderTypeLookup.setRenderLayer(ActuallyBlocks.COFFEE.get(), RenderType.cutout());
|
2021-02-27 21:24:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private static void setupSpecialRenders() {
|
2022-02-12 17:27:49 +01:00
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.getTileEntityType(), ReconstructorRenderer::new);
|
2021-08-31 00:44:39 +02:00
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.DISPLAY_STAND.getTileEntityType(), RenderDisplayStand::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.EMPOWERER.getTileEntityType(), RenderEmpowerer::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.BATTERY_BOX.getTileEntityType(), RenderBatteryBox::new);
|
2021-02-27 21:24:26 +01:00
|
|
|
|
2021-08-31 00:44:39 +02:00
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY.getTileEntityType(), RenderLaserRelay::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ADVANCED.getTileEntityType(), RenderLaserRelay::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_EXTREME.getTileEntityType(), RenderLaserRelay::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType(), RenderLaserRelay::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType(), RenderLaserRelay::new);
|
|
|
|
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), RenderLaserRelay::new);
|
2021-02-27 21:24:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: [port] validate that this works
|
2021-11-21 20:49:33 +01:00
|
|
|
public static void sendBreakPacket(BlockPos pos) {
|
2021-02-27 21:24:26 +01:00
|
|
|
ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
|
|
|
|
assert connection != null;
|
2021-08-22 17:09:06 +02:00
|
|
|
assert Minecraft.getInstance().hitResult != null;
|
|
|
|
connection.send(new CPlayerDiggingPacket(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, pos, ((BlockRayTraceResult) Minecraft.getInstance().hitResult).getDirection()));
|
2021-02-27 21:24:26 +01:00
|
|
|
}
|
|
|
|
}
|