注册充电站方块
This commit is contained in:
parent
320d4e0950
commit
f839d00768
12 changed files with 97 additions and 45 deletions
|
@ -1,6 +1,7 @@
|
||||||
// 1.20.1 2024-11-28T19:45:16.1283469 Loot Tables
|
// 1.20.1 2024-12-06T21:51:55.0829733 Loot Tables
|
||||||
98386b2e65b2afb7cf5b0cabf6a7b0f062c1e640 data/superbwarfare/loot_tables/blocks/barbed_wire.json
|
98386b2e65b2afb7cf5b0cabf6a7b0f062c1e640 data/superbwarfare/loot_tables/blocks/barbed_wire.json
|
||||||
811e69929a14e6736015849c220100bb58d914c9 data/superbwarfare/loot_tables/blocks/cemented_carbide_block.json
|
811e69929a14e6736015849c220100bb58d914c9 data/superbwarfare/loot_tables/blocks/cemented_carbide_block.json
|
||||||
|
9e4d3e3c60529571c1902818916ffe72dd2dbc2a data/superbwarfare/loot_tables/blocks/charging_station.json
|
||||||
8ed3f1d518c86fe6ed14f14f3121c2e24e109269 data/superbwarfare/loot_tables/blocks/container.json
|
8ed3f1d518c86fe6ed14f14f3121c2e24e109269 data/superbwarfare/loot_tables/blocks/container.json
|
||||||
dabbe17417c944567dc6dfcdcba32b8377c24f69 data/superbwarfare/loot_tables/blocks/deepslate_galena_ore.json
|
dabbe17417c944567dc6dfcdcba32b8377c24f69 data/superbwarfare/loot_tables/blocks/deepslate_galena_ore.json
|
||||||
a7c1af3e194d35a64544902468bd964f45f2f9ef data/superbwarfare/loot_tables/blocks/deepslate_scheelite_ore.json
|
a7c1af3e194d35a64544902468bd964f45f2f9ef data/superbwarfare/loot_tables/blocks/deepslate_scheelite_ore.json
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// 1.20.1 2024-11-28T19:20:29.861331 Tags for minecraft:block mod id superbwarfare
|
// 1.20.1 2024-12-06T21:51:55.0782775 Tags for minecraft:block mod id superbwarfare
|
||||||
0acfd31854bf15f2c108138b3df7206bd2593e6b data/minecraft/tags/blocks/mineable/axe.json
|
0acfd31854bf15f2c108138b3df7206bd2593e6b data/minecraft/tags/blocks/mineable/axe.json
|
||||||
e059c279c01c012fe89bd4bfadf8cd6d70b3b948 data/minecraft/tags/blocks/mineable/pickaxe.json
|
e78725c77652a79d8e1fa4a614b7b75027aa1883 data/minecraft/tags/blocks/mineable/pickaxe.json
|
||||||
3da7f021790388a122717f16f51c7ec5232eebcb data/minecraft/tags/blocks/mineable/shovel.json
|
3da7f021790388a122717f16f51c7ec5232eebcb data/minecraft/tags/blocks/mineable/shovel.json
|
||||||
f42a8c01336e64b74da966f03d45ee0d60ac5d6b data/minecraft/tags/blocks/needs_iron_tool.json
|
f42a8c01336e64b74da966f03d45ee0d60ac5d6b data/minecraft/tags/blocks/needs_iron_tool.json
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"superbwarfare:deepslate_silver_ore",
|
"superbwarfare:deepslate_silver_ore",
|
||||||
"superbwarfare:silver_block",
|
"superbwarfare:silver_block",
|
||||||
"superbwarfare:jump_pad",
|
"superbwarfare:jump_pad",
|
||||||
"superbwarfare:container"
|
"superbwarfare:container",
|
||||||
|
"superbwarfare:charging_station"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"bonus_rolls": 0.0,
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "minecraft:air"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rolls": 1.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"random_sequence": "superbwarfare:blocks/charging_station"
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.atsuishio.superbwarfare.block;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||||
|
import net.minecraft.world.level.block.SoundType;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class ChargingStationBlock extends BaseEntityBlock {
|
||||||
|
|
||||||
|
public ChargingStationBlock() {
|
||||||
|
super(BlockBehaviour.Properties.of().sound(SoundType.METAL).strength(3.0f).requiresCorrectToolForDrops());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ public class ModBlockLootProvider extends BlockLootSubProvider {
|
||||||
this.dropSelf(ModBlocks.TUNGSTEN_BLOCK.get());
|
this.dropSelf(ModBlocks.TUNGSTEN_BLOCK.get());
|
||||||
this.dropSelf(ModBlocks.CEMENTED_CARBIDE_BLOCK.get());
|
this.dropSelf(ModBlocks.CEMENTED_CARBIDE_BLOCK.get());
|
||||||
this.dropSelf(ModBlocks.SILVER_BLOCK.get());
|
this.dropSelf(ModBlocks.SILVER_BLOCK.get());
|
||||||
|
this.dropSelf(ModBlocks.CHARGING_STATION.get());
|
||||||
|
|
||||||
this.add(ModBlocks.GALENA_ORE.get(), this.createOreDrop(ModBlocks.GALENA_ORE.get(), ModItems.GALENA.get()));
|
this.add(ModBlocks.GALENA_ORE.get(), this.createOreDrop(ModBlocks.GALENA_ORE.get(), ModItems.GALENA.get()));
|
||||||
this.add(ModBlocks.SCHEELITE_ORE.get(), this.createOreDrop(ModBlocks.SCHEELITE_ORE.get(), ModItems.SCHEELITE.get()));
|
this.add(ModBlocks.SCHEELITE_ORE.get(), this.createOreDrop(ModBlocks.SCHEELITE_ORE.get(), ModItems.SCHEELITE.get()));
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ModBlockTagProvider extends BlockTagsProvider {
|
||||||
ModBlocks.DEEPSLATE_GALENA_ORE.get(), ModBlocks.DEEPSLATE_SCHEELITE_ORE.get(), ModBlocks.DRAGON_TEETH.get(),
|
ModBlocks.DEEPSLATE_GALENA_ORE.get(), ModBlocks.DEEPSLATE_SCHEELITE_ORE.get(), ModBlocks.DRAGON_TEETH.get(),
|
||||||
ModBlocks.REFORGING_TABLE.get(), ModBlocks.LEAD_BLOCK.get(), ModBlocks.STEEL_BLOCK.get(), ModBlocks.TUNGSTEN_BLOCK.get(),
|
ModBlocks.REFORGING_TABLE.get(), ModBlocks.LEAD_BLOCK.get(), ModBlocks.STEEL_BLOCK.get(), ModBlocks.TUNGSTEN_BLOCK.get(),
|
||||||
ModBlocks.CEMENTED_CARBIDE_BLOCK.get(), ModBlocks.SILVER_ORE.get(), ModBlocks.DEEPSLATE_SILVER_ORE.get(),
|
ModBlocks.CEMENTED_CARBIDE_BLOCK.get(), ModBlocks.SILVER_ORE.get(), ModBlocks.DEEPSLATE_SILVER_ORE.get(),
|
||||||
ModBlocks.SILVER_BLOCK.get(), ModBlocks.JUMP_PAD.get(), ModBlocks.CONTAINER.get());
|
ModBlocks.SILVER_BLOCK.get(), ModBlocks.JUMP_PAD.get(), ModBlocks.CONTAINER.get(), ModBlocks.CHARGING_STATION.get());
|
||||||
this.tag(BlockTags.MINEABLE_WITH_SHOVEL).add(ModBlocks.SANDBAG.get());
|
this.tag(BlockTags.MINEABLE_WITH_SHOVEL).add(ModBlocks.SANDBAG.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
||||||
|
|
||||||
public static final float MAX_HEALTH = CannonConfig.ANNIHILATOR_HP.get();
|
public static final float MAX_HEALTH = CannonConfig.ANNIHILATOR_HP.get();
|
||||||
public static final float SHOOT_COST = CannonConfig.ANNIHILATOR_SHOOT_COST.get().floatValue();
|
public static final float SHOOT_COST = CannonConfig.ANNIHILATOR_SHOOT_COST.get().floatValue();
|
||||||
|
|
||||||
protected int interpolationSteps;
|
protected int interpolationSteps;
|
||||||
protected double serverYRot;
|
protected double serverYRot;
|
||||||
protected double serverXRot;
|
protected double serverXRot;
|
||||||
|
@ -111,9 +112,9 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
||||||
@Override
|
@Override
|
||||||
protected void positionRider(Entity pPassenger, MoveFunction pCallback) {
|
protected void positionRider(Entity pPassenger, MoveFunction pCallback) {
|
||||||
if (this.hasPassenger(pPassenger)) {
|
if (this.hasPassenger(pPassenger)) {
|
||||||
float f1 = (float)((this.isRemoved() ? 0.009999999776482582 : this.getPassengersRidingOffset()) + pPassenger.getMyRidingOffset());
|
float f1 = (float) ((this.isRemoved() ? 0.009999999776482582 : this.getPassengersRidingOffset()) + pPassenger.getMyRidingOffset());
|
||||||
Vec3 vec3 = (new Vec3(1, 0.0, 0.0)).yRot(-this.getYRot() * 0.017453292F - 1.5707964F);
|
Vec3 vec3 = (new Vec3(1, 0.0, 0.0)).yRot(-this.getYRot() * 0.017453292F - 1.5707964F);
|
||||||
pCallback.accept(pPassenger, this.getX() + vec3.x, this.getY() + (double)f1, this.getZ() + vec3.z);
|
pCallback.accept(pPassenger, this.getX() + vec3.x, this.getY() + (double) f1, this.getZ() + vec3.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
||||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
}
|
}
|
||||||
if (player.getMainHandItem().is(ModItems.SHIELD_CELL.get())) {
|
if (player.getMainHandItem().is(ModItems.SHIELD_CELL.get())) {
|
||||||
this.entityData.set(ENERGY, (float)Mth.clamp(this.entityData.get(ENERGY) + 1000000 , 0, CannonConfig.ANNIHILATOR_MAX_ENERGY.get()));
|
this.entityData.set(ENERGY, (float) Mth.clamp(this.entityData.get(ENERGY) + 1000000, 0, CannonConfig.ANNIHILATOR_MAX_ENERGY.get()));
|
||||||
player.displayClientMessage(Component.literal("Energy:" + new java.text.DecimalFormat("##").format(this.entityData.get(ENERGY))), true);
|
player.displayClientMessage(Component.literal("Energy:" + new java.text.DecimalFormat("##").format(this.entityData.get(ENERGY))), true);
|
||||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
}
|
}
|
||||||
|
@ -301,9 +302,9 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
||||||
Vec3 BarrelRightPos = new Vec3(BarrelRootPos.x + rightPos.x, BarrelRootPos.y + rightPos.y, BarrelRootPos.z + rightPos.z);
|
Vec3 BarrelRightPos = new Vec3(BarrelRootPos.x + rightPos.x, BarrelRootPos.y + rightPos.y, BarrelRootPos.z + rightPos.z);
|
||||||
|
|
||||||
if (this.entityData.get(COOL_DOWN) > 88) {
|
if (this.entityData.get(COOL_DOWN) > 88) {
|
||||||
this.entityData.set(LASER_LEFT_LENGTH, Math.min(laserLength(BarrelLeftPos ,this), laserLengthEntity(BarrelLeftPos ,this)));
|
this.entityData.set(LASER_LEFT_LENGTH, Math.min(laserLength(BarrelLeftPos, this), laserLengthEntity(BarrelLeftPos, this)));
|
||||||
this.entityData.set(LASER_MIDDLE_LENGTH, Math.min(laserLength(BarrelMiddlePos ,this), laserLengthEntity(BarrelMiddlePos ,this)));
|
this.entityData.set(LASER_MIDDLE_LENGTH, Math.min(laserLength(BarrelMiddlePos, this), laserLengthEntity(BarrelMiddlePos, this)));
|
||||||
this.entityData.set(LASER_RIGHT_LENGTH, Math.min(laserLength(BarrelRightPos ,this), laserLengthEntity(BarrelRightPos ,this)));
|
this.entityData.set(LASER_RIGHT_LENGTH, Math.min(laserLength(BarrelRightPos, this), laserLengthEntity(BarrelRightPos, this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
travel();
|
travel();
|
||||||
|
@ -317,7 +318,7 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private float laserLength (Vec3 pos, Entity cannon) {
|
private float laserLength(Vec3 pos, Entity cannon) {
|
||||||
if (this.entityData.get(COOL_DOWN) > 98) {
|
if (this.entityData.get(COOL_DOWN) > 98) {
|
||||||
HitResult result = cannon.level().clip(new ClipContext(pos, pos.add(cannon.getViewVector(1).scale(512)),
|
HitResult result = cannon.level().clip(new ClipContext(pos, pos.add(cannon.getViewVector(1).scale(512)),
|
||||||
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, cannon));
|
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, cannon));
|
||||||
|
@ -330,7 +331,7 @@ public class AnnihilatorEntity extends Entity implements GeoEntity, ICannonEntit
|
||||||
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, cannon)).getBlockPos())));
|
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, cannon)).getBlockPos())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private float laserLengthEntity (Vec3 pos, Entity cannon) {
|
private float laserLengthEntity(Vec3 pos, Entity cannon) {
|
||||||
double distance = 512 * 512;
|
double distance = 512 * 512;
|
||||||
HitResult hitResult = cannon.pick(512, 1.0f, false);
|
HitResult hitResult = cannon.pick(512, 1.0f, false);
|
||||||
if (hitResult.getType() != HitResult.Type.MISS) {
|
if (hitResult.getType() != HitResult.Type.MISS) {
|
||||||
|
|
|
@ -28,4 +28,5 @@ public class ModBlocks {
|
||||||
public static final RegistryObject<Block> SILVER_BLOCK = REGISTRY.register("silver_block", SilverBlock::new);
|
public static final RegistryObject<Block> SILVER_BLOCK = REGISTRY.register("silver_block", SilverBlock::new);
|
||||||
public static final RegistryObject<Block> CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block", CementedCarbideBlock::new);
|
public static final RegistryObject<Block> CEMENTED_CARBIDE_BLOCK = REGISTRY.register("cemented_carbide_block", CementedCarbideBlock::new);
|
||||||
public static final RegistryObject<Block> CONTAINER = REGISTRY.register("container", ContainerBlock::new);
|
public static final RegistryObject<Block> CONTAINER = REGISTRY.register("container", ContainerBlock::new);
|
||||||
|
public static final RegistryObject<Block> CHARGING_STATION = REGISTRY.register("charging_station", ChargingStationBlock::new);
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,7 @@ public class ModItems {
|
||||||
public static final RegistryObject<Item> BARBED_WIRE = block(ModBlocks.BARBED_WIRE);
|
public static final RegistryObject<Item> BARBED_WIRE = block(ModBlocks.BARBED_WIRE);
|
||||||
public static final RegistryObject<Item> DRAGON_TEETH = block(ModBlocks.DRAGON_TEETH);
|
public static final RegistryObject<Item> DRAGON_TEETH = block(ModBlocks.DRAGON_TEETH);
|
||||||
public static final RegistryObject<Item> REFORGING_TABLE = block(ModBlocks.REFORGING_TABLE);
|
public static final RegistryObject<Item> REFORGING_TABLE = block(ModBlocks.REFORGING_TABLE);
|
||||||
|
public static final RegistryObject<Item> CHARGING_STATION = block(ModBlocks.CHARGING_STATION);
|
||||||
public static final RegistryObject<Item> LEAD_BLOCK = block(ModBlocks.LEAD_BLOCK);
|
public static final RegistryObject<Item> LEAD_BLOCK = block(ModBlocks.LEAD_BLOCK);
|
||||||
public static final RegistryObject<Item> STEEL_BLOCK = block(ModBlocks.STEEL_BLOCK);
|
public static final RegistryObject<Item> STEEL_BLOCK = block(ModBlocks.STEEL_BLOCK);
|
||||||
public static final RegistryObject<Item> TUNGSTEN_BLOCK = block(ModBlocks.TUNGSTEN_BLOCK);
|
public static final RegistryObject<Item> TUNGSTEN_BLOCK = block(ModBlocks.TUNGSTEN_BLOCK);
|
||||||
|
|
|
@ -209,6 +209,7 @@
|
||||||
"block.superbwarfare.steel_block": "Steel Block",
|
"block.superbwarfare.steel_block": "Steel Block",
|
||||||
"block.superbwarfare.silver_block": "Silver Block",
|
"block.superbwarfare.silver_block": "Silver Block",
|
||||||
"block.superbwarfare.cemented_carbide_block": "Cemented Carbide Block",
|
"block.superbwarfare.cemented_carbide_block": "Cemented Carbide Block",
|
||||||
|
"block.superbwarfare.charging_station": "Charging Station",
|
||||||
|
|
||||||
"item.superbwarfare.high_energy_explosives": "High Energy Explosives",
|
"item.superbwarfare.high_energy_explosives": "High Energy Explosives",
|
||||||
"item.superbwarfare.grain": "Grain",
|
"item.superbwarfare.grain": "Grain",
|
||||||
|
|
|
@ -209,6 +209,7 @@
|
||||||
"block.superbwarfare.silver_block": "银块",
|
"block.superbwarfare.silver_block": "银块",
|
||||||
"block.superbwarfare.cemented_carbide_block": "硬质合金块",
|
"block.superbwarfare.cemented_carbide_block": "硬质合金块",
|
||||||
"block.superbwarfare.steel_block": "钢块",
|
"block.superbwarfare.steel_block": "钢块",
|
||||||
|
"block.superbwarfare.charging_station": "充电站",
|
||||||
|
|
||||||
"item.superbwarfare.high_energy_explosives": "高能炸药",
|
"item.superbwarfare.high_energy_explosives": "高能炸药",
|
||||||
"item.superbwarfare.grain": "推进药柱",
|
"item.superbwarfare.grain": "推进药柱",
|
||||||
|
|
Loading…
Add table
Reference in a new issue