Fix blocks connecting to ME cables. Give boost to chisel facades

This commit is contained in:
PrototypeTrousers
2022-11-08 23:05:41 -03:00
parent bd0d2a1f28
commit 16ccb2ee46
3 changed files with 76 additions and 0 deletions
+2
View File
@@ -83,6 +83,8 @@ dependencies {
// installable runtime dependencies
deobfCompile "curse.maven:gregtechceu-557242:3949406"
compileOnly "curse.maven:chisel-235279:2915375"
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "curse.maven:hwyla-253449:2568751"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
@@ -44,6 +44,7 @@ import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -413,6 +414,30 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
return world.getBlockState(pos);
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
IFacadeContainer container = this.fc(world, pos);
if (container != null) {
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
if (facade != null) {
return BlockFaceShape.SOLID;
}
}
return BlockFaceShape.UNDEFINED;
}
@Override
public void onEntityWalk(World world, BlockPos pos, Entity entityIn) {
IFacadeContainer container = this.fc(world, pos);
if (container != null) {
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(EnumFacing.UP));
if (facade != null) {
facade.getBlockState().getBlock().onEntityWalk(world, pos, entityIn);
}
}
super.onEntityWalk(world, pos, entityIn);
}
public static Class<? extends AEBaseTile> getNoTesrTile() {
return noTesrTile;
}
@@ -0,0 +1,49 @@
package appeng.integration.modules.chisel;
import appeng.block.networking.BlockCableBus;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovementInput;
import net.minecraft.util.MovementInputFromOptions;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import team.chisel.common.config.Configurations;
import static team.chisel.client.handler.BlockSpeedHandler.speedupBlocks;
@Mod.EventBusSubscriber(Side.CLIENT)
public class ChiselBlockSpeedHandler {
@SideOnly(Side.CLIENT)
private static MovementInput manualInputCheck;
@Optional.Method(modid = "chisel")
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void speedupPlayer(TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.START && event.side.isClient() && event.player.onGround && event.player instanceof EntityPlayerSP) {
if (manualInputCheck == null) {
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
}
EntityPlayerSP player = (EntityPlayerSP) event.player;
BlockPos blockPosBelow = new BlockPos(player.posX, player.posY - (1 / 16D), player.posZ);
IBlockState below = player.getEntityWorld().getBlockState(blockPosBelow);
if (below.getBlock() instanceof BlockCableBus) {
IBlockState f = ((BlockCableBus) below.getBlock()).getFacadeState(Minecraft.getMinecraft().world, blockPosBelow, EnumFacing.UP);
if (speedupBlocks.contains(f.getBlock())) {
manualInputCheck.updatePlayerMoveState();
if ((manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) && !player.isInWater()) {
player.motionX *= Configurations.concreteVelocityMult;
player.motionZ *= Configurations.concreteVelocityMult;
}
}
}
}
}
}