Skip to content

Commit ad51887

Browse files
committed
Quick dirty tweaks
Bump version to 0.1.0a
1 parent c86bc30 commit ad51887

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ loom.platform=forge
1616
yarn_mappings=1.18.2+build.4
1717

1818
# Mod Properties
19-
mod_version=0.1.0
19+
mod_version=0.1.0a
2020
maven_group=io.github.dovecotmc
2121
archives_base_name=LeadBeyond
2222
mod_id=lead_beyond

src/main/java/io/github/dovecotmc/leadbeyond/LeadBeyondClient.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import io.github.dovecotmc.leadbeyond.common.reg.BlockReg;
44
import net.minecraft.client.render.RenderLayer;
55
import net.minecraft.client.render.RenderLayers;
6-
import net.minecraftforge.api.distmarker.Dist;
7-
import net.minecraftforge.eventbus.api.SubscribeEvent;
8-
import net.minecraftforge.fml.common.Mod;
96
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
107

118
public class LeadBeyondClient {

src/main/java/io/github/dovecotmc/leadbeyond/common/block/TurnstileBlock.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.simibubi.create.content.contraptions.wrench.WrenchItem;
55
import io.github.dovecotmc.leadbeyond.common.item.CardItem;
66
import io.github.dovecotmc.leadbeyond.common.item.TicketItem;
7+
import io.github.dovecotmc.leadbeyond.common.item.Ticketable;
78
import io.github.dovecotmc.leadbeyond.common.reg.BlockEntityReg;
89
import io.github.dovecotmc.leadbeyond.common.reg.SoundReg;
910
import net.minecraft.block.*;
@@ -83,6 +84,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
8384
NbtCompound nbt = stack.getOrCreateSubNbt("ticketInfo");
8485
if (!nbt.getBoolean("used")) {
8586
nbt.putBoolean("used", true);
87+
stack.getOrCreateSubNbt("stationInfo").putBoolean("enteredStation", true);
8688
turnstile.setTimer(60);
8789
world.playSound(null, pos, SoundReg.BEEP_TURNSTILE.get(), SoundCategory.BLOCKS, 1f, 1f);
8890
return ActionResult.SUCCESS;
@@ -91,15 +93,22 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
9193
NbtCompound nbt = stack.getOrCreateSubNbt("cardInfo");
9294
if (nbt.getLong("money") >= 100) {
9395
nbt.putLong("money", nbt.getLong("money") - 100);
96+
stack.getOrCreateSubNbt("stationInfo").putBoolean("enteredStation", true);
9497
turnstile.setTimer(60);
9598
world.playSound(null, pos, SoundReg.BEEP_TURNSTILE.get(), SoundCategory.BLOCKS, 1f, 1f);
9699
return ActionResult.SUCCESS;
97100
}
98101
}
99-
} else if (!(stack.getItem() instanceof WrenchItem)) {
100-
turnstile.setTimer(60);
101-
world.playSound(null, pos, SoundReg.BEEP_TURNSTILE.get(), SoundCategory.BLOCKS, 1f, 1f);
102-
return ActionResult.SUCCESS;
102+
} else {
103+
if (stack.getItem() instanceof Ticketable) {
104+
NbtCompound nbt = stack.getOrCreateSubNbt("stationInfo");
105+
if (nbt.getBoolean("enteredStation")) {
106+
turnstile.setTimer(60);
107+
nbt.putBoolean("enteredStation", false);
108+
world.playSound(null, pos, SoundReg.BEEP_TURNSTILE.get(), SoundCategory.BLOCKS, 1f, 1f);
109+
return ActionResult.SUCCESS;
110+
}
111+
}
103112
}
104113
}
105114
return super.onUse(state, world, pos, player, hand, hit);

src/main/java/io/github/dovecotmc/leadbeyond/common/item/CardItem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
import java.util.List;
2020
import java.util.concurrent.atomic.AtomicReference;
2121

22-
public class CardItem extends Item {
22+
public class CardItem extends Item
23+
implements Ticketable {
2324
public CardItem(Settings settings) {
2425
super(settings);
2526
}
@@ -28,6 +29,7 @@ public CardItem(Settings settings) {
2829
public ItemStack getDefaultStack() {
2930
ItemStack stack = super.getDefaultStack();
3031
stack.getOrCreateSubNbt("cardInfo").putLong("money", 0);
32+
stack.getOrCreateSubNbt("stationInfo").putBoolean("enteredStation", false);
3133
return stack;
3234
}
3335

src/main/java/io/github/dovecotmc/leadbeyond/common/item/TicketItem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
import java.util.List;
2020
import java.util.concurrent.atomic.AtomicReference;
2121

22-
public class TicketItem extends Item {
22+
public class TicketItem extends Item
23+
implements Ticketable {
2324
public TicketItem(Settings settings) {
2425
super(settings);
2526
}
@@ -28,6 +29,7 @@ public TicketItem(Settings settings) {
2829
public ItemStack getDefaultStack() {
2930
ItemStack stack = super.getDefaultStack();
3031
stack.getOrCreateSubNbt("ticketInfo").putBoolean("used", false);
32+
stack.getOrCreateSubNbt("stationInfo").putBoolean("enteredStation", false);
3133
return stack;
3234
}
3335

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package io.github.dovecotmc.leadbeyond.common.item;
2+
3+
public interface Ticketable {
4+
}

0 commit comments

Comments
 (0)