Skip to content

Commit

Permalink
add proof-of-concept blaster power pack item for survival blasters
Browse files Browse the repository at this point in the history
  • Loading branch information
parzivail committed Mar 22, 2021
1 parent 95d4f5d commit 6f07d2b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/parzivail/datagen/tarkin/Tarkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ private static void generateItems(List<BuiltAsset> assets)
ItemGenerator.basic(SwgItems.Axe.Beskar).build(assets);

ItemGenerator.empty(SwgItems.Blaster.Blaster).build(assets);
ItemGenerator.basic(SwgItems.Blaster.SmallPowerPack).build(assets);

BlockGenerator.basicRandomRotation(SwgBlocks.Dirt.DesertLoam).build(assets);
BlockGenerator.basic(SwgBlocks.Dirt.WetPourstone).build(assets);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/parzivail/pswg/container/SwgBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static class Crate
public static final BlockEntityType<CrateImperialCubeBlockEntity> ImperialCrateBlockEntityType = BlockEntityType.Builder.create(CrateImperialCubeBlockEntity::new, Imperial).build(null);

@RegistryName("segmented_crate")
public static final RotatingBlockWithBoundsGuiEntity Segmented = new RotatingBlockWithBoundsGuiEntity(VoxelShapeUtil.getCentered(26, 14, 14), FabricBlockSettings.of(Material.METAL).sounds(BlockSoundGroup.METAL).nonOpaque().strength(2.5F).breakByTool(FabricToolTags.PICKAXES, 0), CrateSegmentedBlockEntity::new);
public static final RotatingBlockWithBoundsGuiEntity Segmented = new RotatingBlockWithBoundsGuiEntity(VoxelShapeUtil.getCentered(28, 14, 14), FabricBlockSettings.of(Material.METAL).sounds(BlockSoundGroup.METAL).nonOpaque().strength(2.5F).breakByTool(FabricToolTags.PICKAXES, 0), CrateSegmentedBlockEntity::new);
@RegistryName("segmented_crate")
public static final BlockEntityType<CrateSegmentedBlockEntity> SegmentedCrateBlockEntityType = BlockEntityType.Builder.create(CrateSegmentedBlockEntity::new, Segmented).build(null);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/parzivail/pswg/container/SwgItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.parzivail.pswg.item.DebugItem;
import com.parzivail.pswg.item.SpawnEntityItem;
import com.parzivail.pswg.item.blaster.BlasterItem;
import com.parzivail.pswg.item.blaster.BlasterPowerPackItem;
import com.parzivail.pswg.item.lightsaber.LightsaberItem;
import com.parzivail.pswg.item.material.BeskarToolMaterial;
import com.parzivail.pswg.item.material.DurasteelToolMaterial;
Expand Down Expand Up @@ -215,6 +216,8 @@ public static class Blaster
{
@RegistryName("blaster")
public static final BlasterItem Blaster = new BlasterItem(new Item.Settings().maxCount(1));
@RegistryName("small_power_pack")
public static final BlasterPowerPackItem SmallPowerPack = new BlasterPowerPackItem(75, new Item.Settings().group(Galaxies.Tab));
}

public static class Spawners
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@

public class BlasterPowerPackItem extends Item
{
public BlasterPowerPackItem(Settings settings)
private final int numShotsProvided;

public BlasterPowerPackItem(int numShotsProvided, Settings settings)
{
super(settings);
this.numShotsProvided = numShotsProvided;
}

public static BlasterPowerPack getPackType(ItemStack stack)
{
return null;
if (!(stack.getItem() instanceof BlasterPowerPackItem))
return null;

BlasterPowerPackItem ppi = (BlasterPowerPackItem)stack.getItem();

return new BlasterPowerPack(ppi.numShotsProvided);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

public class BlasterPowerPack
{
public final String name;
public final int numShots;

public BlasterPowerPack(String name, int numShots)
public BlasterPowerPack(int numShots)
{
this.name = name;
this.numShots = numShots;
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/pswg/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
"item.pswg.qrikki_bread": "Qrikki Bread",
"item.pswg.qrikki_waffle": "Qrikki Waffle",
"item.pswg.salt_pile": "Salt Pile",
"item.pswg.small_power_pack": "Small Power Pack",
"item.pswg.spawn_xwing_t65b": "Spawn T-65B X-Wing",
"item.pswg.tatooine_home_door": "Tatooine Home Door",
"item.pswg.titanium_axe": "Titanium Axe",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"parent":"minecraft:item/generated","textures":{"layer0":"pswg:item/small_power_pack"}}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6f07d2b

Please sign in to comment.