Skip to content

Commit

Permalink
Adjustment for issue #13
Browse files Browse the repository at this point in the history
  • Loading branch information
GameduJS committed Jul 20, 2023
1 parent f493d2e commit 0ca7bae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.util.math.random.LocalRandom;
import net.minecraft.village.TradeOffer;
import net.minecraft.village.TradeOfferList;
import net.minecraft.village.VillagerProfession;
import net.minecraft.world.World;

import java.util.Map;
Expand Down Expand Up @@ -75,6 +76,10 @@ public void handle() {
case SELECT_TRADE -> tradeInterface.selectTrade();
case APPLY_TRADE -> tradeInterface.applyTrade();
case PICKUP_TRADE -> tradeInterface.pickupBook();
case WAIT_JOB_LOSS -> {
if(selectionInterface.getVillager().getVillagerData().getProfession() == VillagerProfession.NONE)
setState(TradingState.PLACE_WORKSTATION);
}
}
}

Expand Down Expand Up @@ -120,8 +125,9 @@ private void handleBreak() {
minecraftClient.interactionManager.updateBlockBreakingProgress(getSelectionInterface().getLecternPos(), Direction.UP);
player.swingHand(Hand.MAIN_HAND, true);
player.networkHandler.sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
} else
state = TradingState.PLACE_WORKSTATION;
} else {
state = TradingState.WAIT_JOB_LOSS;
}
}

public void checkVillagerOffers(TradeOfferList tradeOffers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public enum TradingState {
CHECK_OFFERS(),
WAIT_JOB_LOSS(),
WAIT_PROFESSION(),
BREAK_WORKSTATION(),
PLACE_WORKSTATION(),
Expand Down

0 comments on commit 0ca7bae

Please sign in to comment.