Skip to content

Commit

Permalink
levita + surtum rework
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Mar 24, 2024
1 parent 1075284 commit 24ba2fc
Show file tree
Hide file tree
Showing 32 changed files with 347 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.id.paradiselost.entities.block.FloatingBlockEntity;
import net.id.paradiselost.entities.util.FloatingBlockHelperImpls;
import net.id.paradiselost.items.tools.base_tools.GravityWandItem;
import net.id.paradiselost.tag.ParadiseLostBlockTags;
import net.id.incubus_core.blocklikeentities.api.BlockLikeEntity;
import net.id.incubus_core.blocklikeentities.api.BlockLikeSet;
Expand All @@ -10,6 +11,7 @@
import net.minecraft.block.piston.PistonHandler;
import net.minecraft.item.Item;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.*;
import net.minecraft.world.World;

Expand Down Expand Up @@ -126,10 +128,15 @@ static boolean isToolAdequate(ItemUsageContext context) {
BlockState state = world.getBlockState(pos);
Item heldItem = context.getStack().getItem();
return world.getBlockEntity(pos) == null && state.getHardness(world, pos) != -1.0F
&& (!state.isToolRequired() || heldItem.isSuitableFor(state))
&& (!state.isToolRequired() || heldItem.isSuitableFor(state) || (heldItem instanceof GravityWandItem && validForWand(state)))
&& !state.isIn(ParadiseLostBlockTags.NON_FLOATERS);
}

static boolean validForWand(BlockState bs) {
return !bs.isIn(BlockTags.NEEDS_DIAMOND_TOOL);
}


/**
* A structure builder intended to aid the creation of floating block structures.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private static Settings grassBlock() {
// Soil Blocks
public static final Block DIRT = add("dirt", new Block(copy(Blocks.DIRT).strength(0.3f)), tillable(), flattenable());
public static final Block COARSE_DIRT = add("coarse_dirt", new Block(copy(Blocks.DIRT).strength(0.3f)), coarseTillable(), flattenable());
public static final FloatingBlock LEVITA = add("levita", new FloatingBlock(false, copy(Blocks.GRAVEL).strength(0.3f)));
public static final Block PERMAFROST = add("permafrost", new Block(copy(Blocks.DIRT).strength(2f).sounds(BlockSoundGroup.GILDED_BLACKSTONE)), flattenable());
public static final FarmlandBlock FARMLAND = add("farmland", new ParadiseLostFarmlandBlock(copy(Blocks.FARMLAND)));
public static final ParadiseLostDirtPathBlock DIRT_PATH = add("grass_path", new ParadiseLostDirtPathBlock(copy(Blocks.DIRT_PATH)));
Expand Down Expand Up @@ -369,9 +370,10 @@ private static Settings flower() {
public static final OreBlock SURTRUM = add("surtrum", new SurtrumOreBlock(of(Material.STONE).sounds(BlockSoundGroup.NETHER_GOLD_ORE).requiresTool().strength(9f, 20f), UniformIntProvider.create(2, 5)));
public static final Block METAMORPHIC_SHELL = add("metamorphic_shell", new Block(of(Material.STONE).sounds(BlockSoundGroup.TUFF).requiresTool().strength(40f, 15f)));
public static final PoofBlock SURTRUM_AIR = add("surtrum_air", new PoofBlock(of(Material.FIRE).sounds(BlockSoundGroup.NETHER_GOLD_ORE)));
public static final FloatingBlock LEVITA_ORE = add("levita_ore", new FloatingBlock(false, of(Material.STONE).requiresTool().strength(4f), UniformIntProvider.create(4, 7)));
public static final Block CHERINE_BLOCK = add("cherine_block", new Block(of(Material.METAL).requiresTool().strength(3f, -1f).sounds(BlockSoundGroup.STONE)));
public static final Block OLVITE_BLOCK = add("olvite_block", new Block(of(Material.METAL).requiresTool().strength(3f, -1f).sounds(BlockSoundGroup.METAL)));
public static final FloatingBlock REFINED_SURTRUM_BLOCK = add("refined_surtrum_block", new FloatingBlock(false, of(Material.METAL).requiresTool().strength(4f, -1f).sounds(BlockSoundGroup.METAL)));
public static final Block REFINED_SURTRUM_BLOCK = add("refined_surtrum_block", new Block(of(Material.METAL).requiresTool().strength(4f, -1f).sounds(BlockSoundGroup.METAL)));
// Misc
public static final FloatingBlock LEVITATOR = add("levitator", new FloatingBlock(true, of(Material.WOOD).strength(3f, 3f).sounds(BlockSoundGroup.WOOD)));
public static final ChainBlock OLVITE_CHAIN = add("olvite_chain", new ChainBlock(copy(CHAIN)), cutoutMippedRenderLayer);
Expand Down
235 changes: 118 additions & 117 deletions src/main/java/net/id/paradiselost/items/ParadiseLostItems.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.id.paradiselost.items.tools.base_tools;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.*;

public class GravityWandItem extends Item {
public GravityWandItem(Settings settings) {
super(settings);
}

@Override
public ActionResult useOnEntity(ItemStack stack, PlayerEntity player, LivingEntity entity, Hand hand) {
return GravityTool.flipEntity(stack, player, entity, hand);
}

@Override
public ActionResult useOnBlock(ItemUsageContext context) {
return GravityTool.tryFloatBlock(context, super.useOnBlock(context));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.id.paradiselost.mixin.enchantment;

import net.id.paradiselost.tag.ParadiseLostItemTags;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EnchantmentHelper.class)
public class EnchantmentHelperMixin {

@Inject(method = "getFireAspect", at = @At("HEAD"), cancellable = true)
private static void getFireAspect(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
if (entity.getStackInHand(entity.getActiveHand()).isIn(ParadiseLostItemTags.IGNITING_TOOLS)) cir.setReturnValue(2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class ParadiseLostItemTags {
public static final TagKey<Item> MOA_TEMPTABLES = register("entity/moa_temptables");
public static final TagKey<Item> RIGHTEOUS_WEAPONS = register("tool/righteous_weapons");
public static final TagKey<Item> SACRED_WEAPONS = register("tool/sacred_weapons");
public static final TagKey<Item> IGNITING_TOOLS = register("tool/igniting_tools");

private static TagKey<Item> register(String id) {
return TagKey.of(Registry.ITEM_KEY, ParadiseLost.locate(id));
Expand Down
10 changes: 4 additions & 6 deletions src/main/resources/asset_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ def generate_slab_block(block_id, base_block_id, texture):



generate_standard_block("heliolith")
generate_stairs_block("heliolith_stairs", "heliolith")
generate_slab_block("heliolith_slab", "heliolith", "heliolith")
generate_standard_block("smooth_heliolith")
generate_stairs_block("smooth_heliolith_stairs", "smooth_heliolith")
generate_slab_block("smooth_heliolith_slab", "smooth_heliolith", "smooth_heliolith")
generate_standard_block("levita")
generate_standard_block("levita_ore")
generate_standard_item("levita_gem")
generate_standard_item("levita_wand")



Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "paradise_lost:block/levita"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "paradise_lost:block/levita_ore"
}
}
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/paradise_lost/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"block.paradise_lost.dirt": "Paradise Dirt",
"block.paradise_lost.coarse_dirt": "Coarse Paradise Dirt",
"block.paradise_lost.permafrost": "Permafrost",
"block.paradise_lost.levita": "Levita Precipitate",
"block.paradise_lost.farmland": "Paradise Farmland",
"block.paradise_lost.grass_path": "Paradise Grass Path",
"block.paradise_lost.packed_swedroot": "Packed Swedroot",
Expand Down Expand Up @@ -239,6 +240,7 @@
"block.paradise_lost.olvite_ore": "Olvite Ore",
"block.paradise_lost.surtrum": "Surtrum",
"block.paradise_lost.metamorphic_shell": "Metamorphic Shell",
"block.paradise_lost.levita_ore": "Levita Ore",
"block.paradise_lost.cherine_block": "Block of Cherine",
"block.paradise_lost.olvite_block": "Block of Olvite",
"block.paradise_lost.refined_surtrum_block": "Block of Refined Surtrum",
Expand Down Expand Up @@ -287,6 +289,7 @@
"item.paradise_lost.olvite_nugget": "Olvite Nugget",
"item.paradise_lost.refined_surtrum": "Refined Surtrum",
"item.paradise_lost.raw_surtrum": "Surtrum Fragment",
"item.paradise_lost.levita_gem": "Levita Bead",
"item.paradise_lost.flax_thread" : "Flax Thread",
"item.paradise_lost.flaxweave" : "Flaxweave",
"item.paradise_lost.swedroot_pulp": "Swedroot Pulp",
Expand All @@ -312,6 +315,7 @@
"item.paradise_lost.cold_parachute": "Cold Parachute",
"item.paradise_lost.golden_parachute": "Golden Parachute",

"item.paradise_lost.levita_wand": "Levitation Wand",
"item.paradise_lost.cherine_bloodstone": "Cherine Bloodstone",
"item.paradise_lost.olvite_bloodstone": "Olvite Bloodstone",
"item.paradise_lost.surtrum_bloodstone": "Surtrum Bloodstone",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "paradise_lost:block/levita"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "paradise_lost:block/levita_ore"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "paradise_lost:block/levita"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "paradise_lost:item/levita_gem"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "paradise_lost:block/levita_ore"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "paradise_lost:item/handheld_small",
"textures": {
"layer0": "paradise_lost:item/levita_wand"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "paradise_lost:levita"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "paradise_lost:levita_ore"
},
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops"
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "paradise_lost:levita_gem"
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "minecraft:blasting",
"ingredient": {
"item": "paradise_lost:levita_ore"
},
"result": "paradise_lost:levita_gem",
"experience": 1.2,
"cookingtime": 100
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "paradise_lost:levita_ore"
},
"result": "paradise_lost:levita_gem",
"experience": 1.2,
"cookingtime": 200
}
19 changes: 19 additions & 0 deletions src/main/resources/data/paradise_lost/recipes/levita_wand.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" X",
" # ",
"# "
],
"key": {
"#": {
"item": "minecraft:stick"
},
"X": {
"item": "paradise_lost:levita_gem"
}
},
"result": {
"item": "paradise_lost:levita_wand"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"key": {
"G": {
"item": "paradise_lost:refined_surtrum"
"item": "paradise_lost:levita_gem"
},
"S": {
"item": "paradise_lost:floestone_brick"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"paradise_lost:levita",
"paradise_lost:grass_path",
"paradise_lost:farmland",
"#paradise_lost:dirt_blocks",
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/data/paradise_lost/tags/blocks/ores.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"values": [
"paradise_lost:cherine_ore",
"paradise_lost:olvite_ore",
"paradise_lost:surtrum"
"paradise_lost:surtrum",
"paradise_lost:levita_ore"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum"
"paradise_lost:surtrum",
"paradise_lost:levita_ore"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"paradise_lost:surtrum_shovel",
"paradise_lost:surtrum_pickaxe",
"paradise_lost:surtrum_axe",
"paradise_lost:surtrum_sword",
"paradise_lost:surtrum_hoe"
]
}
1 change: 1 addition & 0 deletions src/main/resources/paradise_lost.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"block.CropBlockMixin",
"block.EnchantingTableBlockMixin",
"block.FarmlandBlockMixin",
"enchantment.EnchantmentHelperMixin",
"entity.CowEntityMixin",
"entity.EntityMixin",
"entity.LivingEntityMixin",
Expand Down

0 comments on commit 24ba2fc

Please sign in to comment.