调整了载具破坏方块的实现方式
This commit is contained in:
parent
afad6e8a40
commit
1771b5d91b
6 changed files with 62 additions and 18 deletions
|
@ -1,5 +1,7 @@
|
|||
// 1.20.1 2024-12-19T16:59:33.32352 Tags for minecraft:block mod id superbwarfare
|
||||
// 1.20.1 2025-02-12T01:37:34.4011277 Tags for minecraft:block mod id superbwarfare
|
||||
0acfd31854bf15f2c108138b3df7206bd2593e6b data/minecraft/tags/blocks/mineable/axe.json
|
||||
8965b7e0b3f7494b78b596ed00b9721b483b0796 data/minecraft/tags/blocks/mineable/pickaxe.json
|
||||
3da7f021790388a122717f16f51c7ec5232eebcb data/minecraft/tags/blocks/mineable/shovel.json
|
||||
f42a8c01336e64b74da966f03d45ee0d60ac5d6b data/minecraft/tags/blocks/needs_iron_tool.json
|
||||
eab6a1cfa3306b0dbf0c0c347fc135b8447fad83 data/superbwarfare/tags/blocks/hard_collision.json
|
||||
a51086ebba958e75552ea6c02a068924e0d78fad data/superbwarfare/tags/blocks/soft_collision.json
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"values": [
|
||||
"#minecraft:logs",
|
||||
"#minecraft:planks",
|
||||
"#forge:glass",
|
||||
"#forge:glass_panes",
|
||||
"minecraft:ice",
|
||||
"minecraft:frosted_ice",
|
||||
"minecraft:packed_ice",
|
||||
"minecraft:blue_ice"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"values": [
|
||||
"#minecraft:leaves",
|
||||
"#minecraft:fences",
|
||||
"#minecraft:fence_gates",
|
||||
"#minecraft:doors",
|
||||
"#minecraft:trapdoors",
|
||||
"#minecraft:walls",
|
||||
"minecraft:cactus",
|
||||
"minecraft:bamboo",
|
||||
"minecraft:melon",
|
||||
"minecraft:pumpkin",
|
||||
"minecraft:hay_block",
|
||||
"minecraft:bell",
|
||||
"minecraft:chain",
|
||||
"minecraft:snow_block",
|
||||
"minecraft:cobweb"
|
||||
]
|
||||
}
|
|
@ -2,15 +2,19 @@ package com.atsuishio.superbwarfare.datagen;
|
|||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.init.ModBlocks;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.data.BlockTagsProvider;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ModBlockTagProvider extends BlockTagsProvider {
|
||||
|
||||
public ModBlockTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
|
||||
|
@ -31,5 +35,13 @@ public class ModBlockTagProvider extends BlockTagsProvider {
|
|||
ModBlocks.SILVER_BLOCK.get(), ModBlocks.JUMP_PAD.get(), ModBlocks.CONTAINER.get(), ModBlocks.CHARGING_STATION.get(),
|
||||
ModBlocks.FUMO_25.get());
|
||||
this.tag(BlockTags.MINEABLE_WITH_SHOVEL).add(ModBlocks.SANDBAG.get());
|
||||
|
||||
this.tag(ModTags.Blocks.SOFT_COLLISION)
|
||||
.addTags(BlockTags.LEAVES, BlockTags.FENCES, BlockTags.FENCE_GATES, BlockTags.DOORS, BlockTags.TRAPDOORS, BlockTags.WALLS)
|
||||
.add(Blocks.CACTUS, Blocks.BAMBOO, Blocks.MELON, Blocks.PUMPKIN, Blocks.HAY_BLOCK, Blocks.BELL, Blocks.CHAIN, Blocks.SNOW_BLOCK,
|
||||
Blocks.COBWEB);
|
||||
this.tag(ModTags.Blocks.HARD_COLLISION)
|
||||
.addTags(BlockTags.LOGS, BlockTags.PLANKS, Tags.Blocks.GLASS, Tags.Blocks.GLASS_PANES)
|
||||
.add(Blocks.ICE, Blocks.FROSTED_ICE, Blocks.PACKED_ICE, Blocks.BLUE_ICE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.atsuishio.superbwarfare.entity.projectile.LaserEntity;
|
|||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -18,7 +19,6 @@ import net.minecraft.network.syncher.SynchedEntityData;
|
|||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.AreaEffectCloud;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -33,7 +33,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.entity.EntityTypeTest;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Math;
|
||||
|
@ -105,14 +104,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
|
|||
AABB aabb = getBoundingBox().move(this.getDeltaMovement().scale(0.6));
|
||||
BlockPos.betweenClosedStream(aabb).forEach((pos) -> {
|
||||
BlockState blockstate = this.level().getBlockState(pos);
|
||||
if (blockstate.is(Blocks.CACTUS)
|
||||
|| blockstate.is(BlockTags.LEAVES) || blockstate.is(BlockTags.FENCES)
|
||||
|| blockstate.is(BlockTags.FENCE_GATES) || blockstate.is(BlockTags.DOORS)
|
||||
|| blockstate.is(BlockTags.TRAPDOORS) || blockstate.is(Blocks.BAMBOO)
|
||||
|| blockstate.is(Blocks.MELON) || blockstate.is(Blocks.PUMPKIN)
|
||||
|| blockstate.is(Blocks.HAY_BLOCK) || blockstate.is(Blocks.BELL)
|
||||
|| blockstate.is(BlockTags.WALLS) || blockstate.is(Blocks.CHAIN)
|
||||
|| blockstate.is(Blocks.SNOW_BLOCK)) {
|
||||
if (blockstate.is(ModTags.Blocks.SOFT_COLLISION)) {
|
||||
this.level().destroyBlock(pos, true);
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.96));
|
||||
}
|
||||
|
@ -127,10 +119,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity {
|
|||
AABB aabb = getBoundingBox().move(this.getDeltaMovement().scale(0.6));
|
||||
BlockPos.betweenClosedStream(aabb).forEach((pos) -> {
|
||||
BlockState blockstate = this.level().getBlockState(pos);
|
||||
if (blockstate.is(BlockTags.LOGS) || blockstate.is(BlockTags.PLANKS)
|
||||
|| blockstate.is(Tags.Blocks.GLASS) || blockstate.is(Tags.Blocks.GLASS_PANES)
|
||||
|| blockstate.is(Blocks.ICE) || blockstate.is(Blocks.FROSTED_ICE)
|
||||
|| blockstate.is(Blocks.PACKED_ICE) || blockstate.is(Blocks.BLUE_ICE)) {
|
||||
if (blockstate.is(ModTags.Blocks.HARD_COLLISION)) {
|
||||
this.level().destroyBlock(pos, true);
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.6));
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@ package com.atsuishio.superbwarfare.init;
|
|||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.damagesource.DamageType;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public class ModTags {
|
||||
|
||||
|
@ -39,7 +40,16 @@ public class ModTags {
|
|||
public static final TagKey<Item> STORAGE_BLOCK_CEMENTED_CARBIDE = tag("storage_blocks/cemented_carbide");
|
||||
|
||||
private static TagKey<Item> tag(String name) {
|
||||
return ItemTags.create(new ResourceLocation(ModUtils.MODID, name));
|
||||
return ItemTags.create(ModUtils.loc(name));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Blocks {
|
||||
public static final TagKey<Block> SOFT_COLLISION = tag("soft_collision");
|
||||
public static final TagKey<Block> HARD_COLLISION = tag("hard_collision");
|
||||
|
||||
private static TagKey<Block> tag(String name) {
|
||||
return BlockTags.create(ModUtils.loc(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +58,7 @@ public class ModTags {
|
|||
public static final TagKey<DamageType> PROJECTILE_ABSOLUTE = tag("projectile_absolute");
|
||||
|
||||
private static TagKey<DamageType> tag(String name) {
|
||||
return TagKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(ModUtils.MODID, name));
|
||||
return TagKey.create(Registries.DAMAGE_TYPE, ModUtils.loc(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue