添加新的战利品表

This commit is contained in:
17146 2024-05-21 15:09:07 +08:00
parent cede106430
commit d2698c11fa
19 changed files with 84 additions and 113 deletions

View file

@ -18,13 +18,11 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Collections;
import java.util.List; import java.util.List;
public class BarbedWireBlock extends Block { public class BarbedWireBlock extends Block {
@ -45,11 +43,6 @@ public class BarbedWireBlock extends Block {
return true; return true;
} }
@Override
public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) {
return 0;
}
@Override @Override
public VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { public VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return Shapes.empty(); return Shapes.empty();
@ -73,14 +66,6 @@ public class BarbedWireBlock extends Block {
return state.rotate(mirrorIn.getRotation(state.getValue(FACING))); return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
} }
@Override
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
@Override @Override
public void entityInside(BlockState blockstate, Level world, BlockPos pos, Entity entity) { public void entityInside(BlockState blockstate, Level world, BlockPos pos, Entity entity) {
super.entityInside(blockstate, world, pos, entity); super.entityInside(blockstate, world, pos, entity);

View file

@ -12,44 +12,19 @@ import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import java.util.Collections;
import java.util.List;
public class GunRecycleBlock extends Block { public class GunRecycleBlock extends Block {
public GunRecycleBlock() { public GunRecycleBlock() {
super(BlockBehaviour.Properties.of().sound(SoundType.METAL).strength(1f, 10f)); super(BlockBehaviour.Properties.of().sound(SoundType.METAL).strength(1f, 10f));
} }
@Override
public void appendHoverText(ItemStack itemstack, BlockGetter world, List<Component> list, TooltipFlag flag) {
super.appendHoverText(itemstack, world, list, flag);
}
@Override
public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) {
return 15;
}
@Override
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
@Override @Override
public InteractionResult use(BlockState blockstate, Level world, BlockPos pos, Player entity, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState blockstate, Level world, BlockPos pos, Player entity, InteractionHand hand, BlockHitResult hit) {
super.use(blockstate, world, pos, entity, hand, hit); super.use(blockstate, world, pos, entity, hand, hit);

View file

@ -5,11 +5,8 @@ import net.mcreator.target.init.TargetModSounds;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@ -19,38 +16,25 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Collections; public class JumpPadBlock extends Block {
import java.util.List;
public class JumppadBlockBlock extends Block {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public JumppadBlockBlock() { public JumpPadBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(-1, 3600000).noCollission().noOcclusion().isRedstoneConductor((bs, br, bp) -> false)); super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.BASEDRUM).sound(SoundType.STONE).strength(-1, 3600000).noCollission().noOcclusion().isRedstoneConductor((bs, br, bp) -> false));
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
} }
@Override
public void appendHoverText(ItemStack itemstack, BlockGetter world, List<Component> list, TooltipFlag flag) {
super.appendHoverText(itemstack, world, list, flag);
}
@Override @Override
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) { public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) {
return true; return true;
} }
@Override
public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) {
return 0;
}
@Override @Override
public VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { public VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return Shapes.empty(); return Shapes.empty();
@ -88,14 +72,6 @@ public class JumppadBlockBlock extends Block {
return state.rotate(mirrorIn.getRotation(state.getValue(FACING))); return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
} }
@Override
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
@Override @Override
public void entityInside(BlockState blockstate, Level level, BlockPos pos, Entity entity) { public void entityInside(BlockState blockstate, Level level, BlockPos pos, Entity entity) {
super.entityInside(blockstate, level, pos, entity); super.entityInside(blockstate, level, pos, entity);

View file

@ -1,40 +1,12 @@
package net.mcreator.target.block; package net.mcreator.target.block;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.storage.loot.LootParams;
import java.util.Collections;
import java.util.List;
public class SandbagBlock extends Block { public class SandbagBlock extends Block {
public SandbagBlock() { public SandbagBlock() {
super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SNARE).sound(SoundType.SAND).strength(10f, 20f)); super(BlockBehaviour.Properties.of().instrument(NoteBlockInstrument.SNARE).sound(SoundType.SAND).strength(10f, 20f));
} }
@Override
public void appendHoverText(ItemStack itemstack, BlockGetter world, List<Component> list, TooltipFlag flag) {
super.appendHoverText(itemstack, world, list, flag);
}
@Override
public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) {
return 15;
}
@Override
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
} }

View file

@ -12,7 +12,7 @@ public class TargetModBlocks {
public static final RegistryObject<Block> SANDBAG = REGISTRY.register("sandbag", SandbagBlock::new); public static final RegistryObject<Block> SANDBAG = REGISTRY.register("sandbag", SandbagBlock::new);
public static final RegistryObject<Block> BARBED_WIRE = REGISTRY.register("barbed_wire", BarbedWireBlock::new); public static final RegistryObject<Block> BARBED_WIRE = REGISTRY.register("barbed_wire", BarbedWireBlock::new);
public static final RegistryObject<Block> JUMPPAD_BLOCK = REGISTRY.register("jumppad_block", JumppadBlockBlock::new); public static final RegistryObject<Block> JUMP_PAD = REGISTRY.register("jump_pad", JumpPadBlock::new);
public static final RegistryObject<Block> GALENA_ORE = REGISTRY.register("galena_ore", GalenaOreBlock::new); public static final RegistryObject<Block> GALENA_ORE = REGISTRY.register("galena_ore", GalenaOreBlock::new);
public static final RegistryObject<Block> DEEPSLATE_GALENA_ORE = REGISTRY.register("deepslate_galena_ore", DeepslateGalenaOreBlock::new); public static final RegistryObject<Block> DEEPSLATE_GALENA_ORE = REGISTRY.register("deepslate_galena_ore", DeepslateGalenaOreBlock::new);
public static final RegistryObject<Block> SCHEELITE_ORE = REGISTRY.register("scheelite_ore", ScheeliteOreBlock::new); public static final RegistryObject<Block> SCHEELITE_ORE = REGISTRY.register("scheelite_ore", ScheeliteOreBlock::new);

View file

@ -80,7 +80,7 @@ public class TargetModItems {
public static final RegistryObject<Item> SANDBAG = block(TargetModBlocks.SANDBAG); public static final RegistryObject<Item> SANDBAG = block(TargetModBlocks.SANDBAG);
public static final RegistryObject<Item> BARBED_WIRE = block(TargetModBlocks.BARBED_WIRE); public static final RegistryObject<Item> BARBED_WIRE = block(TargetModBlocks.BARBED_WIRE);
public static final RegistryObject<Item> CLAYMORE_MINE = ITEMS.register("claymore_mine", ClaymoreMine::new); public static final RegistryObject<Item> CLAYMORE_MINE = ITEMS.register("claymore_mine", ClaymoreMine::new);
public static final RegistryObject<Item> JUMPPAD_BLOCK = block(TargetModBlocks.JUMPPAD_BLOCK); public static final RegistryObject<Item> JUMP_PAD = block(TargetModBlocks.JUMP_PAD);
public static final RegistryObject<Item> LIGHT_SABER = ITEMS.register("light_saber", LightSaber::new); public static final RegistryObject<Item> LIGHT_SABER = ITEMS.register("light_saber", LightSaber::new);
public static final RegistryObject<Item> HAMMER = ITEMS.register("hammer", Hammer::new); public static final RegistryObject<Item> HAMMER = ITEMS.register("hammer", Hammer::new);
public static final RegistryObject<Item> MORTAR_DEPLOYER = ITEMS.register("mortar_deployer", MortarDeployer::new); public static final RegistryObject<Item> MORTAR_DEPLOYER = ITEMS.register("mortar_deployer", MortarDeployer::new);

View file

@ -1,18 +1,18 @@
{ {
"variants": { "variants": {
"facing=north": { "facing=north": {
"model": "target:block/jumppad_block" "model": "target:block/jump_pad"
}, },
"facing=east": { "facing=east": {
"model": "target:block/jumppad_block", "model": "target:block/jump_pad",
"y": 90 "y": 90
}, },
"facing=south": { "facing=south": {
"model": "target:block/jumppad_block", "model": "target:block/jump_pad",
"y": 180 "y": 180
}, },
"facing=west": { "facing=west": {
"model": "target:block/jumppad_block", "model": "target:block/jump_pad",
"y": 270 "y": 270
} }
} }

View file

@ -123,7 +123,7 @@
"attribute.target.spread": "Spread", "attribute.target.spread": "Spread",
"block.target.gun_recycle": "Gun Recycle Table", "block.target.gun_recycle": "Gun Recycle Table",
"block.target.jumppad_block": "Jumppad", "block.target.jump_pad": "Jump Pad",
"block.target.sandbag": "Sandbag", "block.target.sandbag": "Sandbag",
"block.target.barbed_wire": "Barbed Wire", "block.target.barbed_wire": "Barbed Wire",
"block.target.galena_ore": "Galena Ore", "block.target.galena_ore": "Galena Ore",

View file

@ -123,7 +123,7 @@
"attribute.target.spread": "散布", "attribute.target.spread": "散布",
"block.target.gun_recycle": "枪械拆解台", "block.target.gun_recycle": "枪械拆解台",
"block.target.jumppad_block": "弹射台", "block.target.jump_pad": "弹射台",
"block.target.sandbag": "沙袋", "block.target.sandbag": "沙袋",
"block.target.barbed_wire": "铁丝网", "block.target.barbed_wire": "铁丝网",
"block.target.galena_ore": "方铅矿石", "block.target.galena_ore": "方铅矿石",

View file

@ -0,0 +1,9 @@
{
"parent": "target:custom/jump_pad",
"textures": {
"all": "target:block/jump_pad",
"particle": "target:block/jump_pad",
"0": "target:block/jump_pad"
},
"render_type": "solid"
}

View file

@ -1,9 +0,0 @@
{
"parent": "target:custom/pad",
"textures": {
"all": "target:block/pad",
"particle": "target:block/pad",
"0": "target:block/pad"
},
"render_type": "solid"
}

View file

@ -1,5 +1,5 @@
{ {
"parent": "target:block/jumppad_block", "parent": "target:block/jump_pad",
"display": { "display": {
"thirdperson": { "thirdperson": {
"rotation": [ "rotation": [

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "target:barbed_wire"
}
],
"rolls": 1.0
}
],
"random_sequence": "target:blocks/barbed_wire"
}

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "target:jump_pad"
}
],
"rolls": 1.0
}
],
"random_sequence": "target:blocks/jump_pad"
}

View file

@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "target:sandbag"
}
],
"rolls": 1.0
}
],
"random_sequence": "target:blocks/sandbag"
}

View file

@ -18,7 +18,7 @@
} }
}, },
"result": { "result": {
"item": "target:jumppad_block", "item": "target:jump_pad",
"count": 1 "count": 1
} }
} }