Skip to content

Commit

Permalink
- Upgrades can now setPosition in the screen with doubles
Browse files Browse the repository at this point in the history
- Tidied up translations
- Removed Drill recipe
  • Loading branch information
Jeryn99 committed Jan 14, 2024
1 parent 26b2d84 commit 1cc779e
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class TardisRefined {
public static final boolean KeySummonsItem = false;

public static final String MODID = "tardis_refined";
public static final String NAME = "Tardis Refined";
public static final String PLATFORM_ERROR = "Something has gone critically wrong with platform definitions. Please contact the mod author.";

public static final Logger LOGGER = LogUtils.getLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void render(ControlEntity entity, float f, float g, PoseStack poseStack,

@Override
protected void renderNameTag(ControlEntity entity, Component component, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLightCoords) {
MutableComponent textComponent = Component.literal(component.getString());
MutableComponent textComponent = component.copy();
textComponent.withStyle(style -> style
.applyFormats(ChatFormatting.BOLD, (entity.level().getGameTime() % 60 == 0) ? ChatFormatting.GOLD : ChatFormatting.YELLOW)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import whocraft.tardis_refined.common.capability.TardisLevelOperator;

Expand All @@ -19,7 +20,7 @@ public class Upgrade {
private final UpgradeType upgradeType;
private int cost = 1;
private boolean posSet = false;
private int posX = 0, posY = 0;
private double posX = 0, posY = 0;
private final Supplier<ItemStack> icon;

public enum UpgradeType {
Expand Down Expand Up @@ -82,11 +83,11 @@ public Upgrade setPosition(int x, int y) {
}

@Nullable
public Vec2 getScreenPosition() {
public Vec3 getScreenPosition() {
if (!this.posSet) {
return null;
}
return new Vec2(this.posX, this.posY);
return new Vec3(this.posX, this.posY, 0);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ private void handleLeftClick(Player player, ServerLevel serverLevel){
} else {
UpgradeHandler upgradeHandler = cap.getUpgradeHandler();
upgradeHandler.addUpgradeXP(5);
upgradeHandler.setUpgradePoints(50000);

serverLevel.addParticle(ParticleTypes.HEART, consoleBlockPos.getX() + 0.5, consoleBlockPos.getY() + 2, consoleBlockPos.getZ() + 0.5, 0, 0.5, 0);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private static void addDefaultHum(HumEntry hum) {
DEFAULT_HUMS.put(hum.getIdentifier(), hum);
}


/**
* Gets a default HumEntry added by Tardis Refined. Useful as a fallback entry.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import whocraft.tardis_refined.common.util.Platform;
import whocraft.tardis_refined.common.util.PlayerUtil;
import whocraft.tardis_refined.constants.ModMessages;
import whocraft.tardis_refined.constants.NbtConstants;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -58,16 +59,16 @@ public static ItemStack addTardis(ItemStack itemStack, ResourceKey<Level> levelR
StringTag dim = StringTag.valueOf(levelResourceKey.location().toString());

ListTag keychain;
if (!itemtag.contains("keychain", CompoundTag.TAG_LIST)) {
if (!itemtag.contains(NbtConstants.KEYCHAIN, CompoundTag.TAG_LIST)) {
// Create a new keychain tag and add it to the itemtag object
keychain = new ListTag();
itemtag.put("keychain", keychain);
itemtag.put(NbtConstants.KEYCHAIN, keychain);
} else {
// Get the existing keychain tag from the itemtag object
keychain = itemtag.getList("keychain", Tag.TAG_STRING);
keychain = itemtag.getList(NbtConstants.KEYCHAIN, Tag.TAG_STRING);
}

// Add dim to the keychain, whether or not it already exists in the keychain
// Add dim to the keychain, whether it already exists in the keychain
keychain.add(dim);

itemStack.setTag(itemtag);
Expand All @@ -77,13 +78,13 @@ public static ItemStack addTardis(ItemStack itemStack, ResourceKey<Level> levelR
public static void setKeychain(ItemStack itemStack, ArrayList<ResourceKey<Level>> levels) {
CompoundTag nbt = itemStack.getOrCreateTag();
ListTag keychain;
if (!nbt.contains("keychain", CompoundTag.TAG_LIST)) {
if (!nbt.contains(NbtConstants.KEYCHAIN, CompoundTag.TAG_LIST)) {
// Create a new keychain tag and add it to the itemtag object
keychain = new ListTag();
nbt.put("keychain", keychain);
nbt.put(NbtConstants.KEYCHAIN, keychain);
} else {
// Get the existing keychain tag from the itemtag object
keychain = nbt.getList("keychain", Tag.TAG_STRING);
keychain = nbt.getList(NbtConstants.KEYCHAIN, Tag.TAG_STRING);
}

keychain.clear();
Expand All @@ -99,11 +100,11 @@ public static ArrayList<ResourceKey<Level>> getKeychain(ItemStack itemStack) {
CompoundTag nbt = itemStack.getOrCreateTag();


if (!nbt.contains("keychain")) {
if (!nbt.contains(NbtConstants.KEYCHAIN)) {
return new ArrayList<>();
}

ListTag keychain = nbt.getList("keychain", Tag.TAG_STRING);
ListTag keychain = nbt.getList(NbtConstants.KEYCHAIN, Tag.TAG_STRING);

ArrayList<ResourceKey<Level>> levels = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import whocraft.tardis_refined.common.capability.TardisLevelOperator;
import whocraft.tardis_refined.compat.portals.ImmersivePortals;
import whocraft.tardis_refined.compat.portals.TardisPortalData;
import whocraft.tardis_refined.constants.NbtConstants;

import java.util.UUID;

Expand Down Expand Up @@ -48,14 +49,14 @@ private void onTick(CallbackInfo ci) {
@Inject(method = "addAdditionalSaveData", at = @At(value = "INVOKE", target = "Lqouteall/q_misc_util/my_util/SignalBiArged;emit(Ljava/lang/Object;Ljava/lang/Object;)V", shift = At.Shift.AFTER), remap = true)
private void addTARDISData(CompoundTag compoundTag, CallbackInfo ci) {
if (tardisID != null) {
compoundTag.putUUID("tardis_id", tardisID);
compoundTag.putUUID(NbtConstants.TARDIS_ID, tardisID);
}
}

@Inject(method = "readAdditionalSaveData", at = @At(value = "INVOKE", target = "Lqouteall/q_misc_util/my_util/SignalBiArged;emit(Ljava/lang/Object;Ljava/lang/Object;)V", shift = At.Shift.AFTER), remap = true)
private void readTARDISData(CompoundTag compoundTag, CallbackInfo ci) {
if (compoundTag.contains("tardis_id")) {
tardisID = compoundTag.getUUID("tardis_id");
if (compoundTag.contains(NbtConstants.TARDIS_ID)) {
tardisID = compoundTag.getUUID(NbtConstants.TARDIS_ID);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static boolean safetyCheck(Entity pEntity, ServerLevel destination, doubl
int zRound = (int) pZ;
BlockPos blockpos = new BlockPos(xRound, yRound, zRound);

if (teleportedEntities.size() != 0){
if (!teleportedEntities.isEmpty()){
if (teleportedEntities.contains(pEntity)){ //If we are calling this method by itself such as teleporting passengers, check if we have already teleported the entity
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ public class ModMessages {

/* Related Links*/

public static String GITHUB_RELEASE_PAGE = "https://github.com/CommandrMoose/TardisRefined/releases";
public static String GITHUB_RELEASE_PAGE = "https://github.com/Suff99/TardisRefined/releases";

/*Item Special cases*/
public static String ITEM_KEYCHAIN = "item."+ TardisRefined.MODID + ".keychain";
public static String ITEM_GROUP = "itemGroup."+ TardisRefined.MODID;

/*Messages*/
public static String MSG_EXTERIOR_COOLDOWN = message("exterior_cooldown");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class NbtConstants {
public static final String LOCATION_ROTATION = "_location_rotation";
public static final String LOCATION_DIMENSION_MODID = "_location_dimension_id";
public static final String LOCATION_DIMENSION_PATH = "_location_dimension_path";
public static final String KEYCHAIN = "keychain";


public static TardisNavLocation getTardisNavLocation(CompoundTag tag, String prefix, TardisLevelOperator operator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import whocraft.tardis_refined.TardisRefined;
import whocraft.tardis_refined.constants.ModMessages;
import whocraft.tardis_refined.registry.BlockRegistry;
import whocraft.tardis_refined.registry.ItemRegistry;
import whocraft.tardis_refined.registry.RegistrySupplier;
Expand All @@ -15,7 +17,7 @@ public class ItemRegistryImpl {
for (RegistrySupplier<Item> item : ItemRegistry.TAB_ITEMS) {
entries.accept(item.get());
}
}).title(Component.literal("TARDIS Refined")).build();
}).title(Component.translatable(ModMessages.ITEM_GROUP)).build();

public static CreativeModeTab getCreativeTab() {
return ITEM_GROUP;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// 1.20.2 2024-01-01T17:33:21.0627898 Recipes
// 1.20.2 2024-01-14T23:53:42.4627587 Recipes
8719cd0f4220434f5c4e19b250d9baf0b7962d26 data/tardis_refined/advancements/recipes/misc/bulk_head_door.json
8269c68dc027027860af7f3e0ffac15e933a3fe7 data/tardis_refined/advancements/recipes/misc/console_configuration.json
d920b09dc43fa8d136406e6e132abfb8f6edcacc data/tardis_refined/advancements/recipes/misc/drill.json
9ec080eb7996f790d97817418ce0ee1600744ad9 data/tardis_refined/advancements/recipes/misc/flight_detector.json
3517c6c5d953a58d80a1fb7b27b107811b494061 data/tardis_refined/advancements/recipes/misc/landing_pad.json
c4dd71075e63198517197c864403feb215e88940 data/tardis_refined/advancements/recipes/misc/pattern_manipulator.json
Expand All @@ -10,7 +9,6 @@ c4dd25640e0a886e45c91898700a2c35fdb92074 data/tardis_refined/advancements/recipe
7dee5b3df1d2cbe4c056edfcb5aab5054102a4ac data/tardis_refined/advancements/recipes/misc/terraformer.json
d400b9f20cbd1dc0bc11a850635fa28b966ff7d5 data/tardis_refined/recipes/bulk_head_door.json
4666b8617b9a065d2c926af0f7fb6821ed0c1b20 data/tardis_refined/recipes/console_configuration.json
d1e2989b203305af597e11a55886a4758c149e8d data/tardis_refined/recipes/drill.json
aeff2b97cf7999f3ce94958e601a9de47a063e64 data/tardis_refined/recipes/flight_detector.json
abf11434010283396343e74ef6aec49e1c020d50 data/tardis_refined/recipes/landing_pad.json
35b8e0b89942aac1d2f8d6f5d967e521f7660d95 data/tardis_refined/recipes/pattern_manipulator.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.2 2024-01-04T14:11:23.4542146 Languages: en_us
915e4cb02a088556cc10e98579c2d3af6b233d85 assets/tardis_refined/lang/en_us.json
// 1.20.2 2024-01-11T20:27:20.9453178 Languages: en_us
d823821308366c43506d49e6b70cbd3f33be891c assets/tardis_refined/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"item.tardis_refined.pattern_manipulator": "Pattern Manipulator",
"item.tardis_refined.tardis_key": "Tardis Key",
"itemGroup.tardis_refined": "Tardis Refined",
"itemGroup.tardis_refined.tardis_refined": "Tardis Refined",
"message.tardis_refined.exterior_cooldown": "You must wait %s seconds",
"message.tardis_refined.key_bound": "Key Bound to %s",
"message.tardis_refined.key_cycled": "Main: %s",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected void addTranslations() {
add(ItemRegistry.KEY.get(), "Tardis Key");
add(ItemRegistry.DRILL.get(), "Growth Drill");
add(ModMessages.ITEM_KEYCHAIN, "Tardis Keyset");
add(ModMessages.ITEM_GROUP, "Tardis Refined");

/*Entity*/
add(EntityRegistry.CONTROL_ENTITY.get(), "Generic Control");
Expand Down Expand Up @@ -111,11 +112,6 @@ protected void addTranslations() {
add(ModMessages.CMD_ARG_DESKTOP_INVALID, "Invalid Desktop of ID %s");
add(ModMessages.CMD_ARG_SHELL_INVALID, "Invalid Shell of ID %s");


/*Creative Tab*/
add("itemGroup.tardis_refined.tardis_refined", "Tardis Refined");
add("itemGroup.tardis_refined", "Tardis Refined");

/*GUI*/
add(ModMessages.UI_MONITOR_MAIN_TITLE, "COMPUTER BANK");
add(ModMessages.UI_MONITOR_WAYPOINTS, "WAYPOINTS");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected void buildRecipes(RecipeOutput consumer) {
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, BlockRegistry.BULK_HEAD_DOOR.get()).pattern(" L ").pattern("PDP").pattern("RDR").define('L', Blocks.REDSTONE_LAMP).define('P', Blocks.PISTON).define('D', Blocks.IRON_DOOR).define('R', Blocks.REDSTONE_WIRE).unlockedBy("has_crafting_table", has(Blocks.TARGET)).save(consumer);

ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ItemRegistry.PATTERN_MANIPULATOR.get()).pattern("RCL").pattern("EAE").pattern(" S ").define('S', Items.STICK).define('E', Items.REDSTONE).define('A', Items.IRON_INGOT).define('R', Items.RED_DYE).define('C', Items.GREEN_DYE).define('L', Items.LAPIS_LAZULI).unlockedBy("has_crafting_table", has(BlockRegistry.CONSOLE_CONFIGURATION_BLOCK.get())).save(consumer);
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ItemRegistry.DRILL.get()).pattern(" P ").pattern("PCP").pattern("IRI").define('P', Items.IRON_PICKAXE).define('R', Items.REDSTONE).define('I', Items.IRON_INGOT).define('C', Items.COBBLESTONE).unlockedBy("has_crafting_table", has(Items.REDSTONE)).save(consumer);
// Commented because it really has no use anymore; ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ItemRegistry.DRILL.get()).pattern(" P ").pattern("PCP").pattern("IRI").define('P', Items.IRON_PICKAXE).define('R', Items.REDSTONE).define('I', Items.IRON_INGOT).define('C', Items.COBBLESTONE).unlockedBy("has_crafting_table", has(Items.REDSTONE)).save(consumer);
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, BlockRegistry.FLIGHT_DETECTOR.get()).pattern("G G").pattern("IDI").pattern("III").define('G', Items.GOLD_INGOT).define('I', Items.IRON_INGOT).define('D', Blocks.DAYLIGHT_DETECTOR).unlockedBy("has_daylight_detector", has(Blocks.DAYLIGHT_DETECTOR)).save(consumer);

ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ItemRegistry.KEY.get()).requires(Items.IRON_INGOT).requires(Items.TRIPWIRE_HOOK).unlockedBy("has_crafting_table", has(Blocks.TRIPWIRE_HOOK)).save(consumer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import whocraft.tardis_refined.constants.ModMessages;
import whocraft.tardis_refined.registry.BlockRegistry;

public class ItemRegistryImpl {
public static CreativeModeTab getCreativeTab() {
return CreativeModeTab.builder().title(Component.translatable("Tardis Refined")).icon(() -> new ItemStack(BlockRegistry.GLOBAL_CONSOLE_BLOCK.get())).build();
return CreativeModeTab.builder().title(Component.translatable(ModMessages.ITEM_GROUP)).icon(() -> new ItemStack(BlockRegistry.GLOBAL_CONSOLE_BLOCK.get())).build();
}

}

0 comments on commit 1cc779e

Please sign in to comment.