Skip to content

Commit

Permalink
1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
noeppi-noeppi committed Mar 7, 2023
1 parent 50960fb commit ab868f2
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 49 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
}

dependencies {
annotationProcessor fg.deobf("org.moddingx:LibX:1.19.2-4.2.5")
annotationProcessor fg.deobf("org.moddingx:LibX:1.19.3-4.3.0")

implementation fg.deobf("org.moddingx:LibX:1.19.2-4.2.5")
implementation fg.deobf("org.moddingx:LibX:1.19.3-4.3.0")
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.daemon=false

modid=travelanchors
group=de.castcrafter.travelanchors
base_version=4.1.2
base_version=4.2.0

forge_version=1.19.2-43.1.43
mappings=sugarcane_2022.10.16-1.19.2
forge_version=1.19.3-44.1.20
mappings=sugarcane_2023.02.26-1.19.3

license_name=The Apache License, Version 2.0
license_url=https://www.apache.org/licenses/LICENSE-2.0.txt
2 changes: 1 addition & 1 deletion src/main/java/de/castcrafter/travelanchors/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.moddingx.libx.base.tile.MenuBlockBE;
import org.moddingx.libx.menu.BlockEntityMenu;

@RegisterClass(registry = "BLOCK_REGISTRY", priority = 1)
@RegisterClass(registry = "BLOCK", priority = 1)
public class ModBlocks {

public static final MenuBlockBE<TileTravelAnchor, MenuTravelAnchor> travelAnchor = new BlockTravelAnchor(TravelAnchors.getInstance(), TileTravelAnchor.class, BlockEntityMenu.createMenuType(MenuTravelAnchor::new), BlockBehaviour.Properties.of(Material.METAL).sound(SoundType.METAL).strength(2.0f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.moddingx.libx.annotation.registration.Reg.Exclude;
import org.moddingx.libx.annotation.registration.RegisterClass;

@RegisterClass(registry = "ENCHANTMENT_REGISTRY")
@RegisterClass(registry = "ENCHANTMENT")
public class ModEnchantments {

@Exclude
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/castcrafter/travelanchors/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.moddingx.libx.annotation.registration.RegisterClass;
import org.moddingx.libx.base.ItemBase;

@RegisterClass(registry = "ITEM_REGISTRY")
@RegisterClass(registry = "ITEM")
public class ModItems {

public static final ItemBase travelStaff = new ItemTravelStaff(TravelAnchors.getInstance(), new Item.Properties().stacksTo(1));
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/de/castcrafter/travelanchors/Tab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package de.castcrafter.travelanchors;

import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import org.moddingx.libx.creativetab.CreativeTabX;
import org.moddingx.libx.mod.ModX;

public class Tab extends CreativeTabX {

protected Tab(ModX mod) {
super(mod);
}

@Override
protected void buildTab(CreativeModeTab.Builder builder) {
super.buildTab(builder);
builder.icon(() -> new ItemStack(ModItems.travelStaff));
}

@Override
protected void addItems(TabContext ctx) {
this.addModItems(ctx);
}
}
19 changes: 9 additions & 10 deletions src/main/java/de/castcrafter/travelanchors/TravelAnchors.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import de.castcrafter.travelanchors.network.Networking;
import de.castcrafter.travelanchors.render.TravelAnchorRenderer;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.DistExecutor;
Expand All @@ -24,18 +22,14 @@ public final class TravelAnchors extends ModXRegistration {

private static TravelAnchors instance;
private static Networking network;
private static Tab tab;

public TravelAnchors() {
super(new CreativeModeTab("travelanchors") {
@Nonnull
@Override
public ItemStack makeIcon() {
return new ItemStack(ModItems.travelStaff);
}
});
super();

instance = this;
network = new Networking(this);
tab = new Tab(this);

MinecraftForge.EVENT_BUS.register(new EventListener());
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> MinecraftForge.EVENT_BUS.addListener(TravelAnchorRenderer::renderAnchors));
Expand All @@ -51,9 +45,14 @@ public static Networking getNetwork() {
return network;
}

@Nonnull
public static Tab getTab() {
return tab;
}

@Override
protected void initRegistration(RegistrationBuilder builder) {
builder.enableRegistryTracking();
//
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.castcrafter.travelanchors.ModBlocks;
import de.castcrafter.travelanchors.TeleportHandler;
import de.castcrafter.travelanchors.TravelAnchorList;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -94,7 +95,7 @@ public VoxelShape getOcclusionShape(@Nonnull BlockState state, @Nonnull BlockGet

@Override
public void appendHoverText(@Nonnull ItemStack stack, @Nullable BlockGetter level, List<Component> tooltip, @Nonnull TooltipFlag flag) {
tooltip.add(Component.translatable("tooltip.travelanchors.travel_anchor_block"));
tooltip.add(Component.translatable("tooltip.travelanchors.travel_anchor_block").withStyle(ChatFormatting.GOLD));
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ public ScreenTravelAnchor(MenuTravelAnchor screenMenu, Inventory inv, Component
@Override
public void init() {
super.init();
this.getMinecraft().keyboardHandler.setSendRepeatsToGui(true);
this.textFieldWidget = new EditBox(this.font, this.width / 2 - 72, this.height / 2 - 63, 100, 16, Component.translatable("screen.travelanchors.search"));
this.textFieldWidget.setMaxLength(32767);
this.textFieldWidget.changeFocus(true);
this.textFieldWidget.setValue(this.menu.getBlockEntity().getName());

this.addRenderableWidget(new Button(this.width / 2 + 33, this.height / 2 - 65, 44, 20, Component.translatable("travelanchors.lock.button"), btn -> {
this.addRenderableWidget(Button.builder(Component.translatable("travelanchors.lock.button"), btn -> {
TravelAnchors.getNetwork().sendLock(this.menu.getLevel(), this.menu.getPos());
this.onClose();
}));
}).bounds(this.width / 2 + 33, this.height / 2 - 65, 44, 20).build());
}

@Override
Expand Down Expand Up @@ -74,7 +73,6 @@ public GuiEventListener getFocused() {
@Override
public void removed() {
super.removed();
this.getMinecraft().keyboardHandler.setSendRepeatsToGui(false);
if (Minecraft.getInstance().level != null) {
TravelAnchors.getNetwork().sendNameChange(this.menu.getLevel(), this.menu.getPos(), this.textFieldWidget.getValue().trim());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.castcrafter.travelanchors.ModBlocks;
import de.castcrafter.travelanchors.TravelAnchorList;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.world.level.block.entity.BlockEntityType;
Expand Down Expand Up @@ -62,8 +63,8 @@ private void writeMimic(CompoundTag tag) {
}

private void readMimic(CompoundTag tag) {
if (tag.contains("mimic")) {
BlockState state = NbtUtils.readBlockState(tag.getCompound("mimic"));
if (tag.contains("mimic") && this.level != null) {
BlockState state = NbtUtils.readBlockState(this.level.registryAccess().lookupOrThrow(Registries.BLOCK), tag.getCompound("mimic"));
if (state == ModBlocks.travelAnchor.defaultBlockState()) {
this.mimic = null;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package de.castcrafter.travelanchors.data;

import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import org.moddingx.libx.annotation.data.Datagen;
import org.moddingx.libx.datagen.provider.loot.BlockLootProviderBase;
import org.moddingx.libx.mod.ModX;

@Datagen
public class BlockLootProvider extends BlockLootProviderBase {

public BlockLootProvider(ModX mod, DataGenerator generator) {
super(mod, generator);
public BlockLootProvider(ModX mod, PackOutput output) {
super(mod, output);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.castcrafter.travelanchors.data;

import de.castcrafter.travelanchors.ModBlocks;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.moddingx.libx.annotation.data.Datagen;
import org.moddingx.libx.datagen.provider.BlockStateProviderBase;
Expand All @@ -10,8 +10,8 @@
@Datagen
public class BlockStatesProvider extends BlockStateProviderBase {

public BlockStatesProvider(ModX mod, DataGenerator generator, ExistingFileHelper fileHelper) {
super(mod, generator, fileHelper);
public BlockStatesProvider(ModX mod, PackOutput output, ExistingFileHelper fileHelper) {
super(mod, output, fileHelper);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.castcrafter.travelanchors.data;

import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.moddingx.libx.annotation.data.Datagen;
import org.moddingx.libx.datagen.provider.ItemModelProviderBase;
Expand All @@ -9,8 +9,8 @@
@Datagen
public class ItemModelsProvider extends ItemModelProviderBase {

public ItemModelsProvider(ModX mod, DataGenerator generator, ExistingFileHelper fileHelper) {
super(mod, generator, fileHelper);
public ItemModelsProvider(ModX mod, PackOutput output, ExistingFileHelper fileHelper) {
super(mod, output, fileHelper);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import de.castcrafter.travelanchors.ModBlocks;
import de.castcrafter.travelanchors.ModItems;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraftforge.common.Tags;
import org.moddingx.libx.annotation.data.Datagen;
import org.moddingx.libx.datagen.provider.recipe.RecipeProviderBase;
Expand All @@ -12,8 +12,8 @@
@Datagen
public class RecipesProvider extends RecipeProviderBase implements CraftingExtension {

public RecipesProvider(ModX mod, DataGenerator generator) {
super(mod, generator);
public RecipesProvider(ModX mod, PackOutput output) {
super(mod, output);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import org.joml.Matrix4f;
import de.castcrafter.travelanchors.ModBlocks;
import de.castcrafter.travelanchors.TeleportHandler;
import de.castcrafter.travelanchors.TravelAnchorList;
Expand Down Expand Up @@ -227,15 +227,15 @@ private record CircleRotation(float y, float z) {

public void apply(PoseStack poseStack) {
if (!Float.isNaN(this.y)) {
poseStack.mulPose(Vector3f.YP.rotation(this.y));
poseStack.mulPose(Axis.YP.rotation(this.y));
}
poseStack.mulPose(Vector3f.ZP.rotation(this.z));
poseStack.mulPose(Axis.ZP.rotation(this.z));
}

public void reverse(PoseStack poseStack) {
poseStack.mulPose(Vector3f.ZP.rotation(-this.z));
poseStack.mulPose(Axis.ZP.rotation(-this.z));
if (!Float.isNaN(this.y)) {
poseStack.mulPose(Vector3f.YP.rotation(-this.y));
poseStack.mulPose(Axis.YP.rotation(-this.y));
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader="javafml"
loaderVersion="[43,)"
loaderVersion="[44,)"
license="Apache License 2.0"

[[mods]]
Expand All @@ -17,20 +17,20 @@ Adds a staff of travelling and a travel anchor to teleport around the world.
[[dependencies.travelanchors]]
modId="forge"
mandatory=true
versionRange="[43.1.43,)"
versionRange="[44.1.20,)"
ordering="NONE"
side="BOTH"

[[dependencies.travelanchors]]
modId="minecraft"
mandatory=true
versionRange="[1.19.2,1.20)"
versionRange="[1.19.3,)"
ordering="NONE"
side="BOTH"

[[dependencies.travelanchors]]
modId="libx"
mandatory=true
versionRange="[1.19.2-4.2.5,)"
versionRange="[1.19.3-4.3.0,)"
ordering="NONE"
side="BOTH"
4 changes: 2 additions & 2 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"pack": {
"description": "TravelAnchors resources",
"pack_format": 10,
"pack_format": 12,
"forge:data_pack_format": 10,
"forge:resource_pack_format": 9
"forge:resource_pack_format": 12
}
}

0 comments on commit ab868f2

Please sign in to comment.