-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganise entry points, definitions, pretty much everything
- Loading branch information
Showing
24 changed files
with
290 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/gripe/_90/fulleng/FullBlockEnergisticsClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package gripe._90.fulleng; | ||
|
||
import java.util.Objects; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
import net.neoforged.api.distmarker.Dist; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.neoforge.client.event.ModelEvent; | ||
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; | ||
import net.neoforged.neoforge.network.PacketDistributor; | ||
|
||
import appeng.api.util.AEColor; | ||
import appeng.client.render.ColorableBlockEntityBlockColor; | ||
import appeng.client.render.StaticItemColor; | ||
import appeng.core.network.serverbound.PartLeftClickPacket; | ||
|
||
import gripe._90.fulleng.block.entity.monitor.ConversionMonitorBlockEntity; | ||
import gripe._90.fulleng.client.MonitorBERenderer; | ||
|
||
@SuppressWarnings("unused") | ||
@Mod(value = FullblockEnergistics.MODID, dist = Dist.CLIENT) | ||
public class FullBlockEnergisticsClient { | ||
public FullBlockEnergisticsClient(IEventBus eventBus) { | ||
eventBus.addListener((ModelEvent.RegisterGeometryLoaders event) -> { | ||
BlockEntityRenderers.register(FullblockEnergistics.STORAGE_MONITOR_BE.get(), MonitorBERenderer::new); | ||
BlockEntityRenderers.register(FullblockEnergistics.CONVERSION_MONITOR_BE.get(), MonitorBERenderer::new); | ||
}); | ||
|
||
eventBus.addListener((RegisterColorHandlersEvent.Block event) -> { | ||
for (var block : FullblockEnergistics.BLOCKS.getEntries()) { | ||
event.register(ColorableBlockEntityBlockColor.INSTANCE, block.get()); | ||
} | ||
}); | ||
|
||
eventBus.addListener((RegisterColorHandlersEvent.Item event) -> { | ||
for (var block : FullblockEnergistics.BLOCKS.getEntries()) { | ||
event.register(new StaticItemColor(AEColor.TRANSPARENT), block.get()); | ||
} | ||
}); | ||
|
||
NeoForge.EVENT_BUS.addListener((PlayerInteractEvent.LeftClickBlock event) -> { | ||
var level = event.getLevel(); | ||
|
||
if (level.isClientSide()) { | ||
if (!(Minecraft.getInstance().hitResult instanceof BlockHitResult hitResult)) { | ||
return; | ||
} | ||
|
||
if (level.getBlockEntity(hitResult.getBlockPos()) instanceof ConversionMonitorBlockEntity monitor | ||
&& hitResult.getDirection() == monitor.getFront()) { | ||
PacketDistributor.sendToServer( | ||
new PartLeftClickPacket(hitResult, event.getEntity().isShiftKeyDown())); | ||
Objects.requireNonNull(Minecraft.getInstance().gameMode).destroyDelay = 5; | ||
event.setCanceled(true); | ||
} | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.