diff --git a/gradle.properties b/gradle.properties index 5a9fc86..fe84c79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx4G mc_version=1.11.2 forge_version=1.11.2-13.20.1.2530 -mod_version=1.3 +mod_version=1.3.1 mappings_version=stable_32 diff --git a/src/main/java/jackyy/dimensionaledibles/DimensionalEdibles.java b/src/main/java/jackyy/dimensionaledibles/DimensionalEdibles.java index b089469..91a5cb3 100644 --- a/src/main/java/jackyy/dimensionaledibles/DimensionalEdibles.java +++ b/src/main/java/jackyy/dimensionaledibles/DimensionalEdibles.java @@ -16,7 +16,7 @@ @Mod(modid = DimensionalEdibles.MODID, name = DimensionalEdibles.MODNAME, version = DimensionalEdibles.VERSION, acceptedMinecraftVersions = DimensionalEdibles.MCVERSION, dependencies = DimensionalEdibles.DEPENDS, certificateFingerprint = "@FINGERPRINT@", useMetadata = true) public class DimensionalEdibles { - public static final String VERSION = "1.3"; + public static final String VERSION = "1.3.1"; public static final String MCVERSION = "[1.11,1.12)"; public static final String MODID = "dimensionaledibles"; public static final String MODNAME = "Dimensional Edibles"; diff --git a/src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java b/src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java index 3b3039b..7d1e7aa 100644 --- a/src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java +++ b/src/main/java/jackyy/dimensionaledibles/block/BlockCustomCake.java @@ -29,6 +29,10 @@ public class BlockCustomCake extends BlockCakeBase implements ITileEntityProvider { + private int customX = 0; + private int customY = 0; + private int customZ = 0; + public BlockCustomCake() { super(); setRegistryName(DimensionalEdibles.MODID + ":custom_cake"); @@ -59,6 +63,22 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!"); } } + for (String s : ModConfig.tweaks.customEdible.customCoords) { + try { + String[] parts = s.split(","); + if (parts.length < 4) { + DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid input line! Format needs to be: , , , "); + continue; + } + if (Integer.parseInt(parts[0].trim()) == dimension) { + customX = Integer.parseInt(parts[1].trim()); + customY = Integer.parseInt(parts[2].trim()); + customZ = Integer.parseInt(parts[3].trim()); + } + } catch (NumberFormatException e) { + DimensionalEdibles.logger.log(Level.ERROR, s + " is not a valid line input! The dimension ID needs to be a number!"); + } + } if (!stack.isEmpty() && stack.getItem() == Item.REGISTRY.getObject(new ResourceLocation(fuel))) { if (meta >= 0) { world.setBlockState(pos, state.withProperty(BITES, meta), 2); @@ -70,7 +90,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } else { if (world.provider.getDimension() != dimension) { if (!world.isRemote) { - if (player.capabilities.isCreativeMode) { + if (player.capabilities.isCreativeMode || !ModConfig.tweaks.customEdible.customCake.consumeFuel) { teleportPlayer(world, player, dimension); } else { consumeCake(world, pos, player, dimension); @@ -84,7 +104,12 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En private void teleportPlayer(World world, EntityPlayer player, int dimension) { EntityPlayerMP playerMP = (EntityPlayerMP) player; - BlockPos coords = TeleporterHandler.getDimPos(playerMP, dimension, player.getPosition()); + BlockPos coords; + if (customX != 0 && customY != 0 && customZ != 0) { + coords = new BlockPos(customX, customY, customZ); + } else { + coords = TeleporterHandler.getDimPos(playerMP, dimension, player.getPosition()); + } TeleporterHandler.updateDimPos(playerMP, world.provider.getDimension(), player.getPosition()); TeleporterHandler.teleport(playerMP, dimension, coords.getX(), coords.getY(), coords.getZ(), playerMP.mcServer.getPlayerList()); } diff --git a/src/main/java/jackyy/dimensionaledibles/block/BlockEndCake.java b/src/main/java/jackyy/dimensionaledibles/block/BlockEndCake.java index 68f6a3f..ff33708 100644 --- a/src/main/java/jackyy/dimensionaledibles/block/BlockEndCake.java +++ b/src/main/java/jackyy/dimensionaledibles/block/BlockEndCake.java @@ -47,7 +47,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } else { if (world.provider.getDimension() != 1) { if (!world.isRemote) { - if (player.capabilities.isCreativeMode) { + if (player.capabilities.isCreativeMode || !ModConfig.tweaks.endCake.consumeFuel) { teleportPlayer(world, player); } else { consumeCake(world, pos, player); diff --git a/src/main/java/jackyy/dimensionaledibles/block/BlockNetherCake.java b/src/main/java/jackyy/dimensionaledibles/block/BlockNetherCake.java index c9a7f77..af12759 100644 --- a/src/main/java/jackyy/dimensionaledibles/block/BlockNetherCake.java +++ b/src/main/java/jackyy/dimensionaledibles/block/BlockNetherCake.java @@ -47,7 +47,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } else { if (world.provider.getDimension() != -1) { if (!world.isRemote) { - if (player.capabilities.isCreativeMode) { + if (player.capabilities.isCreativeMode || !ModConfig.tweaks.netherCake.consumeFuel) { teleportPlayer(world, player); } else { consumeCake(world, pos, player); diff --git a/src/main/java/jackyy/dimensionaledibles/block/BlockOverworldCake.java b/src/main/java/jackyy/dimensionaledibles/block/BlockOverworldCake.java index ed15b7f..1f16101 100644 --- a/src/main/java/jackyy/dimensionaledibles/block/BlockOverworldCake.java +++ b/src/main/java/jackyy/dimensionaledibles/block/BlockOverworldCake.java @@ -19,6 +19,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -47,7 +48,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En } else { if (world.provider.getDimension() != 0) { if (!world.isRemote) { - if (player.capabilities.isCreativeMode) { + if (player.capabilities.isCreativeMode || !ModConfig.tweaks.overworldCake.consumeFuel) { teleportPlayer(world, player); } else { consumeCake(world, pos, player); @@ -65,7 +66,12 @@ private void teleportPlayer(World world, EntityPlayer player) { if (ModConfig.tweaks.overworldCake.useCustomCoords) { coords = new BlockPos(ModConfig.tweaks.overworldCake.customCoords.x, ModConfig.tweaks.overworldCake.customCoords.y, ModConfig.tweaks.overworldCake.customCoords.z); } else { - coords = TeleporterHandler.getDimPos(playerMP, 0, player.getPosition()); + WorldServer overworld = playerMP.mcServer.getPlayerList().getServerInstance().getWorld(0); + if (ModConfig.tweaks.overworldCake.useWorldSpawn) { + coords = overworld.getTopSolidOrLiquidBlock(overworld.getSpawnPoint()); + } else { + coords = TeleporterHandler.getDimPos(playerMP, 0, player.getPosition()); + } } TeleporterHandler.updateDimPos(playerMP, world.provider.getDimension(), player.getPosition()); TeleporterHandler.teleport(playerMP, 0, coords.getX(), coords.getY(), coords.getZ(), playerMP.mcServer.getPlayerList()); diff --git a/src/main/java/jackyy/dimensionaledibles/item/ItemCustomApple.java b/src/main/java/jackyy/dimensionaledibles/item/ItemCustomApple.java index 794d1d4..38b60fb 100644 --- a/src/main/java/jackyy/dimensionaledibles/item/ItemCustomApple.java +++ b/src/main/java/jackyy/dimensionaledibles/item/ItemCustomApple.java @@ -41,10 +41,18 @@ public void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { return; } dimension = nbt.getInteger("dimID"); + int customX = nbt.getInteger("x"); + int customY = nbt.getInteger("y"); + int customZ = nbt.getInteger("z"); if (world.provider.getDimension() != dimension) { if (!world.isRemote) { EntityPlayerMP playerMP = (EntityPlayerMP) player; - BlockPos coords = TeleporterHandler.getDimPos(playerMP, dimension, player.getPosition()); + BlockPos coords; + if (customX != 0 && customY != 0 && customZ != 0) { + coords = new BlockPos(customX, customY, customZ); + } else { + coords = TeleporterHandler.getDimPos(playerMP, dimension, player.getPosition()); + } TeleporterHandler.updateDimPos(playerMP, world.provider.getDimension(), player.getPosition()); TeleporterHandler.teleport(playerMP, dimension, coords.getX(), coords.getY(), coords.getZ(), playerMP.mcServer.getPlayerList()); player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 200, 200, false, false)); @@ -74,6 +82,25 @@ public void getSubItems(@Nonnull Item item, CreativeTabs tab, NonNullList, , , "); + continue; + } + if (Integer.parseInt(coords[0].trim()) == dimension) { + nbt.setInteger("x", Integer.parseInt(coords[1].trim())); + nbt.setInteger("y", Integer.parseInt(coords[2].trim())); + nbt.setInteger("z", Integer.parseInt(coords[3].trim())); + } + } catch (NumberFormatException e) { + DimensionalEdibles.logger.log(Level.ERROR, c + " is not a valid line input! The dimension ID needs to be a number!"); + } + } list.add(stack); } else { DimensionalEdibles.logger.log(Level.ERROR, parts[0] + " is not a valid dimension ID! (Needs to be a number)"); diff --git a/src/main/java/jackyy/dimensionaledibles/item/ItemOverworldApple.java b/src/main/java/jackyy/dimensionaledibles/item/ItemOverworldApple.java index 106adb5..fff2ca0 100644 --- a/src/main/java/jackyy/dimensionaledibles/item/ItemOverworldApple.java +++ b/src/main/java/jackyy/dimensionaledibles/item/ItemOverworldApple.java @@ -15,6 +15,7 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -39,7 +40,12 @@ public void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { if (ModConfig.tweaks.overworldApple.useCustomCoords) { coords = new BlockPos(ModConfig.tweaks.overworldApple.customCoords.x, ModConfig.tweaks.overworldApple.customCoords.y, ModConfig.tweaks.overworldApple.customCoords.z); } else { - coords = TeleporterHandler.getDimPos(playerMP, 0, player.getPosition()); + WorldServer overworld = playerMP.mcServer.getPlayerList().getServerInstance().getWorld(0); + if (ModConfig.tweaks.overworldApple.useWorldSpawn) { + coords = overworld.getTopSolidOrLiquidBlock(overworld.getSpawnPoint()); + } else { + coords = TeleporterHandler.getDimPos(playerMP, 0, player.getPosition()); + } } TeleporterHandler.updateDimPos(playerMP, world.provider.getDimension(), player.getPosition()); TeleporterHandler.teleport(playerMP, 0, coords.getX(), coords.getY(), coords.getZ(), playerMP.mcServer.getPlayerList()); diff --git a/src/main/java/jackyy/dimensionaledibles/registry/ModConfig.java b/src/main/java/jackyy/dimensionaledibles/registry/ModConfig.java index 4cbb0a7..72eef69 100644 --- a/src/main/java/jackyy/dimensionaledibles/registry/ModConfig.java +++ b/src/main/java/jackyy/dimensionaledibles/registry/ModConfig.java @@ -40,6 +40,8 @@ public static class EndCake { public String fuel = "minecraft:ender_eye"; @Config.Comment("Set to true to make the End Cake pre-fueled upon placed.") public boolean preFueled = false; + @Config.Comment("Set to true to make the End Cake consume fuel.") + public boolean consumeFuel = true; @Config.Comment("Set to true to use custom coordinates for the teleportation.") public boolean useCustomCoords = false; public CustomCoords customCoords = new CustomCoords(); @@ -68,6 +70,8 @@ public static class NetherCake { public String fuel = "minecraft:obsidian"; @Config.Comment("Set to true to make the Nether Cake pre-fueled upon placed.") public boolean preFueled = false; + @Config.Comment("Set to true to make the Nether Cake consume fuel.") + public boolean consumeFuel = true; @Config.Comment("Set to true to use custom coordinates for the teleportation.") public boolean useCustomCoords = false; public CustomCoords customCoords = new CustomCoords(); @@ -96,6 +100,13 @@ public static class OverworldCake { public String fuel = "minecraft:sapling"; @Config.Comment("Set to true to make the Overworld Cake pre-fueled upon placed.") public boolean preFueled = false; + @Config.Comment("Set to true to make the Overworld Cake consume fuel.") + public boolean consumeFuel = true; + @Config.Comment({ + "Set to true to make the Overworld Apple teleport players to world spawn.", + "Otherwise, it will use the cached position." + }) + public boolean useWorldSpawn = true; @Config.Comment("Set to true to use custom coordinates for the teleportation.") public boolean useCustomCoords = false; public CustomCoords customCoords = new CustomCoords(); @@ -108,6 +119,11 @@ public static class CustomCoords { public OverworldApple overworldApple = new OverworldApple(); public static class OverworldApple { + @Config.Comment({ + "Set to true to make the Overworld Apple teleport players to world spawn.", + "Otherwise, it will use the cached position)." + }) + public boolean useWorldSpawn = true; @Config.Comment("Set to true to use custom coordinates for the teleportation.") public boolean useCustomCoords = false; public CustomCoords customCoords = new CustomCoords(); @@ -127,10 +143,18 @@ public static class CustomEdible { "Note: \"Cake\" is automatically appended onto the end of the name for cakes." }) public String[] dimensions = new String[0]; + @Config.Comment({ + "Set a list of custom coordinates used by Custom Cakes / Apples, this is optional.", + "Format: , , , ", + "Example: 0, 420, 123, -420" + }) + public String[] customCoords = new String[0]; public CustomCake customCake = new CustomCake(); public static class CustomCake { @Config.Comment("Set to true to make all Custom Cakes pre-fueled upon placed.") public boolean preFueled = false; + @Config.Comment("Set to true to make all Custom Cakes consume fuel.") + public boolean consumeFuel = true; @Config.Comment({ "Set the fuel used by Custom Cakes.", "Format: , ", diff --git a/src/main/java/jackyy/dimensionaledibles/util/TeleporterHandler.java b/src/main/java/jackyy/dimensionaledibles/util/TeleporterHandler.java index 71af311..da8f036 100644 --- a/src/main/java/jackyy/dimensionaledibles/util/TeleporterHandler.java +++ b/src/main/java/jackyy/dimensionaledibles/util/TeleporterHandler.java @@ -58,7 +58,7 @@ public static void teleport(EntityPlayerMP player, int dim, double x, double y, if (!player.capabilities.isCreativeMode) { player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 200, 200, false, false)); } - if (worldServer1.provider.getDimension() == -1) { + if (worldServer1.provider.getDimension() != 0) { for (int xx = -1; xx <= 1; xx++) { for (int zz = -1; zz <= 1; zz++) { if (!worldServer1.getBlockState(pos.add(xx, 0, zz)).isFullBlock()) { @@ -155,16 +155,6 @@ public static BlockPos getValidYSpawnPos(World world, BlockPos basePos) { pos.move(EnumFacing.DOWN); } } - if (!foundSpawnPos) { - pos.setPos(basePos); - for (int x = -1; x < 2; x++) { - for (int z = -1; z < 2; z++) { - world.setBlockState(pos.add(x, -1, z), Blocks.OBSIDIAN.getDefaultState()); - world.setBlockToAir(pos.add(x, 0, z)); - world.setBlockToAir(pos.add(x, 1, z)); - } - } - } return pos; } diff --git a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_0.png b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_0.png index e689830..dce5ffb 100644 Binary files a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_0.png and b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_0.png differ diff --git a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_1.png b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_1.png index 0b90779..5928b04 100644 Binary files a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_1.png and b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_1.png differ diff --git a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_2.png b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_2.png index f847668..f730591 100644 Binary files a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_2.png and b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_2.png differ diff --git a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_3.png b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_3.png index b6e03af..1dc02b1 100644 Binary files a/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_3.png and b/src/main/resources/assets/dimensionaledibles/textures/blocks/custom_cake/custom_cake_3.png differ diff --git a/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png b/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png index 06e3753..de87528 100644 Binary files a/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png and b/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png differ diff --git a/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png.mcmeta b/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png.mcmeta deleted file mode 100644 index 8e55e43..0000000 --- a/src/main/resources/assets/dimensionaledibles/textures/items/custom_apple.png.mcmeta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "animation": { - "frametime": 3 - } -} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 3e38088..0218f0e 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "dimensionaledibles", "name": "Dimensional Edibles", "description": "Travel through dimensions with food!", - "version": "1.3", + "version": "1.3.1", "mcversion": "1.11.2", "url": "https://github.com/JackyyTV/DimensionalEdibles", "updateUrl": "",