Jump to content

Why in IDE my code has errors? Whoes can tell how fix it?


DragoniXGG

Recommended Posts

Bolt = error
 

package com.example.bedrockbridging.com.example;

import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber
public class BedrockBridgingMethod {
private static final int TICKS_PER_BLOCK = 2;

private int buildTicksLeft = 0;
private BlockPos buildPos = null;
}
@SubscribeEvent
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
if (event.phase != TickEvent.Phase.START || event.player.isSneaking()) {
return;
}
PlayerEntity player = event.player;
BedrockBridgingMethod instance = BedrockBridgingMethod.getInstance();
if (instance.buildTicksLeft > 0) {
instance.buildTicksLeft--;
return;
}
if (instance.buildPos != null) {
BlockState state = player.world.getBlockState(instance.buildPos);
if (state.getBlock() == Blocks.AIR) {
playerControllerClickBlock(player, instance.buildPos);
}
instance.buildTicksLeft = TICKS_PER_BLOCK;
instance.buildPos = instance.buildPos.offset(player.getHorizontalFacing());
} else {
instance.buildPos = player.getPosition().offset(player.getHorizontalFacing());
}

Link to comment
Share on other sites

That doesn't answer the question what are the errors, but my guess is that the classes, fields, and method names are all incorrect since they changed when mojmaps was made the 'default' mapping set. As such, you need to change all the names to reflect this (e.g. 'PlayerEntity' -> 'Player'). Looking at what you've shown, you can easily use your IDE to find what the changed names are.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.