Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If anyone would like to add the remaining features to the game, feel free to che

### **🙎‍♂️ Additional Credits**
- Foundation games (Former Author)
- Qboi (Author)
- ~~Qboi~~ XyperCode (Author)
- MincraftEinstein (Contributor)
- Jab125 (Contributor)
- Chumasay (Artist)
Expand Down
25 changes: 8 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'org.jetbrains.kotlin.jvm' version "1.7.10"
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'org.jetbrains.kotlin.jvm' version "1.9.22"
id 'maven-publish'
}

Expand Down Expand Up @@ -29,8 +29,8 @@ repositories {
maven { url terraformersUrl() }
maven { url "https://aperlambda.github.io/maven" }
maven { url "https://hephaestus.dev/release" }
maven { url "https://storage.googleapis.com/devan-maven/" }
maven { url "https://api.modrinth.com/maven" }
maven { url "https://storage.googleapis.com/devan-maven/" }
maven { url "https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/" }

maven {
Expand All @@ -40,15 +40,6 @@ repositories {
}
}

// maven {
// name = "GitHubPackages"
// url = uri("https://maven.pkg.github.com/Ultreon/myron-updated")
// credentials {
// username = rootProject.hasProperty("gpr.user") ? rootProject.property("gpr.user") : System.getenv("GITHUB_ACTOR")
// password = rootProject.hasProperty("gpr.key") ? rootProject.property("gpr.key") : System.getenv("GITHUB_TOKEN")
// }
// }

flatDir {
dir "$projectDir/libs"
}
Expand All @@ -64,7 +55,7 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Geckolib
modImplementation "software.bernie.geckolib:geckolib-fabric-1.19.3:4.0.3"
modImplementation "software.bernie.geckolib:geckolib-fabric-1.20.1:4.4.2"

// Controller Support
include modImplementation("dev.lambdaurora:spruceui:${project.spruceui_version}")
Expand All @@ -82,9 +73,9 @@ dependencies {
// modImplementation "maven.modrinth:jsonem:${project.jsonem_version}"
// include "maven.modrinth:jsonem:${project.jsonem_version}"

modImplementation("net.fabricmc:fabric-language-kotlin:1.8.6+kotlin.1.7.21")
modImplementation("net.fabricmc:fabric-language-kotlin:1.10.17+kotlin.1.9.22")

modImplementation "com.terraformersmc:modmenu:5.0.2", {
modImplementation "com.terraformersmc:modmenu:7.2.2", {
exclude module: "fabric-api"
}

Expand All @@ -107,8 +98,8 @@ tasks.withType(JavaCompile).configureEach {
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
// Minecraft 1.18 upwards uses Java 17.
it.options.release = 17
}

java {
Expand Down
23 changes: 11 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=false

minecraft_version=1.19.3
yarn_mappings=1.19.3+build.4
loader_version=0.14.12
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.15.6

#Fabric api
fabric_version=0.69.1+1.19.3
fabric_version=0.91.0+1.20.1

# Other Dependencies
midnightcontrols_version=1.7.2-1.19.3
midnightlib_version=1.1.0-fabric
spruceui_version=4.1.0+1.19.3
arrp_version=4180873
midnightcontrols_version=1.9.3+1.20
midnightlib_version=1.4.1-fabric
spruceui_version=5.0.0+1.20
arrp_version=5018841

mod_version = 1.0.0-1.19.3
maven_group = motobox
archives_base_name = motobox
mod_version=1.1.0-1.20.1
maven_group=motobox
archives_base_name=motobox
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
23 changes: 15 additions & 8 deletions src/main/java/motobox/Motobox.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.resource.featuretoggle.FeatureSet;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.MinecraftServer;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

// TODO fix player not rotating when vehicle rotating
public class Motobox implements ModInitializer {
public static final String MOD_ID = "motobox";

public static final ItemGroup GROUP = FabricItemGroup.builder(id("motobox")).icon(AUtils::createGroupIcon).entries((enabledFeatures, entries, operatorEnabled) -> {
public static final ItemGroup GROUP = FabricItemGroup.builder().icon(AUtils::createGroupIcon).entries((enabledFeatures, entries) -> {
for (Item item : Registries.ITEM) {
if (item instanceof GenericMotoboxItem) {
entries.add(item);
Expand All @@ -42,8 +44,8 @@ public class Motobox implements ModInitializer {
vehicleComponentItem.appendStacks(entries);
}
}
}).build();
public static final ItemGroup COURSE_ELEMENTS = FabricItemGroup.builder(id("motobox_course_elements")).icon(AUtils::createCourseElementsIcon).entries((enabledFeatures, entries, operatorEnabled) -> {
}).displayName(Text.translatable("itemGroup.motobox.motobox")).build();
public static final ItemGroup COURSE_ELEMENTS = FabricItemGroup.builder().icon(AUtils::createCourseElementsIcon).entries((enabledFeatures, entries) -> {
for (Item item : Registries.ITEM) {
if (item instanceof CourseElementItem) {
entries.add(item);
Expand All @@ -54,22 +56,22 @@ public class Motobox implements ModInitializer {
}
}
}
}).build();
public static final ItemGroup PREFABS = FabricItemGroup.builder(id("motobox_prefabs")).icon(AUtils::createPrefabsIcon).entries((enabledFeatures, entries, operatorEnabled) -> {
}).displayName(Text.translatable("itemGroup.motobox.motobox_course_elements")).build();
public static final ItemGroup PREFABS = FabricItemGroup.builder().icon(AUtils::createPrefabsIcon).entries((enabledFeatures, entries) -> {
for (var prefab : VehicleItem.PREFABS) {
entries.add(prefab.toStack());
}
}).build();
}).displayName(Text.translatable("itemGroup.motobox.motobox_prefabs")).build();

public static final TagKey<Block> SLOPES = TagKey.of(Registries.BLOCK.getKey(), id("slopes"));
public static final TagKey<Block> STEEP_SLOPES = TagKey.of(Registries.BLOCK.getKey(), id("steep_slopes"));
public static final TagKey<Block> NON_STEEP_SLOPES = TagKey.of(Registries.BLOCK.getKey(), id("non_steep_slopes"));
public static final TagKey<Block> STICKY_SLOPES = TagKey.of(Registries.BLOCK.getKey(), id("sticky_slopes"));

public static final ScreenHandlerType<MechanicTableScreenHandler> MECHANIC_SCREEN =
Registry.register(Registries.SCREEN_HANDLER, Motobox.id("mechanic_table"), new ScreenHandlerType<>(MechanicTableScreenHandler::new));
Registry.register(Registries.SCREEN_HANDLER, Motobox.id("mechanic_table"), new ScreenHandlerType<>(MechanicTableScreenHandler::new, FeatureSet.empty()));
public static final ScreenHandlerType<SingleSlotScreenHandler> SINGLE_SLOT_SCREEN =
Registry.register(Registries.SCREEN_HANDLER, Motobox.id("single_slot"), new ScreenHandlerType<>(SingleSlotScreenHandler::new));
Registry.register(Registries.SCREEN_HANDLER, Motobox.id("single_slot"), new ScreenHandlerType<>(SingleSlotScreenHandler::new, FeatureSet.empty()));
private static MinecraftServer server;

public static MinecraftServer server() {
Expand All @@ -89,6 +91,11 @@ public void onInitialize() {
MotoboxData.setup();
ControllerUtils.initMidnightControlsHandler();

// Register Item Group
Registry.register(Registries.ITEM_GROUP, Motobox.id("motobox"), GROUP);
Registry.register(Registries.ITEM_GROUP, Motobox.id("course_elements"), COURSE_ELEMENTS);
Registry.register(Registries.ITEM_GROUP, Motobox.id("prefabs"), PREFABS);

ServerLifecycleEvents.SERVER_STARTING.register(server -> Motobox.server = server);

ServerLifecycleEvents.SERVER_STOPPED.register(server -> Motobox.server = null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/motobox/block/DashPanelBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getPlacementState(ctx).with(FACING, ctx.getPlayerFacing()).with(WATERLOGGED, ctx.getWorld().getBlockState(ctx.getBlockPos()).isOf(Blocks.WATER));
return super.getPlacementState(ctx).with(FACING, ctx.getPlayerLookDirection()).with(WATERLOGGED, ctx.getWorld().getBlockState(ctx.getBlockPos()).isOf(Blocks.WATER));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/motobox/block/MechanicTableBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getPlacementState(ctx).with(FACING, ctx.getPlayerFacing().getOpposite());
return super.getPlacementState(ctx).with(FACING, ctx.getPlayerLookDirection().getOpposite());
}


Expand Down
2 changes: 1 addition & 1 deletion src/main/java/motobox/block/MotoboxBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public enum MotoboxBlocks {
public static final Block SAND_OFF_ROAD = register("sand_off_road", new OffRoadBlock(FabricBlockSettings.copyOf(Blocks.SAND).noCollision(), new Color(0xC2B185)), MotoboxBlocks::simpleItem);
public static final Block SNOW_OFF_ROAD = register("snow_off_road", new OffRoadBlock(FabricBlockSettings.copyOf(Blocks.SNOW_BLOCK).noCollision(), new Color(0xD0E7ED)), MotoboxBlocks::simpleItem);

public static final Block ASPHALT = register("asphalt", new AsphaltBlock(FabricBlockSettings.of(Material.STONE, MapColor.BLACK).requiresTool().strength(1.5f, 6.0f)), MotoboxBlocks::simpleItem);
public static final Block ASPHALT = register("asphalt", new AsphaltBlock(FabricBlockSettings.create().mapColor(MapColor.BLACK).requiresTool().strength(1.5f, 6.0f)), MotoboxBlocks::simpleItem);
public static final Block TRAFFIC_CONE = register("traffic_cone", new TrafficConeBlock(FabricBlockSettings.copyOf(Blocks.STONE).strength(0.5f, 2.0f)), MotoboxBlocks::simpleItem);
public static final Block ROADBLOCK = register("roadblock", new RoadblockBlock(FabricBlockSettings.copyOf(Blocks.GRAY_CONCRETE).requiresTool().strength(2.0f, 6.0f)), MotoboxBlocks::simpleItem);

Expand Down
7 changes: 1 addition & 6 deletions src/main/java/motobox/block/OffRoadBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class OffRoadBlock extends Block implements CourseElementItem {
public final Color color;

public OffRoadBlock(Settings settings, Color color) {
super(settings);
super(settings.pistonBehavior(PistonBehavior.DESTROY));
setDefaultState(getDefaultState().with(LAYERS, 1));
this.color = color;
}
Expand Down Expand Up @@ -56,11 +56,6 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block bl
}
}

@Override
public PistonBehavior getPistonBehavior(BlockState state) {
return PistonBehavior.DESTROY;
}

@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world, pos.down(), Direction.UP);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/motobox/block/SlopeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public BlockState getPlacementState(ItemPlacementContext ctx) {
.with(HALF, slopeCtx.getSlopeHalf())
:
super.getPlacementState(ctx)
.with(FACING, ctx.getPlayerFacing().getOpposite())
.with(FACING, ctx.getPlayerLookDirection().getOpposite())
.with(WATERLOGGED, ctx.getWorld().getBlockState(ctx.getBlockPos()).isOf(Blocks.WATER))
.with(HALF, ctx.getHitPos().y - ctx.getBlockPos().getY() > 0.5 ? BlockHalf.TOP : BlockHalf.BOTTOM);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/motobox/block/SteepSlopeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public BlockState getPlacementState(ItemPlacementContext ctx) {
.with(WATERLOGGED, ctx.getWorld().getBlockState(ctx.getBlockPos()).isOf(Blocks.WATER))
:
super.getPlacementState(ctx)
.with(FACING, ctx.getPlayerFacing().getOpposite())
.with(FACING, ctx.getPlayerLookDirection().getOpposite())
.with(WATERLOGGED, ctx.getWorld().getBlockState(ctx.getBlockPos()).isOf(Blocks.WATER));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/motobox/block/VehicleAssemblerBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getPlacementState(ctx).with(FACING, ctx.getPlayerFacing().getOpposite());
return super.getPlacementState(ctx).with(FACING, ctx.getPlayerLookDirection().getOpposite());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
import net.minecraft.particle.ParticleTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void render(VehicleAssemblerBlockEntity entity, float tickDelta, MatrixSt
for (var text : entity.label) {
matrices.push();
matrices.translate(-0.5 * textRenderer.getWidth(text), 0, 0);
textRenderer.drawWithShadow(matrices, text, 0, 0, 0xFFFFFF);
textRenderer.draw(text, 0, 0, 0xFFFFFF, true, matrices.peek().getPositionMatrix(), vertexConsumers, TextRenderer.TextLayerType.SEE_THROUGH, light, overlay);
matrices.pop();
matrices.translate(0, 12, 0);
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/motobox/entity/MotoboxEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.TagKey;

public enum MotoboxEntities {
Expand All @@ -46,9 +50,10 @@ public enum MotoboxEntities {

public static final TagKey<EntityType<?>> DASH_PANEL_BOOSTABLES = TagKey.of(Registries.ENTITY_TYPE.getKey(), Motobox.id("dash_panel_boostables"));

public static final DamageSource VEHICLE_DAMAGE_SOURCE = new VehicleDamageSource("vehicle");
public static final RegistryKey<DamageType> VEHICLE_DAMAGE_TYPE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Motobox.id("vehicle"));

public static void init() {

}

@Environment(EnvType.CLIENT)
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/motobox/entity/VehicleDamageSource.java

This file was deleted.

Loading