grenades, casings, connected storage blocks and creative mode tab

This commit is contained in:
DrMangoTea
2023-08-30 14:17:19 +02:00
parent 38ba20305e
commit 3cd181cb03
316 changed files with 3644 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
// 1.19.2 2023-08-30T12:58:15.3014071 Registrate Provider for tfmg [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
9ca537517fb8baeff3d4e4137c93aebd6b874c81 assets/tfmg/blockstates/cast_iron_block.json
c7aa764cc11ee837deeed68c9c2d8567ea078f5c assets/tfmg/blockstates/heavy_machinery_casing.json
0f33dc6b2a736164b17f416ce7d127c87bfb6441 assets/tfmg/blockstates/napalm_bomb.json
e6983072149d1a9a2f4d39e4e1feac599ff7413e assets/tfmg/blockstates/steel_block.json
df44115876045e6f863de2f8be6a9166b336a2f1 assets/tfmg/blockstates/steel_casing.json
a7cd711917057f78c673c344fa3d5ed9da99538f assets/tfmg/lang/en_ud.json
f3eb466b0b241c6d1bf5f84b37ad3c2f9d486c4c assets/tfmg/lang/en_us.json
37789d06ec6cfc0312be7b1b66ac1ec6403d4516 assets/tfmg/models/block/cast_iron_block.json
717ee09803cb584062c9717f45475fbd15673cde assets/tfmg/models/block/heavy_machinery_casing.json
b541c0cab9298f1d2578639349755b93f1019621 assets/tfmg/models/block/napalm_bomb.json
0ceb30eaff16a495c9a165ca16c925cbff836755 assets/tfmg/models/block/steel_block.json
465b1fed10d06090e5e8d19457f9fa48fe890bb4 assets/tfmg/models/block/steel_casing.json
ec38882fb9010884823d6d6afa604f8a6512d279 assets/tfmg/models/item/cast_iron_block.json
df4e7fa8f3f60908f58794528a8db60dce7d0135 assets/tfmg/models/item/copper_grenade.json
3fdff9e88db39939ee31968358eb51c060006766 assets/tfmg/models/item/heavy_machinery_casing.json
afac1fce0904a0df4e68d731b897ff1be6c68766 assets/tfmg/models/item/napalm_bomb.json
57bf86df814741f846feb8be4a10afe633f51721 assets/tfmg/models/item/steel_block.json
d34ca92f5288cbb5cecee06f046a072763b2926c assets/tfmg/models/item/steel_casing.json
72da5f91f1992b502e90c8fc84d654e075163eb7 assets/tfmg/models/item/thermite_grenade.json
f189171410564631c6074593da126b8d13fe9f8b assets/tfmg/models/item/zinc_grenade.json
2b45163d462fba0e86bb1ac8fc299509fbe1e58d data/create/tags/blocks/casing.json
2b45163d462fba0e86bb1ac8fc299509fbe1e58d data/create/tags/items/casing.json
c98956ac34e02a8c1c801122486771ef89fb640b data/forge/tags/blocks/storage_blocks.json
7c5615c56bb169570a061f052ebb1f5115760c16 data/forge/tags/blocks/storage_blocks/cast_iron.json
37b1c9c3ae722d8110db48015993ede3e194c0a0 data/forge/tags/blocks/storage_blocks/steel.json
c98956ac34e02a8c1c801122486771ef89fb640b data/forge/tags/items/storage_blocks.json
7c5615c56bb169570a061f052ebb1f5115760c16 data/forge/tags/items/storage_blocks/cast_iron.json
37b1c9c3ae722d8110db48015993ede3e194c0a0 data/forge/tags/items/storage_blocks/steel.json
c98956ac34e02a8c1c801122486771ef89fb640b data/minecraft/tags/blocks/beacon_base_blocks.json
2b45163d462fba0e86bb1ac8fc299509fbe1e58d data/minecraft/tags/blocks/mineable/axe.json
cd26fa5d063cde156d1b1b165bccc033f784c23c data/minecraft/tags/blocks/mineable/pickaxe.json
c98956ac34e02a8c1c801122486771ef89fb640b data/minecraft/tags/blocks/needs_iron_tool.json
60857d034446187e758de87644a80a7bc4d6b150 data/tfmg/loot_tables/blocks/cast_iron_block.json
661cc61f9c13ddf8c6bf06470defa93170e8ee7f data/tfmg/loot_tables/blocks/heavy_machinery_casing.json
7da9b20012e584104331da961756d6c1d02682b5 data/tfmg/loot_tables/blocks/napalm_bomb.json
01298989d0fe79936cdfa1e6cc07fd05f143ae09 data/tfmg/loot_tables/blocks/steel_block.json
62cd229b00eb2c95187d1b7b8e968aa26e54c412 data/tfmg/loot_tables/blocks/steel_casing.json

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "tfmg:block/cast_iron_block"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "tfmg:block/heavy_machinery_casing"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "tfmg:block/napalm_bomb"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "tfmg:block/steel_block"
}
}
}

View File

@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "tfmg:block/steel_casing"
}
}
}

View File

@@ -0,0 +1,17 @@
{
"block.tfmg.cast_iron_block": "uoɹI ʇsɐƆ ɟo ʞɔoןᗺ",
"block.tfmg.heavy_machinery_casing": "buısɐƆ ʎɹǝuıɥɔɐW ʎʌɐǝH",
"block.tfmg.napalm_bomb": "qɯoᗺ ɯןɐdɐN",
"block.tfmg.steel_block": "ןǝǝʇS ɟo ʞɔoןᗺ",
"block.tfmg.steel_casing": "buısɐƆ ןǝǝʇS",
"entity.tfmg.blue_spark": "ʞɹɐdS ǝnןᗺ",
"entity.tfmg.copper_grenade": "ǝpɐuǝɹ⅁ ɹǝddoƆ",
"entity.tfmg.green_spark": "ʞɹɐdS uǝǝɹ⅁",
"entity.tfmg.napalm_bomb_entity": "ʎʇıʇuƎ qɯoᗺ ɯןɐdɐN",
"entity.tfmg.spark": "ʞɹɐdS",
"entity.tfmg.thermite_grenade": "ǝpɐuǝɹ⅁ ǝʇıɯɹǝɥ⟘",
"entity.tfmg.zin_grenade": "ǝpɐuǝɹ⅁ uıZ",
"item.tfmg.copper_grenade": "ǝpɐuǝɹ⅁ ɹǝddoƆ",
"item.tfmg.thermite_grenade": "ǝpɐuǝɹ⅁ ǝʇıɯɹǝɥ⟘",
"item.tfmg.zinc_grenade": "ǝpɐuǝɹ⅁ ɔuıZ"
}

View File

@@ -0,0 +1,20 @@
{
"block.tfmg.cast_iron_block": "Block of Cast Iron",
"block.tfmg.heavy_machinery_casing": "Heavy Machinery Casing",
"block.tfmg.napalm_bomb": "Napalm Bomb",
"block.tfmg.steel_block": "Block of Steel",
"block.tfmg.steel_casing": "Steel Casing",
"entity.tfmg.blue_spark": "Blue Spark",
"entity.tfmg.copper_grenade": "Copper Grenade",
"entity.tfmg.green_spark": "Green Spark",
"entity.tfmg.napalm_bomb_entity": "Napalm Bomb Entity",
"entity.tfmg.spark": "Spark",
"entity.tfmg.thermite_grenade": "Thermite Grenade",
"entity.tfmg.zin_grenade": "Zin Grenade",
"item.tfmg.copper_grenade": "Copper Grenade",
"item.tfmg.thermite_grenade": "Thermite Grenade",
"item.tfmg.zinc_grenade": "Zinc Grenade",
"itemGroup.tfmg.base": "Create: The Factory Must Grow",
"itemGroup.tfmg.concrete": "Create: TFMG: Concrete"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "tfmg:block/cast_iron_block"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "tfmg:block/heavy_machinery_casing"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "tfmg:block/napalm_bomb"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "tfmg:block/steel_block"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "tfmg:block/steel_casing"
}
}

View File

@@ -0,0 +1,3 @@
{
"parent": "tfmg:block/cast_iron_block"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "tfmg:item/copper_grenade"
}
}

View File

@@ -0,0 +1,3 @@
{
"parent": "tfmg:block/heavy_machinery_casing"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "tfmg:block/napalm_bomb"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "tfmg:block/steel_block"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "tfmg:block/steel_casing"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "tfmg:item/thermite_grenade"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "tfmg:item/zinc_grenade"
}
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_casing",
"tfmg:heavy_machinery_casing"
]
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_casing",
"tfmg:heavy_machinery_casing"
]
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_block",
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,5 @@
{
"values": [
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,5 @@
{
"values": [
"tfmg:steel_block"
]
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_block",
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,5 @@
{
"values": [
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,5 @@
{
"values": [
"tfmg:steel_block"
]
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_block",
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_casing",
"tfmg:heavy_machinery_casing"
]
}

View File

@@ -0,0 +1,9 @@
{
"values": [
"tfmg:napalm_bomb",
"tfmg:steel_casing",
"tfmg:heavy_machinery_casing",
"tfmg:steel_block",
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,6 @@
{
"values": [
"tfmg:steel_block",
"tfmg:cast_iron_block"
]
}

View File

@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "tfmg:cast_iron_block"
}
],
"rolls": 1.0
}
]
}

View File

@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "tfmg:heavy_machinery_casing"
}
],
"rolls": 1.0
}
]
}

View File

@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "tfmg:napalm_bomb"
}
],
"rolls": 1.0
}
]
}

View File

@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "tfmg:steel_block"
}
],
"rolls": 1.0
}
]
}

View File

@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "tfmg:steel_casing"
}
],
"rolls": 1.0
}
]
}

View File

@@ -1,11 +1,20 @@
package com.drmangotea.tfmg;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.TFMGColoredFires;
import com.drmangotea.tfmg.registry.*;
import com.mojang.logging.LogUtils;
import com.simibubi.create.foundation.data.CreateRegistrate;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;
@@ -15,23 +24,38 @@ public class CreateTFMG
{
public static final String MOD_ID = "tfmg";
public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(MOD_ID);
private static final Logger LOGGER = LogUtils.getLogger();
public CreateTFMG()
{
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
REGISTRATE.registerEventListeners(FMLJavaModLoadingContext.get().getModEventBus());
//
TFMGBlocks.register();
TFMGItems.register();
TFMGEntityTypes.register();
TFMGCreativeModeTabs.init();
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CreateTFMGClient::new);
TFMGColoredFires.register(modEventBus);
modEventBus.addListener(this::clientSetup);
//
MinecraftForge.EVENT_BUS.register(this);
}
private void clientSetup(final FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.BLUE_FIRE.get(), RenderType.cutout());
}
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event)
{
LOGGER.info("YEEEHAAW");
}
public static ResourceLocation asResource(String path) {
return new ResourceLocation(MOD_ID, path);
}
}

View File

@@ -0,0 +1,30 @@
package com.drmangotea.tfmg;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
public class CreateTFMGClient {
public CreateTFMGClient() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
//CIPartialModels.init();
modEventBus.register(this);
}
@SubscribeEvent
public void setup(final FMLClientSetupEvent event) {
// CIPonderIndex.register();
//CIPonderIndex.registerTags();
}
}

View File

@@ -0,0 +1,62 @@
package com.drmangotea.tfmg.base;
import com.drmangotea.tfmg.CreateTFMG;
import com.simibubi.create.foundation.block.connected.AllCTTypes;
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
import com.simibubi.create.foundation.block.connected.CTSpriteShifter;
import com.simibubi.create.foundation.block.connected.CTType;
public class TFMGSpriteShifts {
public static final CTSpriteShiftEntry
CAST_IRON_BLOCK = omni("cast_iron_block"),
STEEL_BLOCK = omni("steel_block");
public static final CTSpriteShiftEntry
STEEL_CASING = omni("steel_casing");
public static final CTSpriteShiftEntry
ALUMINUM_SCAFFOLD_TOP = omni("scaffold/aluminum_scaffold_top");
public static final CTSpriteShiftEntry
HEAVY_MACHINERY_CASING = omni("heavy_machinery_casing");
public static final CTSpriteShiftEntry
STEEL_FLUID_TANK = getCT(AllCTTypes.RECTANGLE, "steel_fluid_tank"),
STEEL_FLUID_TANK_TOP = getCT(AllCTTypes.RECTANGLE, "steel_fluid_tank_top"),
STEEL_FLUID_TANK_INNER = getCT(AllCTTypes.RECTANGLE, "steel_fluid_tank_inner");
public static final CTSpriteShiftEntry STEEL_SCAFFOLD_INSIDE = horizontal("scaffold/steel_scaffold_inside"),
ALUMINUM_SCAFFOLD_INSIDE = horizontal("scaffold/aluminum_scaffold_inside");
public static final CTSpriteShiftEntry STEEL_SCAFFOLD = horizontal("scaffold/steel_scaffold"),
ALUMINUM_SCAFFOLD = horizontal("scaffold/aluminum_scaffold");
public static final CTSpriteShiftEntry
STEEL_ENCASED_COGWHEEL_SIDE = vertical("steel_encased_cogwheel_side"),
STEEL_ENCASED_COGWHEEL_OTHERSIDE = horizontal("steel_encased_cogwheel_side"),
HEAVY_CASING_ENCASED_COGWHEEL_SIDE = vertical("heavy_casing_encased_cogwheel_side"),
HEAVY_CASING_ENCASED_COGWHEEL_OTHERSIDE = horizontal("heavy_casing_encased_cogwheel_side");
//////////////////////
public static CTSpriteShiftEntry omni(String name) {
return getCT(AllCTTypes.OMNIDIRECTIONAL, name);
}
public static CTSpriteShiftEntry horizontal(String name) {
return getCT(AllCTTypes.HORIZONTAL_KRYPPERS, name);
}
private static CTSpriteShiftEntry vertical(String name) {
return getCT(AllCTTypes.VERTICAL, name);
}
/////
private static CTSpriteShiftEntry getCT(CTType type, String blockTextureName, String connectedTextureName) {
return CTSpriteShifter.getCT(type, CreateTFMG.asResource("block/" + blockTextureName), CreateTFMG.asResource("block/" + connectedTextureName + "_connected"));
}
private static CTSpriteShiftEntry getCT(CTType type, String blockTextureName) {
return getCT(type, blockTextureName, blockTextureName);
}
}

View File

@@ -0,0 +1,18 @@
package com.drmangotea.tfmg.base.creative_mode_tabs;
import com.drmangotea.tfmg.registry.TFMGCreativeModeTabs;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.infrastructure.item.CreateCreativeModeTab;
import net.minecraft.world.item.ItemStack;
public class BaseTFMGCreativeModeTab extends TFMGCreativeModeTab {
public BaseTFMGCreativeModeTab() {
super("base");
}
@Override
public ItemStack makeIcon() {
return TFMGItems.ZINC_GRENADE.asStack();
}
}

View File

@@ -0,0 +1,23 @@
package com.drmangotea.tfmg.base.creative_mode_tabs;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.content.decoration.palettes.AllPaletteBlocks;
import com.simibubi.create.infrastructure.item.CreateCreativeModeTab;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.ItemStack;
public class ConcreteCreativeModeTab extends TFMGCreativeModeTab {
public ConcreteCreativeModeTab() {
super("concrete");
}
@Override
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
}
@Override
public ItemStack makeIcon() {
return TFMGItems.COPPER_GRENADE.asStack();
}
}

View File

@@ -0,0 +1,54 @@
package com.drmangotea.tfmg.base.creative_mode_tabs;
import java.util.Collection;
import com.drmangotea.tfmg.CreateTFMG;
import com.tterrag.registrate.util.entry.RegistryEntry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.ForgeRegistries;
public abstract class TFMGCreativeModeTab extends CreativeModeTab {
public TFMGCreativeModeTab(String id) {
super(CreateTFMG.MOD_ID + "." + id);
}
@Override
public void fillItemList(NonNullList<ItemStack> items) {
addItems(items, true);
addBlocks(items);
addItems(items, false);
}
protected Collection<RegistryEntry<Item>> registeredItems() {
return CreateTFMG.REGISTRATE.getAll(ForgeRegistries.ITEMS.getRegistryKey());
}
public void addBlocks(NonNullList<ItemStack> items) {
for (RegistryEntry<Item> entry : registeredItems())
if (entry.get() instanceof BlockItem blockItem)
blockItem.fillItemCategory(this, items);
}
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
ItemRenderer itemRenderer = Minecraft.getInstance()
.getItemRenderer();
for (RegistryEntry<Item> entry : registeredItems()) {
Item item = entry.get();
if (item instanceof BlockItem)
continue;
ItemStack stack = new ItemStack(item);
BakedModel model = itemRenderer.getModel(stack, null, null, 0);
if (model.isGui3d() == specialItems)
item.fillItemCategory(this, items);
}
}
}

View File

@@ -0,0 +1,122 @@
package com.drmangotea.tfmg.base.spark;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.BlueFireBlock;
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.content.trains.CubeParticleData;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
public class BlueSpark extends ThrowableProjectile {
public BlueSpark(EntityType<? extends BlueSpark> p_37391_, Level p_37392_) {
super(p_37391_, p_37392_);
}
public BlueSpark(Level p_37399_, LivingEntity p_37400_) {
super(TFMGEntityTypes.SPARK.get(), p_37400_, p_37399_);
}
public BlueSpark(Level p_37394_, double p_37395_, double p_37396_, double p_37397_) {
super(TFMGEntityTypes.BLUE_SPARK.get(), p_37395_, p_37396_, p_37397_, p_37394_);
}
@Override
protected float getGravity(){
return 0.02f;
}
@Override
protected void defineSynchedData() {
}
public void tick(){
super.tick();
if (this.isInWaterOrRain()) {
this.discard();
}
if(this.level.isClientSide) {
CubeParticleData data =
new CubeParticleData(4.1f, 60.2f, 100.3f, .0125f + .0625f * random.nextFloat(), 30, false);
level.addParticle(data, this.getX(), this.getY(), this.getZ(), this.random.nextGaussian() * 0.05D, -this.getDeltaMovement().y * 0.5D, this.random.nextGaussian() * 0.05D);
}
}
protected Item getDefaultItem() {
return TFMGItems.THERMITE_GRENADE.get();
}
private ParticleOptions getParticle() {
return ParticleTypes.FLAME;
}
public void handleEntityEvent(byte p_37402_) {
if (p_37402_ == 3) {
ParticleOptions particleoptions = this.getParticle();
for(int i = 0; i < 8; ++i) {
this.level.addParticle(particleoptions, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
protected void onHitBlock(BlockHitResult p_37384_) {
super.onHitBlock(p_37384_);
if (!this.level.isClientSide) {
Entity entity = this.getOwner();
if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) {
BlockPos blockpos = p_37384_.getBlockPos().relative(p_37384_.getDirection());
if (this.level.isEmptyBlock(blockpos)) {
this.level.setBlockAndUpdate(blockpos, BlueFireBlock.getState(this.level, blockpos));
}
}
}
}
protected void onHitEntity(EntityHitResult p_37386_) {
super.onHitEntity(p_37386_);
if (!this.level.isClientSide) {
Entity entity = p_37386_.getEntity();
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
entity.setSecondsOnFire(10);
}
}
protected void onHit(HitResult p_37406_) {
super.onHit(p_37406_);
if (!this.level.isClientSide) {
this.level.broadcastEntityEvent(this, (byte)3);
//this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.0F, Explosion.BlockInteraction.NONE);
this.discard();
}
}
@SuppressWarnings("unchecked")
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
EntityType.Builder<BlueSpark> entityBuilder = (EntityType.Builder<BlueSpark>) builder;
return entityBuilder.sized(.25f, .25f);
}
}

View File

@@ -0,0 +1,58 @@
package com.drmangotea.tfmg.base.spark;
import com.drmangotea.tfmg.CreateTFMG;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class BlueSparkRenderer extends EntityRenderer<BlueSpark> {
private static final ResourceLocation TEXTURE_LOCATION = CreateTFMG.asResource("textures/entity/blue_spark.png");
private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE_LOCATION);
public BlueSparkRenderer(EntityRendererProvider.Context p_173962_) {
super(p_173962_);
}
protected int getBlockLightLevel(BlueSpark p_114087_, BlockPos p_114088_) {
return 15;
}
public void render(BlueSpark p_114080_, float p_114081_, float p_114082_, PoseStack p_114083_, MultiBufferSource p_114084_, int p_114085_) {
p_114083_.pushPose();
p_114083_.scale(0.5F, 0.5F, 0.5F);
p_114083_.mulPose(this.entityRenderDispatcher.cameraOrientation());
p_114083_.mulPose(Vector3f.YP.rotationDegrees(180.0F));
PoseStack.Pose posestack$pose = p_114083_.last();
Matrix4f matrix4f = posestack$pose.pose();
Matrix3f matrix3f = posestack$pose.normal();
VertexConsumer vertexconsumer = p_114084_.getBuffer(RENDER_TYPE);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 0, 0, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 0, 1, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 1, 1, 0);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 1, 0, 0);
p_114083_.popPose();
super.render(p_114080_, p_114081_, p_114082_, p_114083_, p_114084_, p_114085_);
}
private static void vertex(VertexConsumer p_114090_, Matrix4f p_114091_, Matrix3f p_114092_, int p_114093_, float p_114094_, int p_114095_, int p_114096_, int p_114097_) {
p_114090_.vertex(p_114091_, p_114094_ - 0.5F, (float)p_114095_ - 0.25F, 0.0F).color(255, 255, 255, 255).uv((float)p_114096_, (float)p_114097_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(p_114093_).normal(p_114092_, 0.0F, 1.0F, 0.0F).endVertex();
}
public ResourceLocation getTextureLocation(BlueSpark p_114078_) {
return TEXTURE_LOCATION;
}
}

View File

@@ -0,0 +1,122 @@
package com.drmangotea.tfmg.base.spark;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.GreenFireBlock;
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.content.trains.CubeParticleData;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
public class GreenSpark extends ThrowableProjectile {
public GreenSpark(EntityType<? extends GreenSpark> p_37391_, Level p_37392_) {
super(p_37391_, p_37392_);
}
public GreenSpark(Level p_37399_, LivingEntity p_37400_) {
super(TFMGEntityTypes.SPARK.get(), p_37400_, p_37399_);
}
public GreenSpark(Level level, double p_37395_, double p_37396_, double p_37397_) {
super(TFMGEntityTypes.SPARK.get(), p_37395_, p_37396_, p_37397_, level);
}
@Override
protected float getGravity(){
return 0.02f;
}
@Override
protected void defineSynchedData() {
}
public void tick(){
super.tick();
if (this.isInWaterOrRain()) {
this.discard();
}
if(this.level.isClientSide) {
CubeParticleData data =
new CubeParticleData(0.01f, 100.25f, 20.1f, .0125f + .0625f * random.nextFloat(), 30, true);
level.addParticle(data, this.getX(), this.getY(), this.getZ(), this.random.nextGaussian() * 0.05D, -this.getDeltaMovement().y * 0.5D, this.random.nextGaussian() * 0.05D);
}
}
protected Item getDefaultItem() {
return TFMGItems.THERMITE_GRENADE.get();
}
private ParticleOptions getParticle() {
return ParticleTypes.FLAME;
}
public void handleEntityEvent(byte p_37402_) {
if (p_37402_ == 3) {
ParticleOptions particleoptions = this.getParticle();
for(int i = 0; i < 8; ++i) {
this.level.addParticle(particleoptions, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
protected void onHitBlock(BlockHitResult p_37384_) {
super.onHitBlock(p_37384_);
if (!this.level.isClientSide) {
Entity entity = this.getOwner();
if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) {
BlockPos blockpos = p_37384_.getBlockPos().relative(p_37384_.getDirection());
if (this.level.isEmptyBlock(blockpos)) {
this.level.setBlockAndUpdate(blockpos, GreenFireBlock.getState(this.level, blockpos));
}
}
}
}
protected void onHitEntity(EntityHitResult p_37386_) {
super.onHitEntity(p_37386_);
if (!this.level.isClientSide) {
Entity entity = p_37386_.getEntity();
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
entity.setSecondsOnFire(10);
}
}
protected void onHit(HitResult p_37406_) {
super.onHit(p_37406_);
if (!this.level.isClientSide) {
this.level.broadcastEntityEvent(this, (byte)3);
//this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.0F, Explosion.BlockInteraction.NONE);
this.discard();
}
}
@SuppressWarnings("unchecked")
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
EntityType.Builder<GreenSpark> entityBuilder = (EntityType.Builder<GreenSpark>) builder;
return entityBuilder.sized(.25f, .25f);
}
}

View File

@@ -0,0 +1,58 @@
package com.drmangotea.tfmg.base.spark;
import com.drmangotea.tfmg.CreateTFMG;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class GreenSparkRenderer extends EntityRenderer<GreenSpark> {
private static final ResourceLocation TEXTURE_LOCATION = CreateTFMG.asResource("textures/entity/green_spark.png");
private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE_LOCATION);
public GreenSparkRenderer(EntityRendererProvider.Context p_173962_) {
super(p_173962_);
}
protected int getBlockLightLevel(GreenSpark p_114087_, BlockPos p_114088_) {
return 15;
}
public void render(GreenSpark p_114080_, float p_114081_, float p_114082_, PoseStack p_114083_, MultiBufferSource p_114084_, int p_114085_) {
p_114083_.pushPose();
p_114083_.scale(0.5F, 0.5F, 0.5F);
p_114083_.mulPose(this.entityRenderDispatcher.cameraOrientation());
p_114083_.mulPose(Vector3f.YP.rotationDegrees(180.0F));
PoseStack.Pose posestack$pose = p_114083_.last();
Matrix4f matrix4f = posestack$pose.pose();
Matrix3f matrix3f = posestack$pose.normal();
VertexConsumer vertexconsumer = p_114084_.getBuffer(RENDER_TYPE);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 0, 0, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 0, 1, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 1, 1, 0);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 1, 0, 0);
p_114083_.popPose();
super.render(p_114080_, p_114081_, p_114082_, p_114083_, p_114084_, p_114085_);
}
private static void vertex(VertexConsumer p_114090_, Matrix4f p_114091_, Matrix3f p_114092_, int p_114093_, float p_114094_, int p_114095_, int p_114096_, int p_114097_) {
p_114090_.vertex(p_114091_, p_114094_ - 0.5F, (float)p_114095_ - 0.25F, 0.0F).color(255, 255, 255, 255).uv((float)p_114096_, (float)p_114097_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(p_114093_).normal(p_114092_, 0.0F, 1.0F, 0.0F).endVertex();
}
public ResourceLocation getTextureLocation(GreenSpark p_114078_) {
return TEXTURE_LOCATION;
}
}

View File

@@ -0,0 +1,118 @@
package com.drmangotea.tfmg.base.spark;
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
import com.drmangotea.tfmg.registry.TFMGItems;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.projectile.ThrowableProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseFireBlock;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
public class Spark extends ThrowableProjectile {
public Spark(EntityType<? extends Spark> p_37391_, Level p_37392_) {
super(p_37391_, p_37392_);
}
public Spark(Level p_37399_, LivingEntity p_37400_) {
super(TFMGEntityTypes.SPARK.get(), p_37400_, p_37399_);
}
public Spark(Level p_37394_, double p_37395_, double p_37396_, double p_37397_) {
super(TFMGEntityTypes.SPARK.get(), p_37395_, p_37396_, p_37397_, p_37394_);
}
@Override
protected float getGravity(){
return 0.02f;
}
@Override
protected void defineSynchedData() {
}
public void tick(){
super.tick();
if (this.isInWaterOrRain()) {
this.discard();
}
if(this.level.isClientSide) {
this.level.addParticle(ParticleTypes.FLAME, this.getX(), this.getY(), this.getZ(), this.random.nextGaussian() * 0.05D, -this.getDeltaMovement().y * 0.5D, this.random.nextGaussian() * 0.05D);
}
}
protected Item getDefaultItem() {
return TFMGItems.THERMITE_GRENADE.get();
}
private ParticleOptions getParticle() {
return ParticleTypes.FLAME;
}
public void handleEntityEvent(byte p_37402_) {
if (p_37402_ == 3) {
ParticleOptions particleoptions = this.getParticle();
for(int i = 0; i < 8; ++i) {
this.level.addParticle(particleoptions, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
protected void onHitBlock(BlockHitResult p_37384_) {
super.onHitBlock(p_37384_);
if (!this.level.isClientSide) {
Entity entity = this.getOwner();
if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.level, this)) {
BlockPos blockpos = p_37384_.getBlockPos().relative(p_37384_.getDirection());
if (this.level.isEmptyBlock(blockpos)) {
this.level.setBlockAndUpdate(blockpos, BaseFireBlock.getState(this.level, blockpos));
}
}
}
}
protected void onHitEntity(EntityHitResult p_37386_) {
super.onHitEntity(p_37386_);
if (!this.level.isClientSide) {
Entity entity = p_37386_.getEntity();
Entity entity1 = this.getOwner();
int i = entity.getRemainingFireTicks();
entity.setSecondsOnFire(10);
}
}
protected void onHit(HitResult p_37406_) {
super.onHit(p_37406_);
if (!this.level.isClientSide) {
this.level.broadcastEntityEvent(this, (byte)3);
//this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.0F, Explosion.BlockInteraction.NONE);
this.discard();
}
}
@SuppressWarnings("unchecked")
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
EntityType.Builder<Spark> entityBuilder = (EntityType.Builder<Spark>) builder;
return entityBuilder.sized(.25f, .25f);
}
}

View File

@@ -0,0 +1,57 @@
package com.drmangotea.tfmg.base.spark;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class SparkRenderer extends EntityRenderer<Spark> {
private static final ResourceLocation TEXTURE_LOCATION = new ResourceLocation("textures/particle/lava.png");
private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE_LOCATION);
public SparkRenderer(EntityRendererProvider.Context p_173962_) {
super(p_173962_);
}
protected int getBlockLightLevel(Spark p_114087_, BlockPos p_114088_) {
return 15;
}
public void render(Spark p_114080_, float p_114081_, float p_114082_, PoseStack p_114083_, MultiBufferSource p_114084_, int p_114085_) {
p_114083_.pushPose();
p_114083_.scale(0.5F, 0.5F, 0.5F);
p_114083_.mulPose(this.entityRenderDispatcher.cameraOrientation());
p_114083_.mulPose(Vector3f.YP.rotationDegrees(180.0F));
PoseStack.Pose posestack$pose = p_114083_.last();
Matrix4f matrix4f = posestack$pose.pose();
Matrix3f matrix3f = posestack$pose.normal();
VertexConsumer vertexconsumer = p_114084_.getBuffer(RENDER_TYPE);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 0, 0, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 0, 1, 1);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 1.0F, 1, 1, 0);
vertex(vertexconsumer, matrix4f, matrix3f, p_114085_, 0.0F, 1, 0, 0);
p_114083_.popPose();
super.render(p_114080_, p_114081_, p_114082_, p_114083_, p_114084_, p_114085_);
}
private static void vertex(VertexConsumer p_114090_, Matrix4f p_114091_, Matrix3f p_114092_, int p_114093_, float p_114094_, int p_114095_, int p_114096_, int p_114097_) {
p_114090_.vertex(p_114091_, p_114094_ - 0.5F, (float)p_114095_ - 0.25F, 0.0F).color(255, 255, 255, 255).uv((float)p_114096_, (float)p_114097_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(p_114093_).normal(p_114092_, 0.0F, 1.0F, 0.0F).endVertex();
}
public ResourceLocation getTextureLocation(Spark p_114078_) {
return TEXTURE_LOCATION;
}
}

View File

@@ -0,0 +1,133 @@
package com.drmangotea.tfmg.content.gadgets.explosives.napalm;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.BlockHitResult;
import javax.annotation.Nullable;
public class NapalmBombBlock extends Block {
public static final BooleanProperty UNSTABLE = BlockStateProperties.UNSTABLE;
public NapalmBombBlock(Properties p_57422_) {
super(p_57422_);
this.registerDefaultState(this.defaultBlockState().setValue(UNSTABLE, Boolean.valueOf(false)));
}
public void onCaughtFire(BlockState state, Level world, BlockPos pos, @Nullable net.minecraft.core.Direction face, @Nullable LivingEntity igniter) {
explode(world, pos, igniter);
}
public void onPlace(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) {
if (!p_57469_.is(p_57466_.getBlock())) {
if (p_57467_.hasNeighborSignal(p_57468_)) {
onCaughtFire(p_57466_, p_57467_, p_57468_, null, null);
p_57467_.removeBlock(p_57468_, false);
}
}
}
public void neighborChanged(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, BlockPos p_57461_, boolean p_57462_) {
if (p_57458_.hasNeighborSignal(p_57459_)) {
onCaughtFire(p_57457_, p_57458_, p_57459_, null, null);
p_57458_.removeBlock(p_57459_, false);
}
}
public void playerWillDestroy(Level p_57445_, BlockPos p_57446_, BlockState p_57447_, Player p_57448_) {
if (!p_57445_.isClientSide() && !p_57448_.isCreative() && p_57447_.getValue(UNSTABLE)) {
onCaughtFire(p_57447_, p_57445_, p_57446_, null, null);
}
super.playerWillDestroy(p_57445_, p_57446_, p_57447_, p_57448_);
}
public void wasExploded(Level p_57441_, BlockPos p_57442_, Explosion p_57443_) {
if (!p_57441_.isClientSide) {
NapalmBombEntity napalmBomb = new NapalmBombEntity(p_57441_, (double)p_57442_.getX() + 0.5D, (double)p_57442_.getY(), (double)p_57442_.getZ() + 0.5D, p_57443_.getSourceMob());
int i = napalmBomb.getFuse();
napalmBomb.setFuse((short)(p_57441_.random.nextInt(i / 4) + i / 8));
p_57441_.addFreshEntity(napalmBomb);
}
}
@Deprecated //Forge: Prefer using IForgeBlock#catchFire
public static void explode(Level p_57434_, BlockPos p_57435_) {
explode(p_57434_, p_57435_, (LivingEntity)null);
}
@Deprecated //Forge: Prefer using IForgeBlock#catchFire
private static void explode(Level p_57437_, BlockPos p_57438_, @Nullable LivingEntity p_57439_) {
if (!p_57437_.isClientSide) {
NapalmBombEntity napalmBomb = new NapalmBombEntity(p_57437_, (double)p_57438_.getX() + 0.5D, (double)p_57438_.getY(), (double)p_57438_.getZ() + 0.5D, p_57439_);
p_57437_.addFreshEntity(napalmBomb);
p_57437_.playSound((Player)null, napalmBomb.getX(), napalmBomb.getY(), napalmBomb.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F);
p_57437_.gameEvent(p_57439_, GameEvent.PRIME_FUSE, p_57438_);
}
}
public InteractionResult use(BlockState p_57450_, Level p_57451_, BlockPos p_57452_, Player p_57453_, InteractionHand p_57454_, BlockHitResult p_57455_) {
ItemStack itemstack = p_57453_.getItemInHand(p_57454_);
if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) {
return super.use(p_57450_, p_57451_, p_57452_, p_57453_, p_57454_, p_57455_);
} else {
onCaughtFire(p_57450_, p_57451_, p_57452_, p_57455_.getDirection(), p_57453_);
p_57451_.setBlock(p_57452_, Blocks.AIR.defaultBlockState(), 11);
Item item = itemstack.getItem();
if (!p_57453_.isCreative()) {
if (itemstack.is(Items.FLINT_AND_STEEL)) {
itemstack.hurtAndBreak(1, p_57453_, (p_57425_) -> {
p_57425_.broadcastBreakEvent(p_57454_);
});
} else {
itemstack.shrink(1);
}
}
p_57453_.awardStat(Stats.ITEM_USED.get(item));
return InteractionResult.sidedSuccess(p_57451_.isClientSide);
}
}
public void onProjectileHit(Level p_57429_, BlockState p_57430_, BlockHitResult p_57431_, Projectile p_57432_) {
if (!p_57429_.isClientSide) {
BlockPos blockpos = p_57431_.getBlockPos();
Entity entity = p_57432_.getOwner();
if (p_57432_.isOnFire() && p_57432_.mayInteract(p_57429_, blockpos)) {
onCaughtFire(p_57430_, p_57429_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null);
p_57429_.removeBlock(blockpos, false);
}
}
}
public boolean dropFromExplosion(Explosion p_57427_) {
return false;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_57464_) {
p_57464_.add(UNSTABLE);
}
}

View File

@@ -0,0 +1,134 @@
package com.drmangotea.tfmg.content.gadgets.explosives.napalm;
import com.drmangotea.tfmg.base.spark.Spark;
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
import com.simibubi.create.Create;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.item.PrimedTnt;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import javax.annotation.Nullable;
public class NapalmBombEntity extends Entity {
private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT);
private static final int DEFAULT_FUSE_TIME = 80;
@Nullable
private LivingEntity owner;
public NapalmBombEntity(EntityType<? extends NapalmBombEntity> p_32076_, Level p_32077_) {
super(p_32076_, p_32077_);
this.blocksBuilding = true;
}
public NapalmBombEntity(Level p_32079_, double p_32080_, double p_32081_, double p_32082_, @Nullable LivingEntity p_32083_) {
this(TFMGEntityTypes.NAPALM_BOMB.get(), p_32079_);
this.setPos(p_32080_, p_32081_, p_32082_);
double d0 = p_32079_.random.nextDouble() * (double)((float)Math.PI * 2F);
this.setDeltaMovement(-Math.sin(d0) * 0.02D, (double)0.2F, -Math.cos(d0) * 0.02D);
this.setFuse(80);
this.xo = p_32080_;
this.yo = p_32081_;
this.zo = p_32082_;
this.owner = p_32083_;
}
protected void defineSynchedData() {
this.entityData.define(DATA_FUSE_ID, 80);
}
protected MovementEmission getMovementEmission() {
return MovementEmission.NONE;
}
public boolean isPickable() {
return !this.isRemoved();
}
public void tick() {
if (!this.isNoGravity()) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.04D, 0.0D));
}
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
if (this.onGround) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
}
int i = this.getFuse() - 1;
this.setFuse(i);
if (i <= 0) {
this.discard();
if (!this.level.isClientSide) {
this.explode();
}
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level.isClientSide) {
this.level.addParticle(ParticleTypes.FLAME, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
protected void explode() {
float f = 4.0F;
for (int i=0; i<40;i++){
float x= Create.RANDOM.nextFloat(360);
float y= Create.RANDOM.nextFloat(360);
float z= Create.RANDOM.nextFloat(360);
Spark spark = TFMGEntityTypes.SPARK.create(level);
spark.moveTo(this.getX(), this.getY()+1, this.getZ());
spark.shootFromRotation( this,x,y,z,0.3f,1);
this.level.addFreshEntity(spark);
}
this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.5F, Explosion.BlockInteraction.BREAK);
}
protected void addAdditionalSaveData(CompoundTag p_32097_) {
p_32097_.putShort("Fuse", (short)this.getFuse());
}
protected void readAdditionalSaveData(CompoundTag p_32091_) {
this.setFuse(p_32091_.getShort("Fuse"));
}
@Nullable
public LivingEntity getOwner() {
return this.owner;
}
protected float getEyeHeight(Pose p_32088_, EntityDimensions p_32089_) {
return 0.15F;
}
public void setFuse(int p_32086_) {
this.entityData.set(DATA_FUSE_ID, p_32086_);
}
public int getFuse() {
return this.entityData.get(DATA_FUSE_ID);
}
public Packet<?> getAddEntityPacket() {
return new ClientboundAddEntityPacket(this);
}
@SuppressWarnings("unchecked")
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
EntityType.Builder<NapalmBombEntity> entityBuilder = (EntityType.Builder<NapalmBombEntity>) builder;
return entityBuilder.sized(.25f, .25f);
}
}

View File

@@ -0,0 +1,50 @@
package com.drmangotea.tfmg.content.gadgets.explosives.napalm;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class NapalmBombRenderer extends EntityRenderer<NapalmBombEntity> {
private final BlockRenderDispatcher blockRenderer;
public NapalmBombRenderer(EntityRendererProvider.Context p_174426_) {
super(p_174426_);
this.shadowRadius = 0.5F;
this.blockRenderer = p_174426_.getBlockRenderDispatcher();
}
public void render(NapalmBombEntity p_116177_, float p_116178_, float p_116179_, PoseStack p_116180_, MultiBufferSource p_116181_, int p_116182_) {
p_116180_.pushPose();
p_116180_.translate(0.0D, 0.5D, 0.0D);
int i = p_116177_.getFuse();
if ((float)i - p_116179_ + 1.0F < 10.0F) {
float f = 1.0F - ((float)i - p_116179_ + 1.0F) / 10.0F;
f = Mth.clamp(f, 0.0F, 1.0F);
f *= f;
f *= f;
float f1 = 1.0F + f * 0.3F;
p_116180_.scale(f1, f1, f1);
}
p_116180_.mulPose(Vector3f.YP.rotationDegrees(-90.0F));
p_116180_.translate(-0.5D, -0.5D, 0.5D);
p_116180_.mulPose(Vector3f.YP.rotationDegrees(90.0F));
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, TFMGBlocks.NAPALM_BOMB.get().defaultBlockState(), p_116180_, p_116181_, p_116182_, i / 5 % 2 == 0);
p_116180_.popPose();
super.render(p_116177_, p_116178_, p_116179_, p_116180_, p_116181_, p_116182_);
}
public ResourceLocation getTextureLocation(NapalmBombEntity p_116175_) {
return TextureAtlas.LOCATION_BLOCKS;
}
}

View File

@@ -0,0 +1,7 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades;
public enum ChemicalColor {
BASE,
GREEN,
BLUE
}

View File

@@ -0,0 +1,118 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades;
import com.drmangotea.tfmg.base.spark.BlueSpark;
import com.drmangotea.tfmg.base.spark.GreenSpark;
import com.drmangotea.tfmg.base.spark.Spark;
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.Create;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
public class ThermiteGrenade extends ThrowableItemProjectile {
public final ChemicalColor flameColor;
public ThermiteGrenade(EntityType<? extends ThermiteGrenade> p_37391_, Level p_37392_) {
super(p_37391_, p_37392_);
this.flameColor =ChemicalColor.BLUE;
}
public ThermiteGrenade(Level p_37399_, LivingEntity p_37400_, ChemicalColor color,EntityType grenade) {
super(grenade, p_37400_, p_37399_);
this.flameColor = color;
}
public ThermiteGrenade(Level p_37394_, double p_37395_, double p_37396_, double p_37397_) {
super(TFMGEntityTypes.THERMITE_GRENADE.get(), p_37395_, p_37396_, p_37397_, p_37394_);
this.flameColor =ChemicalColor.BLUE;
}
protected Item getDefaultItem() {
return TFMGItems.THERMITE_GRENADE.get();
}
private ParticleOptions getParticle() {
return ParticleTypes.FLAME;
}
public void handleEntityEvent(byte p_37402_) {
if (p_37402_ == 3) {
ParticleOptions particleoptions = this.getParticle();
for(int i = 0; i < 8; ++i) {
this.level.addParticle(particleoptions, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
}
}
}
protected void onHitEntity(EntityHitResult p_37404_) {
super.onHitEntity(p_37404_);
Entity entity = p_37404_.getEntity();
entity.hurt(DamageSource.thrown(this, this.getOwner()), 1);
}
protected void onHit(HitResult p_37406_) {
super.onHit(p_37406_);
if (!this.level.isClientSide) {
this.level.broadcastEntityEvent(this, (byte) 3);
for (int i=0; i<20;i++){
float x= Create.RANDOM.nextFloat(360);
float y= Create.RANDOM.nextFloat(360);
float z= Create.RANDOM.nextFloat(360);
if(flameColor==ChemicalColor.GREEN){
GreenSpark spark = TFMGEntityTypes.GREEN_SPARK.create(level);
spark.moveTo(this.getX(), this.getY()+1, this.getZ());
spark.shootFromRotation( this,x,y,z,0.2f,1);
this.level.addFreshEntity(spark);
}else
if(flameColor==ChemicalColor.BLUE){
BlueSpark spark = TFMGEntityTypes.BLUE_SPARK.create(level);
spark.moveTo(this.getX(), this.getY()+1, this.getZ());
spark.shootFromRotation( this,x,y,z,0.2f,1);
this.level.addFreshEntity(spark);
} else { Spark spark = TFMGEntityTypes.SPARK.create(level);
spark.moveTo(this.getX(), this.getY()+1, this.getZ());
spark.shootFromRotation( this,x,y,z,0.2f,1);
this.level.addFreshEntity(spark);}
}
this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 2.0F, Explosion.BlockInteraction.NONE);
this.discard();
}
}
@SuppressWarnings("unchecked")
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
EntityType.Builder<ThermiteGrenade> entityBuilder = (EntityType.Builder<ThermiteGrenade>) builder;
return entityBuilder.sized(.25f, .25f);
}
}

View File

@@ -0,0 +1,48 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades;
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
public class ThermiteGrenadeItem extends Item {
public final ChemicalColor flameColor;
public ThermiteGrenadeItem(Properties p_41383_, ChemicalColor color) {
super(p_41383_);
this.flameColor = color;
}
public InteractionResultHolder<ItemStack> use(Level p_43142_, Player p_43143_, InteractionHand p_43144_) {
ItemStack itemstack = p_43143_.getItemInHand(p_43144_);
p_43143_.getCooldowns().addCooldown(this, 60);
p_43142_.playSound((Player)null, p_43143_.getX(), p_43143_.getY(), p_43143_.getZ(), SoundEvents.EGG_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (p_43142_.getRandom().nextFloat() * 0.4F + 0.8F));
if (!p_43142_.isClientSide) {
ThermiteGrenade grenade;
if(flameColor==ChemicalColor.GREEN) {
grenade = new ThermiteGrenade(p_43142_, p_43143_, flameColor, TFMGEntityTypes.ZINC_GRENADE.get());
}else if(flameColor==ChemicalColor.BLUE) {
grenade = new ThermiteGrenade(p_43142_, p_43143_, flameColor, TFMGEntityTypes.COPPER_GRENADE.get());
}else {
grenade = new ThermiteGrenade(p_43142_, p_43143_, flameColor, TFMGEntityTypes.THERMITE_GRENADE.get());
}
grenade.setItem(itemstack);
grenade.shootFromRotation(p_43143_, p_43143_.getXRot(), p_43143_.getYRot(), 0.0F, 0.5F, 1.0F);
p_43142_.addFreshEntity(grenade);
}
p_43143_.awardStat(Stats.ITEM_USED.get(this));
if (!p_43143_.getAbilities().instabuild) {
itemstack.shrink(1);
}
return InteractionResultHolder.sidedSuccess(itemstack, p_43142_.isClientSide());
}
}

View File

@@ -0,0 +1,64 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.simibubi.create.content.fluids.tank.FluidTankBlock;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class ThermiteGrenadeRenderer extends EntityRenderer<ThermiteGrenade> {
private final ItemRenderer itemRenderer;
private ChemicalColor chemicalColor;
public static ThermiteGrenadeRenderer regular(EntityRendererProvider.Context p_i48440_1_) {
return new ThermiteGrenadeRenderer(p_i48440_1_, ChemicalColor.BASE);
}
public static ThermiteGrenadeRenderer green(EntityRendererProvider.Context p_i48440_1_) {
return new ThermiteGrenadeRenderer(p_i48440_1_, ChemicalColor.GREEN);
}
public static ThermiteGrenadeRenderer blue(EntityRendererProvider.Context p_i48440_1_) {
return new ThermiteGrenadeRenderer(p_i48440_1_, ChemicalColor.BLUE);
}
public ThermiteGrenadeRenderer(EntityRendererProvider.Context p_174114_,ChemicalColor color) {
super(p_174114_);
this.chemicalColor = color;
this.itemRenderer = p_174114_.getItemRenderer();
}
public void render(ThermiteGrenade grenade, float p_114657_, float p_114658_, PoseStack p_114659_, MultiBufferSource p_114660_, int p_114661_) {
p_114659_.pushPose();
p_114659_.mulPose(this.entityRenderDispatcher.cameraOrientation());
p_114659_.mulPose(Vector3f.YP.rotationDegrees(180.0F));
if (chemicalColor == ChemicalColor.GREEN) {
this.itemRenderer.renderStatic(TFMGItems.ZINC_GRENADE.get().getDefaultInstance(), ItemTransforms.TransformType.GROUND, p_114661_, OverlayTexture.NO_OVERLAY, p_114659_, p_114660_, grenade.getId());
} else if (chemicalColor == ChemicalColor.BLUE) {
this.itemRenderer.renderStatic(TFMGItems.COPPER_GRENADE.get().getDefaultInstance(), ItemTransforms.TransformType.GROUND, p_114661_, OverlayTexture.NO_OVERLAY, p_114659_, p_114660_, grenade.getId());
} else {
this.itemRenderer.renderStatic(TFMGItems.THERMITE_GRENADE.get().getDefaultInstance(), ItemTransforms.TransformType.GROUND, p_114661_, OverlayTexture.NO_OVERLAY, p_114659_, p_114660_, grenade.getId());
}
p_114659_.popPose();
super.render(grenade, p_114657_, p_114658_, p_114659_, p_114660_, p_114661_);
}
public ResourceLocation getTextureLocation(ThermiteGrenade p_114654_) {
return TextureAtlas.LOCATION_BLOCKS;
}
}

View File

@@ -0,0 +1,447 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.google.common.collect.ImmutableMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.*;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
public class BlueFireBlock extends BaseFireBlock {
public static final int MAX_AGE = 15;
public static final IntegerProperty AGE = BlockStateProperties.AGE_15;
public static final BooleanProperty NORTH = PipeBlock.NORTH;
public static final BooleanProperty EAST = PipeBlock.EAST;
public static final BooleanProperty SOUTH = PipeBlock.SOUTH;
public static final BooleanProperty WEST = PipeBlock.WEST;
public static final BooleanProperty UP = PipeBlock.UP;
private static final Map<Direction, BooleanProperty> PROPERTY_BY_DIRECTION = PipeBlock.PROPERTY_BY_DIRECTION.entrySet().stream().filter((p_53467_) -> {
return p_53467_.getKey() != Direction.DOWN;
}).collect(Util.toMap());
private static final VoxelShape UP_AABB = Block.box(0.0D, 15.0D, 0.0D, 16.0D, 16.0D, 16.0D);
private static final VoxelShape WEST_AABB = Block.box(0.0D, 0.0D, 0.0D, 1.0D, 16.0D, 16.0D);
private static final VoxelShape EAST_AABB = Block.box(15.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D);
private static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 1.0D);
private static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 15.0D, 16.0D, 16.0D, 16.0D);
private final Map<BlockState, VoxelShape> shapesCache;
private static final int IGNITE_INSTANT = 60;
private static final int IGNITE_EASY = 30;
private static final int IGNITE_MEDIUM = 15;
private static final int IGNITE_HARD = 5;
private static final int BURN_INSTANT = 100;
private static final int BURN_EASY = 60;
private static final int BURN_MEDIUM = 20;
private static final int BURN_HARD = 5;
private final Object2IntMap<Block> igniteOdds = new Object2IntOpenHashMap<>();
private final Object2IntMap<Block> burnOdds = new Object2IntOpenHashMap<>();
public BlueFireBlock(Properties p_53425_) {
super(p_53425_, 1.0F);
this.registerDefaultState(this.stateDefinition.any().setValue(AGE, Integer.valueOf(0)).setValue(NORTH, Boolean.valueOf(false)).setValue(EAST, Boolean.valueOf(false)).setValue(SOUTH, Boolean.valueOf(false)).setValue(WEST, Boolean.valueOf(false)).setValue(UP, Boolean.valueOf(false)));
this.shapesCache = ImmutableMap.copyOf(this.stateDefinition.getPossibleStates().stream().filter((p_53497_) -> {
return p_53497_.getValue(AGE) == 0;
}).collect(Collectors.toMap(Function.identity(), BlueFireBlock::calculateShape)));
}
private static VoxelShape calculateShape(BlockState p_53491_) {
VoxelShape voxelshape = Shapes.empty();
if (p_53491_.getValue(UP)) {
voxelshape = UP_AABB;
}
if (p_53491_.getValue(NORTH)) {
voxelshape = Shapes.or(voxelshape, NORTH_AABB);
}
if (p_53491_.getValue(SOUTH)) {
voxelshape = Shapes.or(voxelshape, SOUTH_AABB);
}
if (p_53491_.getValue(EAST)) {
voxelshape = Shapes.or(voxelshape, EAST_AABB);
}
if (p_53491_.getValue(WEST)) {
voxelshape = Shapes.or(voxelshape, WEST_AABB);
}
return voxelshape.isEmpty() ? DOWN_AABB : voxelshape;
}
public BlockState updateShape(BlockState p_53458_, Direction p_53459_, BlockState p_53460_, LevelAccessor p_53461_, BlockPos p_53462_, BlockPos p_53463_) {
return this.canSurvive(p_53458_, p_53461_, p_53462_) ? this.getStateWithAge(p_53461_, p_53462_, p_53458_.getValue(AGE)) : Blocks.AIR.defaultBlockState();
}
public VoxelShape getShape(BlockState p_53474_, BlockGetter p_53475_, BlockPos p_53476_, CollisionContext p_53477_) {
return this.shapesCache.get(p_53474_.setValue(AGE, Integer.valueOf(0)));
}
public BlockState getStateForPlacement(BlockPlaceContext p_53427_) {
return this.getStateForPlacement(p_53427_.getLevel(), p_53427_.getClickedPos());
}
protected BlockState getStateForPlacement(BlockGetter p_53471_, BlockPos p_53472_) {
BlockPos blockpos = p_53472_.below();
BlockState blockstate = p_53471_.getBlockState(blockpos);
if (!this.canCatchFire(p_53471_, p_53472_, Direction.UP) && !blockstate.isFaceSturdy(p_53471_, blockpos, Direction.UP)) {
BlockState blockstate1 = this.defaultBlockState();
for(Direction direction : Direction.values()) {
BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction);
if (booleanproperty != null) {
blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canCatchFire(p_53471_, p_53472_.relative(direction), direction.getOpposite())));
}
}
return blockstate1;
} else {
return this.defaultBlockState();
}
}
public boolean canSurvive(BlockState p_53454_, LevelReader p_53455_, BlockPos p_53456_) {
BlockPos blockpos = p_53456_.below();
return p_53455_.getBlockState(blockpos).isFaceSturdy(p_53455_, blockpos, Direction.UP) || this.isValidFireLocation(p_53455_, p_53456_);
}
public void tick(BlockState p_221160_, ServerLevel p_221161_, BlockPos p_221162_, RandomSource p_221163_) {
p_221161_.scheduleTick(p_221162_, this, getFireTickDelay(p_221161_.random));
if (p_221161_.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
if (!p_221160_.canSurvive(p_221161_, p_221162_)) {
p_221161_.removeBlock(p_221162_, false);
}
BlockState blockstate = p_221161_.getBlockState(p_221162_.below());
boolean flag = blockstate.isFireSource(p_221161_, p_221162_, Direction.UP);
int i = p_221160_.getValue(AGE);
if (!flag && p_221161_.isRaining() && this.isNearRain(p_221161_, p_221162_) && p_221163_.nextFloat() < 0.2F + (float)i * 0.03F) {
p_221161_.removeBlock(p_221162_, false);
} else {
int j = Math.min(15, i + p_221163_.nextInt(3) / 2);
if (i != j) {
p_221160_ = p_221160_.setValue(AGE, Integer.valueOf(j));
p_221161_.setBlock(p_221162_, p_221160_, 4);
}
if (!flag) {
if (!this.isValidFireLocation(p_221161_, p_221162_)) {
BlockPos blockpos = p_221162_.below();
if (!p_221161_.getBlockState(blockpos).isFaceSturdy(p_221161_, blockpos, Direction.UP) || i > 3) {
p_221161_.removeBlock(p_221162_, false);
}
return;
}
if (i == 15 && p_221163_.nextInt(4) == 0 && !this.canCatchFire(p_221161_, p_221162_.below(), Direction.UP)) {
p_221161_.removeBlock(p_221162_, false);
return;
}
}
boolean flag1 = p_221161_.isHumidAt(p_221162_);
int k = flag1 ? -50 : 0;
this.tryCatchFire(p_221161_, p_221162_.east(), 300 + k, p_221163_, i, Direction.WEST);
this.tryCatchFire(p_221161_, p_221162_.west(), 300 + k, p_221163_, i, Direction.EAST);
this.tryCatchFire(p_221161_, p_221162_.below(), 250 + k, p_221163_, i, Direction.UP);
this.tryCatchFire(p_221161_, p_221162_.above(), 250 + k, p_221163_, i, Direction.DOWN);
this.tryCatchFire(p_221161_, p_221162_.north(), 300 + k, p_221163_, i, Direction.SOUTH);
this.tryCatchFire(p_221161_, p_221162_.south(), 300 + k, p_221163_, i, Direction.NORTH);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for(int l = -1; l <= 1; ++l) {
for(int i1 = -1; i1 <= 1; ++i1) {
for(int j1 = -1; j1 <= 4; ++j1) {
if (l != 0 || j1 != 0 || i1 != 0) {
int k1 = 100;
if (j1 > 1) {
k1 += (j1 - 1) * 100;
}
blockpos$mutableblockpos.setWithOffset(p_221162_, l, j1, i1);
int l1 = this.getIgniteOdds(p_221161_, blockpos$mutableblockpos);
if (l1 > 0) {
int i2 = (l1 + 40 + p_221161_.getDifficulty().getId() * 7) / (i + 30);
if (flag1) {
i2 /= 2;
}
if (i2 > 0 && p_221163_.nextInt(k1) <= i2 && (!p_221161_.isRaining() || !this.isNearRain(p_221161_, blockpos$mutableblockpos))) {
int j2 = Math.min(15, i + p_221163_.nextInt(5) / 4);
p_221161_.setBlock(blockpos$mutableblockpos, this.getStateWithAge(p_221161_, blockpos$mutableblockpos, j2), 3);
}
}
}
}
}
}
}
}
}
protected boolean isNearRain(Level p_53429_, BlockPos p_53430_) {
return p_53429_.isRainingAt(p_53430_) || p_53429_.isRainingAt(p_53430_.west()) || p_53429_.isRainingAt(p_53430_.east()) || p_53429_.isRainingAt(p_53430_.north()) || p_53429_.isRainingAt(p_53430_.south());
}
@Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only.
public int getBurnOdds(BlockState p_221165_) {
return p_221165_.hasProperty(BlockStateProperties.WATERLOGGED) && p_221165_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.burnOdds.getInt(p_221165_.getBlock());
}
@Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
public int getIgniteOdds(BlockState p_221167_) {
return p_221167_.hasProperty(BlockStateProperties.WATERLOGGED) && p_221167_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.igniteOdds.getInt(p_221167_.getBlock());
}
public static BlockState getState(BlockGetter p_49246_, BlockPos p_49247_) {
return ((BlueFireBlock)TFMGColoredFires.BLUE_FIRE.get()).getStateForPlacement(p_49246_, p_49247_);
}
private void tryCatchFire(Level p_53432_, BlockPos p_53433_, int p_53434_, RandomSource p_53435_, int p_53436_, Direction face) {
int i = p_53432_.getBlockState(p_53433_).getFlammability(p_53432_, p_53433_, face);
if (p_53435_.nextInt(p_53434_) < i) {
BlockState blockstate = p_53432_.getBlockState(p_53433_);
if (p_53435_.nextInt(p_53434_ + 10) < 5 && !p_53432_.isRainingAt(p_53433_)) {
int j = Math.min(p_53434_ + p_53435_.nextInt(5) / 4, 15);
p_53432_.setBlock(p_53433_, this.getStateWithAge(p_53432_, p_53433_, j), 3);
} else {
p_53432_.removeBlock(p_53433_, false);
}
blockstate.onCaughtFire(p_53432_, p_53433_, face, null);
}
}
private BlockState getStateWithAge(LevelAccessor p_53438_, BlockPos p_53439_, int p_53440_) {
BlockState blockstate = getState(p_53438_, p_53439_);
return blockstate.is(TFMGColoredFires.BLUE_FIRE.get()) ? blockstate.setValue(AGE, Integer.valueOf(p_53440_)) : blockstate;
}
private boolean isValidFireLocation(BlockGetter p_53486_, BlockPos p_53487_) {
for(Direction direction : Direction.values()) {
if (this.canCatchFire(p_53486_, p_53487_.relative(direction), direction.getOpposite())) {
return true;
}
}
return false;
}
private int getIgniteOdds(LevelReader p_221157_, BlockPos p_221158_) {
if (!p_221157_.isEmptyBlock(p_221158_)) {
return 0;
} else {
int i = 0;
for(Direction direction : Direction.values()) {
BlockState blockstate = p_221157_.getBlockState(p_221158_.relative(direction));
i = Math.max(blockstate.getFireSpreadSpeed(p_221157_, p_221158_.relative(direction), direction.getOpposite()), i);
}
return i;
}
}
@Deprecated //Forge: Use canCatchFire with more context
protected boolean canBurn(BlockState p_53489_) {
return this.getIgniteOdds(p_53489_) > 0;
}
public void onPlace(BlockState p_53479_, Level p_53480_, BlockPos p_53481_, BlockState p_53482_, boolean p_53483_) {
super.onPlace(p_53479_, p_53480_, p_53481_, p_53482_, p_53483_);
p_53480_.scheduleTick(p_53481_, this, getFireTickDelay(p_53480_.random));
}
private static int getFireTickDelay(RandomSource p_221149_) {
return 30 + p_221149_.nextInt(10);
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_53465_) {
p_53465_.add(AGE, NORTH, EAST, SOUTH, WEST, UP);
}
private void setFlammable(Block p_53445_, int p_53446_, int p_53447_) {
if (p_53445_ == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.igniteOdds.put(p_53445_, p_53446_);
this.burnOdds.put(p_53445_, p_53447_);
}
public boolean canCatchFire(BlockGetter world, BlockPos pos, Direction face) {
return world.getBlockState(pos).isFlammable(world, pos, face);
}
public static void bootStrap() {
BlueFireBlock fireblock = (BlueFireBlock) TFMGColoredFires.BLUE_FIRE.get();
fireblock.setFlammable(Blocks.OAK_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.OAK_SLAB, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_SLAB, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_SLAB, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_SLAB, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_SLAB, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_SLAB, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20);
fireblock.setFlammable(Blocks.OAK_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.OAK_FENCE, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_FENCE, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_FENCE, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_FENCE, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_FENCE, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_FENCE, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20);
fireblock.setFlammable(Blocks.OAK_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.SPRUCE_LOG, 5, 5);
fireblock.setFlammable(Blocks.BIRCH_LOG, 5, 5);
fireblock.setFlammable(Blocks.JUNGLE_LOG, 5, 5);
fireblock.setFlammable(Blocks.ACACIA_LOG, 5, 5);
fireblock.setFlammable(Blocks.DARK_OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.MANGROVE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.SPRUCE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.BIRCH_WOOD, 5, 5);
fireblock.setFlammable(Blocks.JUNGLE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.ACACIA_WOOD, 5, 5);
fireblock.setFlammable(Blocks.DARK_OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20);
fireblock.setFlammable(Blocks.OAK_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.SPRUCE_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.BIRCH_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.JUNGLE_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.ACACIA_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.DARK_OAK_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.BOOKSHELF, 30, 20);
fireblock.setFlammable(Blocks.TNT, 15, 100);
fireblock.setFlammable(Blocks.GRASS, 60, 100);
fireblock.setFlammable(Blocks.FERN, 60, 100);
fireblock.setFlammable(Blocks.DEAD_BUSH, 60, 100);
fireblock.setFlammable(Blocks.SUNFLOWER, 60, 100);
fireblock.setFlammable(Blocks.LILAC, 60, 100);
fireblock.setFlammable(Blocks.ROSE_BUSH, 60, 100);
fireblock.setFlammable(Blocks.PEONY, 60, 100);
fireblock.setFlammable(Blocks.TALL_GRASS, 60, 100);
fireblock.setFlammable(Blocks.LARGE_FERN, 60, 100);
fireblock.setFlammable(Blocks.DANDELION, 60, 100);
fireblock.setFlammable(Blocks.POPPY, 60, 100);
fireblock.setFlammable(Blocks.BLUE_ORCHID, 60, 100);
fireblock.setFlammable(Blocks.ALLIUM, 60, 100);
fireblock.setFlammable(Blocks.AZURE_BLUET, 60, 100);
fireblock.setFlammable(Blocks.RED_TULIP, 60, 100);
fireblock.setFlammable(Blocks.ORANGE_TULIP, 60, 100);
fireblock.setFlammable(Blocks.WHITE_TULIP, 60, 100);
fireblock.setFlammable(Blocks.PINK_TULIP, 60, 100);
fireblock.setFlammable(Blocks.OXEYE_DAISY, 60, 100);
fireblock.setFlammable(Blocks.CORNFLOWER, 60, 100);
fireblock.setFlammable(Blocks.LILY_OF_THE_VALLEY, 60, 100);
fireblock.setFlammable(Blocks.WITHER_ROSE, 60, 100);
fireblock.setFlammable(Blocks.WHITE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.ORANGE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.MAGENTA_WOOL, 30, 60);
fireblock.setFlammable(Blocks.LIGHT_BLUE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.YELLOW_WOOL, 30, 60);
fireblock.setFlammable(Blocks.LIME_WOOL, 30, 60);
fireblock.setFlammable(Blocks.PINK_WOOL, 30, 60);
fireblock.setFlammable(Blocks.GRAY_WOOL, 30, 60);
fireblock.setFlammable(Blocks.LIGHT_GRAY_WOOL, 30, 60);
fireblock.setFlammable(Blocks.CYAN_WOOL, 30, 60);
fireblock.setFlammable(Blocks.PURPLE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.BLUE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.BROWN_WOOL, 30, 60);
fireblock.setFlammable(Blocks.GREEN_WOOL, 30, 60);
fireblock.setFlammable(Blocks.RED_WOOL, 30, 60);
fireblock.setFlammable(Blocks.BLACK_WOOL, 30, 60);
fireblock.setFlammable(Blocks.VINE, 15, 100);
fireblock.setFlammable(Blocks.COAL_BLOCK, 5, 5);
fireblock.setFlammable(Blocks.HAY_BLOCK, 60, 20);
fireblock.setFlammable(Blocks.TARGET, 15, 20);
fireblock.setFlammable(Blocks.WHITE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.ORANGE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.MAGENTA_CARPET, 60, 20);
fireblock.setFlammable(Blocks.LIGHT_BLUE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.YELLOW_CARPET, 60, 20);
fireblock.setFlammable(Blocks.LIME_CARPET, 60, 20);
fireblock.setFlammable(Blocks.PINK_CARPET, 60, 20);
fireblock.setFlammable(Blocks.GRAY_CARPET, 60, 20);
fireblock.setFlammable(Blocks.LIGHT_GRAY_CARPET, 60, 20);
fireblock.setFlammable(Blocks.CYAN_CARPET, 60, 20);
fireblock.setFlammable(Blocks.PURPLE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.GREEN_CARPET, 60, 20);
fireblock.setFlammable(Blocks.BROWN_CARPET, 60, 20);
fireblock.setFlammable(Blocks.BLUE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.RED_CARPET, 60, 20);
fireblock.setFlammable(Blocks.BLACK_CARPET, 60, 20);
fireblock.setFlammable(Blocks.DRIED_KELP_BLOCK, 30, 60);
fireblock.setFlammable(Blocks.BAMBOO, 60, 60);
fireblock.setFlammable(Blocks.SCAFFOLDING, 60, 60);
fireblock.setFlammable(Blocks.LECTERN, 30, 20);
fireblock.setFlammable(Blocks.COMPOSTER, 5, 20);
fireblock.setFlammable(Blocks.SWEET_BERRY_BUSH, 60, 100);
fireblock.setFlammable(Blocks.BEEHIVE, 5, 20);
fireblock.setFlammable(Blocks.BEE_NEST, 30, 20);
fireblock.setFlammable(Blocks.AZALEA_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.FLOWERING_AZALEA_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.CAVE_VINES, 15, 60);
fireblock.setFlammable(Blocks.CAVE_VINES_PLANT, 15, 60);
fireblock.setFlammable(Blocks.SPORE_BLOSSOM, 60, 100);
fireblock.setFlammable(Blocks.AZALEA, 30, 60);
fireblock.setFlammable(Blocks.FLOWERING_AZALEA, 30, 60);
fireblock.setFlammable(Blocks.BIG_DRIPLEAF, 60, 100);
fireblock.setFlammable(Blocks.BIG_DRIPLEAF_STEM, 60, 100);
fireblock.setFlammable(Blocks.SMALL_DRIPLEAF, 60, 100);
fireblock.setFlammable(Blocks.HANGING_ROOTS, 30, 60);
fireblock.setFlammable(Blocks.GLOW_LICHEN, 15, 100);
}
}

View File

@@ -0,0 +1,451 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.google.common.collect.ImmutableMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
public class GreenFireBlock extends BaseFireBlock {
public static final int MAX_AGE = 15;
public static final IntegerProperty AGE = BlockStateProperties.AGE_15;
public static final BooleanProperty NORTH = PipeBlock.NORTH;
public static final BooleanProperty EAST = PipeBlock.EAST;
public static final BooleanProperty SOUTH = PipeBlock.SOUTH;
public static final BooleanProperty WEST = PipeBlock.WEST;
public static final BooleanProperty UP = PipeBlock.UP;
private static final Map<Direction, BooleanProperty> PROPERTY_BY_DIRECTION = PipeBlock.PROPERTY_BY_DIRECTION.entrySet().stream().filter((p_53467_) -> {
return p_53467_.getKey() != Direction.DOWN;
}).collect(Util.toMap());
private static final VoxelShape UP_AABB = Block.box(0.0D, 15.0D, 0.0D, 16.0D, 16.0D, 16.0D);
private static final VoxelShape WEST_AABB = Block.box(0.0D, 0.0D, 0.0D, 1.0D, 16.0D, 16.0D);
private static final VoxelShape EAST_AABB = Block.box(15.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D);
private static final VoxelShape NORTH_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 1.0D);
private static final VoxelShape SOUTH_AABB = Block.box(0.0D, 0.0D, 15.0D, 16.0D, 16.0D, 16.0D);
private final Map<BlockState, VoxelShape> shapesCache;
private static final int IGNITE_INSTANT = 60;
private static final int IGNITE_EASY = 30;
private static final int IGNITE_MEDIUM = 15;
private static final int IGNITE_HARD = 5;
private static final int BURN_INSTANT = 100;
private static final int BURN_EASY = 60;
private static final int BURN_MEDIUM = 20;
private static final int BURN_HARD = 5;
private final Object2IntMap<Block> igniteOdds = new Object2IntOpenHashMap<>();
private final Object2IntMap<Block> burnOdds = new Object2IntOpenHashMap<>();
public GreenFireBlock(BlockBehaviour.Properties p_53425_) {
super(p_53425_, 1.0F);
this.registerDefaultState(this.stateDefinition.any().setValue(AGE, Integer.valueOf(0)).setValue(NORTH, Boolean.valueOf(false)).setValue(EAST, Boolean.valueOf(false)).setValue(SOUTH, Boolean.valueOf(false)).setValue(WEST, Boolean.valueOf(false)).setValue(UP, Boolean.valueOf(false)));
this.shapesCache = ImmutableMap.copyOf(this.stateDefinition.getPossibleStates().stream().filter((p_53497_) -> {
return p_53497_.getValue(AGE) == 0;
}).collect(Collectors.toMap(Function.identity(), GreenFireBlock::calculateShape)));
}
private static VoxelShape calculateShape(BlockState p_53491_) {
VoxelShape voxelshape = Shapes.empty();
if (p_53491_.getValue(UP)) {
voxelshape = UP_AABB;
}
if (p_53491_.getValue(NORTH)) {
voxelshape = Shapes.or(voxelshape, NORTH_AABB);
}
if (p_53491_.getValue(SOUTH)) {
voxelshape = Shapes.or(voxelshape, SOUTH_AABB);
}
if (p_53491_.getValue(EAST)) {
voxelshape = Shapes.or(voxelshape, EAST_AABB);
}
if (p_53491_.getValue(WEST)) {
voxelshape = Shapes.or(voxelshape, WEST_AABB);
}
return voxelshape.isEmpty() ? DOWN_AABB : voxelshape;
}
public BlockState updateShape(BlockState p_53458_, Direction p_53459_, BlockState p_53460_, LevelAccessor p_53461_, BlockPos p_53462_, BlockPos p_53463_) {
return this.canSurvive(p_53458_, p_53461_, p_53462_) ? this.getStateWithAge(p_53461_, p_53462_, p_53458_.getValue(AGE)) : Blocks.AIR.defaultBlockState();
}
public VoxelShape getShape(BlockState p_53474_, BlockGetter p_53475_, BlockPos p_53476_, CollisionContext p_53477_) {
return this.shapesCache.get(p_53474_.setValue(AGE, Integer.valueOf(0)));
}
public BlockState getStateForPlacement(BlockPlaceContext p_53427_) {
return this.getStateForPlacement(p_53427_.getLevel(), p_53427_.getClickedPos());
}
protected BlockState getStateForPlacement(BlockGetter p_53471_, BlockPos p_53472_) {
BlockPos blockpos = p_53472_.below();
BlockState blockstate = p_53471_.getBlockState(blockpos);
if (!this.canCatchFire(p_53471_, p_53472_, Direction.UP) && !blockstate.isFaceSturdy(p_53471_, blockpos, Direction.UP)) {
BlockState blockstate1 = this.defaultBlockState();
for(Direction direction : Direction.values()) {
BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction);
if (booleanproperty != null) {
blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canCatchFire(p_53471_, p_53472_.relative(direction), direction.getOpposite())));
}
}
return blockstate1;
} else {
return this.defaultBlockState();
}
}
public boolean canSurvive(BlockState p_53454_, LevelReader p_53455_, BlockPos p_53456_) {
BlockPos blockpos = p_53456_.below();
return p_53455_.getBlockState(blockpos).isFaceSturdy(p_53455_, blockpos, Direction.UP) || this.isValidFireLocation(p_53455_, p_53456_);
}
public void tick(BlockState p_221160_, ServerLevel p_221161_, BlockPos p_221162_, RandomSource p_221163_) {
p_221161_.scheduleTick(p_221162_, this, getFireTickDelay(p_221161_.random));
if (p_221161_.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
if (!p_221160_.canSurvive(p_221161_, p_221162_)) {
p_221161_.removeBlock(p_221162_, false);
}
BlockState blockstate = p_221161_.getBlockState(p_221162_.below());
boolean flag = blockstate.isFireSource(p_221161_, p_221162_, Direction.UP);
int i = p_221160_.getValue(AGE);
if (!flag && p_221161_.isRaining() && this.isNearRain(p_221161_, p_221162_) && p_221163_.nextFloat() < 0.2F + (float)i * 0.03F) {
p_221161_.removeBlock(p_221162_, false);
} else {
int j = Math.min(15, i + p_221163_.nextInt(3) / 2);
if (i != j) {
p_221160_ = p_221160_.setValue(AGE, Integer.valueOf(j));
p_221161_.setBlock(p_221162_, p_221160_, 4);
}
if (!flag) {
if (!this.isValidFireLocation(p_221161_, p_221162_)) {
BlockPos blockpos = p_221162_.below();
if (!p_221161_.getBlockState(blockpos).isFaceSturdy(p_221161_, blockpos, Direction.UP) || i > 3) {
p_221161_.removeBlock(p_221162_, false);
}
return;
}
if (i == 15 && p_221163_.nextInt(4) == 0 && !this.canCatchFire(p_221161_, p_221162_.below(), Direction.UP)) {
p_221161_.removeBlock(p_221162_, false);
return;
}
}
boolean flag1 = p_221161_.isHumidAt(p_221162_);
int k = flag1 ? -50 : 0;
this.tryCatchFire(p_221161_, p_221162_.east(), 300 + k, p_221163_, i, Direction.WEST);
this.tryCatchFire(p_221161_, p_221162_.west(), 300 + k, p_221163_, i, Direction.EAST);
this.tryCatchFire(p_221161_, p_221162_.below(), 250 + k, p_221163_, i, Direction.UP);
this.tryCatchFire(p_221161_, p_221162_.above(), 250 + k, p_221163_, i, Direction.DOWN);
this.tryCatchFire(p_221161_, p_221162_.north(), 300 + k, p_221163_, i, Direction.SOUTH);
this.tryCatchFire(p_221161_, p_221162_.south(), 300 + k, p_221163_, i, Direction.NORTH);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for(int l = -1; l <= 1; ++l) {
for(int i1 = -1; i1 <= 1; ++i1) {
for(int j1 = -1; j1 <= 4; ++j1) {
if (l != 0 || j1 != 0 || i1 != 0) {
int k1 = 100;
if (j1 > 1) {
k1 += (j1 - 1) * 100;
}
blockpos$mutableblockpos.setWithOffset(p_221162_, l, j1, i1);
int l1 = this.getIgniteOdds(p_221161_, blockpos$mutableblockpos);
if (l1 > 0) {
int i2 = (l1 + 40 + p_221161_.getDifficulty().getId() * 7) / (i + 30);
if (flag1) {
i2 /= 2;
}
if (i2 > 0 && p_221163_.nextInt(k1) <= i2 && (!p_221161_.isRaining() || !this.isNearRain(p_221161_, blockpos$mutableblockpos))) {
int j2 = Math.min(15, i + p_221163_.nextInt(5) / 4);
p_221161_.setBlock(blockpos$mutableblockpos, this.getStateWithAge(p_221161_, blockpos$mutableblockpos, j2), 3);
}
}
}
}
}
}
}
}
}
protected boolean isNearRain(Level p_53429_, BlockPos p_53430_) {
return p_53429_.isRainingAt(p_53430_) || p_53429_.isRainingAt(p_53430_.west()) || p_53429_.isRainingAt(p_53430_.east()) || p_53429_.isRainingAt(p_53430_.north()) || p_53429_.isRainingAt(p_53430_.south());
}
@Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only.
public int getBurnOdds(BlockState p_221165_) {
return p_221165_.hasProperty(BlockStateProperties.WATERLOGGED) && p_221165_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.burnOdds.getInt(p_221165_.getBlock());
}
@Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
public int getIgniteOdds(BlockState p_221167_) {
return p_221167_.hasProperty(BlockStateProperties.WATERLOGGED) && p_221167_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.igniteOdds.getInt(p_221167_.getBlock());
}
private void tryCatchFire(Level p_53432_, BlockPos p_53433_, int p_53434_, RandomSource p_53435_, int p_53436_, Direction face) {
int i = p_53432_.getBlockState(p_53433_).getFlammability(p_53432_, p_53433_, face);
if (p_53435_.nextInt(p_53434_) < i) {
BlockState blockstate = p_53432_.getBlockState(p_53433_);
if (p_53435_.nextInt(p_53434_ + 10) < 5 && !p_53432_.isRainingAt(p_53433_)) {
int j = Math.min(p_53434_ + p_53435_.nextInt(5) / 4, 15);
p_53432_.setBlock(p_53433_, this.getStateWithAge(p_53432_, p_53433_, j), 3);
} else {
p_53432_.removeBlock(p_53433_, false);
}
blockstate.onCaughtFire(p_53432_, p_53433_, face, null);
}
}
private BlockState getStateWithAge(LevelAccessor p_53438_, BlockPos p_53439_, int p_53440_) {
BlockState blockstate = getState(p_53438_, p_53439_);
return blockstate.is(TFMGColoredFires.GREEN_FIRE.get()) ? blockstate.setValue(AGE, Integer.valueOf(p_53440_)) : blockstate;
}
private boolean isValidFireLocation(BlockGetter p_53486_, BlockPos p_53487_) {
for(Direction direction : Direction.values()) {
if (this.canCatchFire(p_53486_, p_53487_.relative(direction), direction.getOpposite())) {
return true;
}
}
return false;
}
private int getIgniteOdds(LevelReader p_221157_, BlockPos p_221158_) {
if (!p_221157_.isEmptyBlock(p_221158_)) {
return 0;
} else {
int i = 0;
for(Direction direction : Direction.values()) {
BlockState blockstate = p_221157_.getBlockState(p_221158_.relative(direction));
i = Math.max(blockstate.getFireSpreadSpeed(p_221157_, p_221158_.relative(direction), direction.getOpposite()), i);
}
return i;
}
}
@Deprecated //Forge: Use canCatchFire with more context
protected boolean canBurn(BlockState p_53489_) {
return this.getIgniteOdds(p_53489_) > 0;
}
public void onPlace(BlockState p_53479_, Level p_53480_, BlockPos p_53481_, BlockState p_53482_, boolean p_53483_) {
super.onPlace(p_53479_, p_53480_, p_53481_, p_53482_, p_53483_);
p_53480_.scheduleTick(p_53481_, this, getFireTickDelay(p_53480_.random));
}
private static int getFireTickDelay(RandomSource p_221149_) {
return 30 + p_221149_.nextInt(10);
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_53465_) {
p_53465_.add(AGE, NORTH, EAST, SOUTH, WEST, UP);
}
public static BlockState getState(BlockGetter p_49246_, BlockPos p_49247_) {
return ((GreenFireBlock)TFMGColoredFires.GREEN_FIRE.get()).getStateForPlacement(p_49246_, p_49247_);
}
private void setFlammable(Block p_53445_, int p_53446_, int p_53447_) {
if (p_53445_ == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.igniteOdds.put(p_53445_, p_53446_);
this.burnOdds.put(p_53445_, p_53447_);
}
public boolean canCatchFire(BlockGetter world, BlockPos pos, Direction face) {
return world.getBlockState(pos).isFlammable(world, pos, face);
}
public static void bootStrap() {
GreenFireBlock fireblock = (GreenFireBlock) TFMGColoredFires.GREEN_FIRE.get();
fireblock.setFlammable(Blocks.OAK_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20);
fireblock.setFlammable(Blocks.OAK_SLAB, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_SLAB, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_SLAB, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_SLAB, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_SLAB, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_SLAB, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20);
fireblock.setFlammable(Blocks.OAK_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20);
fireblock.setFlammable(Blocks.OAK_FENCE, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_FENCE, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_FENCE, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_FENCE, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_FENCE, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_FENCE, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20);
fireblock.setFlammable(Blocks.OAK_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.BIRCH_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.SPRUCE_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.JUNGLE_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.ACACIA_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.DARK_OAK_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20);
fireblock.setFlammable(Blocks.OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.SPRUCE_LOG, 5, 5);
fireblock.setFlammable(Blocks.BIRCH_LOG, 5, 5);
fireblock.setFlammable(Blocks.JUNGLE_LOG, 5, 5);
fireblock.setFlammable(Blocks.ACACIA_LOG, 5, 5);
fireblock.setFlammable(Blocks.DARK_OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.MANGROVE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.SPRUCE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.BIRCH_WOOD, 5, 5);
fireblock.setFlammable(Blocks.JUNGLE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.ACACIA_WOOD, 5, 5);
fireblock.setFlammable(Blocks.DARK_OAK_WOOD, 5, 5);
fireblock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5);
fireblock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20);
fireblock.setFlammable(Blocks.OAK_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.SPRUCE_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.BIRCH_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.JUNGLE_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.ACACIA_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.DARK_OAK_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.BOOKSHELF, 30, 20);
fireblock.setFlammable(Blocks.TNT, 15, 100);
fireblock.setFlammable(Blocks.GRASS, 60, 100);
fireblock.setFlammable(Blocks.FERN, 60, 100);
fireblock.setFlammable(Blocks.DEAD_BUSH, 60, 100);
fireblock.setFlammable(Blocks.SUNFLOWER, 60, 100);
fireblock.setFlammable(Blocks.LILAC, 60, 100);
fireblock.setFlammable(Blocks.ROSE_BUSH, 60, 100);
fireblock.setFlammable(Blocks.PEONY, 60, 100);
fireblock.setFlammable(Blocks.TALL_GRASS, 60, 100);
fireblock.setFlammable(Blocks.LARGE_FERN, 60, 100);
fireblock.setFlammable(Blocks.DANDELION, 60, 100);
fireblock.setFlammable(Blocks.POPPY, 60, 100);
fireblock.setFlammable(Blocks.BLUE_ORCHID, 60, 100);
fireblock.setFlammable(Blocks.ALLIUM, 60, 100);
fireblock.setFlammable(Blocks.AZURE_BLUET, 60, 100);
fireblock.setFlammable(Blocks.RED_TULIP, 60, 100);
fireblock.setFlammable(Blocks.ORANGE_TULIP, 60, 100);
fireblock.setFlammable(Blocks.WHITE_TULIP, 60, 100);
fireblock.setFlammable(Blocks.PINK_TULIP, 60, 100);
fireblock.setFlammable(Blocks.OXEYE_DAISY, 60, 100);
fireblock.setFlammable(Blocks.CORNFLOWER, 60, 100);
fireblock.setFlammable(Blocks.LILY_OF_THE_VALLEY, 60, 100);
fireblock.setFlammable(Blocks.WITHER_ROSE, 60, 100);
fireblock.setFlammable(Blocks.WHITE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.ORANGE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.MAGENTA_WOOL, 30, 60);
fireblock.setFlammable(Blocks.LIGHT_BLUE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.YELLOW_WOOL, 30, 60);
fireblock.setFlammable(Blocks.LIME_WOOL, 30, 60);
fireblock.setFlammable(Blocks.PINK_WOOL, 30, 60);
fireblock.setFlammable(Blocks.GRAY_WOOL, 30, 60);
fireblock.setFlammable(Blocks.LIGHT_GRAY_WOOL, 30, 60);
fireblock.setFlammable(Blocks.CYAN_WOOL, 30, 60);
fireblock.setFlammable(Blocks.PURPLE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.GREEN_WOOL, 30, 60);
fireblock.setFlammable(Blocks.BROWN_WOOL, 30, 60);
fireblock.setFlammable(Blocks.BLUE_WOOL, 30, 60);
fireblock.setFlammable(Blocks.RED_WOOL, 30, 60);
fireblock.setFlammable(Blocks.BLACK_WOOL, 30, 60);
fireblock.setFlammable(Blocks.VINE, 15, 100);
fireblock.setFlammable(Blocks.COAL_BLOCK, 5, 5);
fireblock.setFlammable(Blocks.HAY_BLOCK, 60, 20);
fireblock.setFlammable(Blocks.TARGET, 15, 20);
fireblock.setFlammable(Blocks.WHITE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.ORANGE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.MAGENTA_CARPET, 60, 20);
fireblock.setFlammable(Blocks.LIGHT_BLUE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.YELLOW_CARPET, 60, 20);
fireblock.setFlammable(Blocks.LIME_CARPET, 60, 20);
fireblock.setFlammable(Blocks.PINK_CARPET, 60, 20);
fireblock.setFlammable(Blocks.GRAY_CARPET, 60, 20);
fireblock.setFlammable(Blocks.LIGHT_GRAY_CARPET, 60, 20);
fireblock.setFlammable(Blocks.CYAN_CARPET, 60, 20);
fireblock.setFlammable(Blocks.PURPLE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.BLUE_CARPET, 60, 20);
fireblock.setFlammable(Blocks.BROWN_CARPET, 60, 20);
fireblock.setFlammable(Blocks.GREEN_CARPET, 60, 20);
fireblock.setFlammable(Blocks.RED_CARPET, 60, 20);
fireblock.setFlammable(Blocks.BLACK_CARPET, 60, 20);
fireblock.setFlammable(Blocks.DRIED_KELP_BLOCK, 30, 60);
fireblock.setFlammable(Blocks.BAMBOO, 60, 60);
fireblock.setFlammable(Blocks.SCAFFOLDING, 60, 60);
fireblock.setFlammable(Blocks.LECTERN, 30, 20);
fireblock.setFlammable(Blocks.COMPOSTER, 5, 20);
fireblock.setFlammable(Blocks.SWEET_BERRY_BUSH, 60, 100);
fireblock.setFlammable(Blocks.BEEHIVE, 5, 20);
fireblock.setFlammable(Blocks.BEE_NEST, 30, 20);
fireblock.setFlammable(Blocks.AZALEA_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.FLOWERING_AZALEA_LEAVES, 30, 60);
fireblock.setFlammable(Blocks.CAVE_VINES, 15, 60);
fireblock.setFlammable(Blocks.CAVE_VINES_PLANT, 15, 60);
fireblock.setFlammable(Blocks.SPORE_BLOSSOM, 60, 100);
fireblock.setFlammable(Blocks.AZALEA, 30, 60);
fireblock.setFlammable(Blocks.FLOWERING_AZALEA, 30, 60);
fireblock.setFlammable(Blocks.BIG_DRIPLEAF, 60, 100);
fireblock.setFlammable(Blocks.BIG_DRIPLEAF_STEM, 60, 100);
fireblock.setFlammable(Blocks.SMALL_DRIPLEAF, 60, 100);
fireblock.setFlammable(Blocks.HANGING_ROOTS, 30, 60);
fireblock.setFlammable(Blocks.GLOW_LICHEN, 15, 100);
}
}

View File

@@ -0,0 +1,35 @@
package com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire;
import com.drmangotea.tfmg.CreateTFMG;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
public class TFMGColoredFires {
public static final DeferredRegister<Block> BLOCKS =
DeferredRegister.create(ForgeRegistries.BLOCKS, CreateTFMG.MOD_ID);
public static final RegistryObject<Block> GREEN_FIRE = BLOCKS.register("green_fire",
() -> new GreenFireBlock(BlockBehaviour.Properties.of(Material.FIRE)
.requiresCorrectToolForDrops()
.noOcclusion()
.lightLevel(s -> 15)
));
public static final RegistryObject<Block> BLUE_FIRE = BLOCKS.register("blue_fire",
() -> new BlueFireBlock(BlockBehaviour.Properties.of(Material.FIRE)
.requiresCorrectToolForDrops()
.noOcclusion()
.lightLevel(s -> 15)
));
public static void register (IEventBus eventBus){
BLOCKS.register(eventBus);
}
}

View File

@@ -0,0 +1,4 @@
package com.drmangotea.tfmg.registry;
public class TFMGBlockEntities {
}

View File

@@ -0,0 +1,15 @@
package com.drmangotea.tfmg.registry;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
import net.minecraft.world.level.block.Block;
public class TFMGBlockStateGen {
public static <T extends Block> NonNullBiConsumer<DataGenContext<Block, T>, RegistrateBlockstateProvider> nothingLol(
String path) {
return null;
}
}

View File

@@ -0,0 +1,112 @@
package com.drmangotea.tfmg.registry;
import com.drmangotea.tfmg.base.TFMGSpriteShifts;
import com.drmangotea.tfmg.content.gadgets.explosives.napalm.NapalmBombBlock;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.BlueFireBlock;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.GreenFireBlock;
import com.simibubi.create.AllCreativeModeTabs;
import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.Create;
import com.simibubi.create.content.decoration.encasing.CasingBlock;
import com.simibubi.create.content.decoration.encasing.EncasedCTBehaviour;
import com.simibubi.create.foundation.data.BuilderTransformers;
import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.common.Tags;
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
import static com.simibubi.create.foundation.data.BlockStateGen.simpleCubeAll;
import static com.simibubi.create.foundation.data.CreateRegistrate.casingConnectivity;
import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures;
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
import static com.simibubi.create.foundation.data.TagGen.tagBlockAndItem;
public class TFMGBlocks {
static {
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_BASE);
}
//-----------------------MISC---------------------------//
public static final BlockEntry<NapalmBombBlock> NAPALM_BOMB = REGISTRATE.block("napalm_bomb", NapalmBombBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.color(MaterialColor.TERRACOTTA_GREEN))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("napalm_bomb"))
.item()
.build()
.lang("Napalm Bomb")
.register();
public static final BlockEntry<CasingBlock> STEEL_CASING = REGISTRATE.block("steel_casing", CasingBlock::new)
.properties(p -> p.color(MaterialColor.TERRACOTTA_LIGHT_GRAY))
.transform(BuilderTransformers.casing(() -> TFMGSpriteShifts.STEEL_CASING))
.register();
public static final BlockEntry<CasingBlock> HEAVY_MACHINERY_CASING = REGISTRATE.block("heavy_machinery_casing", CasingBlock::new)
.properties(p -> p.color(MaterialColor.TERRACOTTA_LIGHT_GRAY))
.transform(BuilderTransformers.casing(() -> TFMGSpriteShifts.HEAVY_MACHINERY_CASING))
.properties(p -> p.sound(SoundType.COPPER))
.register();
//-----------------------MACHINES---------------------------//
//-----------------------BUILDING BLOCKS---------------------------//
public static final BlockEntry<Block> STEEL_BLOCK = REGISTRATE.block("steel_block", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.onRegister(connectedTextures(() -> new EncasedCTBehaviour(TFMGSpriteShifts.STEEL_BLOCK)))
.onRegister(casingConnectivity((block, cc) -> cc.makeCasing(block, TFMGSpriteShifts.STEEL_BLOCK)))
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("steel_block"))
.tag(BlockTags.NEEDS_IRON_TOOL)
.tag(Tags.Blocks.STORAGE_BLOCKS)
.tag(BlockTags.BEACON_BASE_BLOCKS)
.transform(tagBlockAndItem("storage_blocks/steel"))
.tag(Tags.Items.STORAGE_BLOCKS)
.build()
.lang("Block of Steel")
.register();
public static final BlockEntry<Block> CAST_IRON_BLOCK = REGISTRATE.block("cast_iron_block", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
.properties(p -> p.requiresCorrectToolForDrops())
.onRegister(connectedTextures(() -> new EncasedCTBehaviour(TFMGSpriteShifts.CAST_IRON_BLOCK)))
.onRegister(casingConnectivity((block, cc) -> cc.makeCasing(block, TFMGSpriteShifts.CAST_IRON_BLOCK)))
.transform(pickaxeOnly())
.blockstate(simpleCubeAll("cast_iron_block"))
.tag(BlockTags.NEEDS_IRON_TOOL)
.tag(Tags.Blocks.STORAGE_BLOCKS)
.tag(BlockTags.BEACON_BASE_BLOCKS)
.transform(tagBlockAndItem("storage_blocks/cast_iron"))
.tag(Tags.Items.STORAGE_BLOCKS)
.build()
.lang("Block of Cast Iron")
.register();
//-----------------------CONCRETE---------------------------//
static {
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_CONCRETE);
}
public static void register() {}
}

View File

@@ -0,0 +1,17 @@
package com.drmangotea.tfmg.registry;
import com.drmangotea.tfmg.base.creative_mode_tabs.BaseTFMGCreativeModeTab;
import com.drmangotea.tfmg.base.creative_mode_tabs.ConcreteCreativeModeTab;
import com.simibubi.create.content.decoration.palettes.PalettesCreativeModeTab;
import com.simibubi.create.infrastructure.item.BaseCreativeModeTab;
import net.minecraft.world.item.CreativeModeTab;
public class TFMGCreativeModeTabs {
public static final CreativeModeTab TFMG_BASE = new BaseTFMGCreativeModeTab();
public static final CreativeModeTab TFMG_CONCRETE = new ConcreteCreativeModeTab();
public static void init() {
}
}

View File

@@ -0,0 +1,70 @@
package com.drmangotea.tfmg.registry;
import com.drmangotea.tfmg.CreateTFMG;
import com.drmangotea.tfmg.base.spark.*;
import com.drmangotea.tfmg.content.gadgets.explosives.napalm.NapalmBombEntity;
import com.drmangotea.tfmg.content.gadgets.explosives.napalm.NapalmBombRenderer;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ThermiteGrenade;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ThermiteGrenadeRenderer;
import com.simibubi.create.foundation.data.CreateEntityBuilder;
import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.util.entry.EntityEntry;
import com.tterrag.registrate.util.nullness.NonNullConsumer;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
public class TFMGEntityTypes {
public static final EntityEntry<ThermiteGrenade> THERMITE_GRENADE =
register("thermite_grenade", ThermiteGrenade::new, () -> ThermiteGrenadeRenderer::regular,
MobCategory.MISC, 4, 20, true, true, ThermiteGrenade::build).register();
public static final EntityEntry<ThermiteGrenade> ZINC_GRENADE =
register("zin_grenade", ThermiteGrenade::new, () -> ThermiteGrenadeRenderer::green,
MobCategory.MISC, 4, 20, true, true, ThermiteGrenade::build).register();
public static final EntityEntry<ThermiteGrenade> COPPER_GRENADE =
register("copper_grenade", ThermiteGrenade::new, () -> ThermiteGrenadeRenderer::blue,
MobCategory.MISC, 4, 20, true, true, ThermiteGrenade::build).register();
public static final EntityEntry<NapalmBombEntity> NAPALM_BOMB =
register("napalm_bomb_entity", NapalmBombEntity::new, () -> NapalmBombRenderer::new,
MobCategory.MISC, 4, 20, true, true, NapalmBombEntity::build).register();
public static final EntityEntry<Spark> SPARK =
register("spark", Spark::new, () -> SparkRenderer::new,
MobCategory.MISC, 4, 20, true, true, Spark::build).register();
public static final EntityEntry<GreenSpark> GREEN_SPARK =
register("green_spark", GreenSpark::new, () -> GreenSparkRenderer::new,
MobCategory.MISC, 4, 20, true, true, GreenSpark::build).register();
public static final EntityEntry<BlueSpark> BLUE_SPARK =
register("blue_spark", BlueSpark::new, () -> BlueSparkRenderer::new,
MobCategory.MISC, 4, 20, true, true, BlueSpark::build).register();
//
private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, EntityType.EntityFactory<T> factory,
NonNullSupplier<NonNullFunction<EntityRendererProvider.Context, EntityRenderer<? super T>>> renderer,
MobCategory group, int range, int updateFrequency, boolean sendVelocity, boolean immuneToFire,
NonNullConsumer<EntityType.Builder<T>> propertyBuilder) {
String id = Lang.asId(name);
return (CreateEntityBuilder<T, ?>) CreateTFMG.REGISTRATE
.entity(id, factory, group)
.properties(b -> b.setTrackingRange(range)
.setUpdateInterval(updateFrequency)
.setShouldReceiveVelocityUpdates(sendVelocity))
.properties(propertyBuilder)
.properties(b -> {
if (immuneToFire)
b.fireImmune();
})
.renderer(renderer);
}
public static void register() {}
}

View File

@@ -0,0 +1,31 @@
package com.drmangotea.tfmg.registry;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ChemicalColor;
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ThermiteGrenadeItem;
import com.tterrag.registrate.util.entry.ItemEntry;
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
import static com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ChemicalColor.*;
public class TFMGItems {
static {
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_BASE);
}
public static final ItemEntry<ThermiteGrenadeItem>
THERMITE_GRENADE = thermiteGrenade("thermite_grenade",BASE);
public static final ItemEntry<ThermiteGrenadeItem>
ZINC_GRENADE = thermiteGrenade("zinc_grenade",GREEN);
public static final ItemEntry<ThermiteGrenadeItem>
COPPER_GRENADE = thermiteGrenade("copper_grenade",BLUE);
//////////////////////////
private static ItemEntry<ThermiteGrenadeItem> thermiteGrenade(String name, ChemicalColor color) {
return REGISTRATE.item(name, p -> new ThermiteGrenadeItem(p, color))
.register();
}
public static void register() {}
}

View File

@@ -0,0 +1,4 @@
package com.drmangotea.tfmg.registry;
public class TFMGParticles {
}

View File

@@ -0,0 +1,263 @@
package com.drmangotea.tfmg.registry;
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import com.drmangotea.tfmg.CreateTFMG;
import com.simibubi.create.foundation.data.BlockStateGen;
import com.simibubi.create.foundation.data.CreateBlockEntityBuilder;
import com.simibubi.create.foundation.data.CreateEntityBuilder;
import com.simibubi.create.foundation.data.VirtualFluidBuilder;
import org.jetbrains.annotations.Nullable;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.decoration.encasing.CasingConnectivity;
import com.simibubi.create.content.fluids.VirtualFluid;
import com.simibubi.create.foundation.block.connected.CTModel;
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import com.simibubi.create.foundation.item.TooltipModifier;
import com.simibubi.create.foundation.utility.RegisteredObjects;
import com.tterrag.registrate.AbstractRegistrate;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.BlockEntityBuilder.BlockEntityFactory;
import com.tterrag.registrate.builders.Builder;
import com.tterrag.registrate.builders.FluidBuilder;
import com.tterrag.registrate.util.entry.RegistryEntry;
import com.tterrag.registrate.util.nullness.NonNullConsumer;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fluids.FluidType;
import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.registries.RegistryObject;
public class TFMGRegistrate extends AbstractRegistrate<TFMGRegistrate> {
@Nullable
protected Function<Item, TooltipModifier> currentTooltipModifierFactory;
protected TFMGRegistrate(String modid) {
super(modid);
}
public static TFMGRegistrate create(String modid) {
return new TFMGRegistrate(modid);
}
public TFMGRegistrate setTooltipModifierFactory(@Nullable Function<Item, TooltipModifier> factory) {
currentTooltipModifierFactory = factory;
return self();
}
@Nullable
public Function<Item, TooltipModifier> getTooltipModifierFactory() {
return currentTooltipModifierFactory;
}
@Override
public TFMGRegistrate registerEventListeners(IEventBus bus) {
return super.registerEventListeners(bus);
}
@Override
protected <R, T extends R> RegistryEntry<T> accept(String name, ResourceKey<? extends Registry<R>> type,
Builder<R, T, ?, ?> builder, NonNullSupplier<? extends T> creator,
NonNullFunction<RegistryObject<T>, ? extends RegistryEntry<T>> entryFactory) {
RegistryEntry<T> entry = super.accept(name, type, builder, creator, entryFactory);
if (type.equals(Registry.ITEM_REGISTRY)) {
if (currentTooltipModifierFactory != null) {
TooltipModifier.REGISTRY.registerDeferred(entry.getId(), currentTooltipModifierFactory);
}
}
return entry;
}
@Override
public <T extends BlockEntity> CreateBlockEntityBuilder<T, TFMGRegistrate> blockEntity(String name,
BlockEntityFactory<T> factory) {
return blockEntity(self(), name, factory);
}
@Override
public <T extends BlockEntity, P> CreateBlockEntityBuilder<T, P> blockEntity(P parent, String name,
BlockEntityFactory<T> factory) {
return (CreateBlockEntityBuilder<T, P>) entry(name,
(callback) -> CreateBlockEntityBuilder.create(this, parent, name, callback, factory));
}
@Override
public <T extends Entity> CreateEntityBuilder<T, TFMGRegistrate> entity(String name,
EntityType.EntityFactory<T> factory, MobCategory classification) {
return this.entity(self(), name, factory, classification);
}
@Override
public <T extends Entity, P> CreateEntityBuilder<T, P> entity(P parent, String name,
EntityType.EntityFactory<T> factory, MobCategory classification) {
return (CreateEntityBuilder<T, P>) this.entry(name, (callback) -> {
return CreateEntityBuilder.create(this, parent, name, callback, factory, classification);
});
}
/* Palettes */
public <T extends Block> BlockBuilder<T, TFMGRegistrate> paletteStoneBlock(String name,
NonNullFunction<Properties, T> factory, NonNullSupplier<Block> propertiesFrom, boolean worldGenStone,
boolean hasNaturalVariants) {
BlockBuilder<T, TFMGRegistrate> builder = super.block(name, factory).initialProperties(propertiesFrom)
.transform(pickaxeOnly())
.blockstate(hasNaturalVariants ? BlockStateGen.naturalStoneTypeBlock(name) : (c, p) -> {
final String location = "block/palettes/stone_types/" + c.getName();
p.simpleBlock(c.get(), p.models()
.cubeAll(c.getName(), p.modLoc(location)));
})
.tag(BlockTags.DRIPSTONE_REPLACEABLE)
.tag(BlockTags.AZALEA_ROOT_REPLACEABLE)
.tag(BlockTags.MOSS_REPLACEABLE)
.tag(BlockTags.LUSH_GROUND_REPLACEABLE)
.item()
.model((c, p) -> p.cubeAll(c.getName(),
p.modLoc(hasNaturalVariants ? "block/palettes/stone_types/natural/" + name + "_1"
: "block/palettes/stone_types/" + c.getName())))
.build();
return builder;
}
public BlockBuilder<Block, TFMGRegistrate> paletteStoneBlock(String name, NonNullSupplier<Block> propertiesFrom,
boolean worldGenStone, boolean hasNaturalVariants) {
return paletteStoneBlock(name, Block::new, propertiesFrom, worldGenStone, hasNaturalVariants);
}
/* Fluids */
public <T extends ForgeFlowingFluid> FluidBuilder<T, TFMGRegistrate> virtualFluid(String name,
FluidBuilder.FluidTypeFactory typeFactory, NonNullFunction<ForgeFlowingFluid.Properties, T> factory) {
return entry(name,
c -> new VirtualFluidBuilder<>(self(), self(), name, c, CreateTFMG.asResource("fluid/" + name + "_still"),
CreateTFMG.asResource("fluid/" + name + "_flow"), typeFactory, factory));
}
public <T extends ForgeFlowingFluid> FluidBuilder<T, TFMGRegistrate> virtualFluid(String name,
ResourceLocation still, ResourceLocation flow, FluidBuilder.FluidTypeFactory typeFactory,
NonNullFunction<ForgeFlowingFluid.Properties, T> factory) {
return entry(name, c -> new VirtualFluidBuilder<>(self(), self(), name, c, still, flow, typeFactory, factory));
}
public FluidBuilder<VirtualFluid, TFMGRegistrate> virtualFluid(String name) {
return entry(name,
c -> new VirtualFluidBuilder<VirtualFluid, TFMGRegistrate>(self(), self(), name, c,
CreateTFMG.asResource("fluid/" + name + "_still"), CreateTFMG.asResource("fluid/" + name + "_flow"),
TFMGRegistrate::defaultFluidType, VirtualFluid::new));
}
public FluidBuilder<VirtualFluid, TFMGRegistrate> virtualFluid(String name, ResourceLocation still,
ResourceLocation flow) {
return entry(name, c -> new VirtualFluidBuilder<>(self(), self(), name, c, still, flow,
TFMGRegistrate::defaultFluidType, VirtualFluid::new));
}
public FluidBuilder<ForgeFlowingFluid.Flowing, TFMGRegistrate> standardFluid(String name) {
return fluid(name, CreateTFMG.asResource("fluid/" + name + "_still"), CreateTFMG.asResource("fluid/" + name + "_flow"));
}
public FluidBuilder<ForgeFlowingFluid.Flowing, TFMGRegistrate> standardFluid(String name,
FluidBuilder.FluidTypeFactory typeFactory) {
return fluid(name, CreateTFMG.asResource("fluid/" + name + "_still"), CreateTFMG.asResource("fluid/" + name + "_flow"),
typeFactory);
}
public static FluidType defaultFluidType(FluidType.Properties properties, ResourceLocation stillTexture,
ResourceLocation flowingTexture) {
return new FluidType(properties) {
@Override
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
consumer.accept(new IClientFluidTypeExtensions() {
@Override
public ResourceLocation getStillTexture() {
return stillTexture;
}
@Override
public ResourceLocation getFlowingTexture() {
return flowingTexture;
}
});
}
};
}
/* Util */
public static <T extends Block> NonNullConsumer<? super T> casingConnectivity(
BiConsumer<T, CasingConnectivity> consumer) {
return entry -> onClient(() -> () -> registerCasingConnectivity(entry, consumer));
}
public static <T extends Block> NonNullConsumer<? super T> blockModel(
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
return entry -> onClient(() -> () -> registerBlockModel(entry, func));
}
public static <T extends Item> NonNullConsumer<? super T> itemModel(
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
return entry -> onClient(() -> () -> registerItemModel(entry, func));
}
public static <T extends Block> NonNullConsumer<? super T> connectedTextures(
Supplier<ConnectedTextureBehaviour> behavior) {
return entry -> onClient(() -> () -> registerCTBehviour(entry, behavior));
}
protected static void onClient(Supplier<Runnable> toRun) {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, toRun);
}
@OnlyIn(Dist.CLIENT)
private static <T extends Block> void registerCasingConnectivity(T entry,
BiConsumer<T, CasingConnectivity> consumer) {
consumer.accept(entry, CreateClient.CASING_CONNECTIVITY);
}
@OnlyIn(Dist.CLIENT)
private static void registerBlockModel(Block entry,
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
.register(RegisteredObjects.getKeyOrThrow(entry), func.get());
}
@OnlyIn(Dist.CLIENT)
private static void registerItemModel(Item entry,
Supplier<NonNullFunction<BakedModel, ? extends BakedModel>> func) {
CreateClient.MODEL_SWAPPER.getCustomItemModels()
.register(RegisteredObjects.getKeyOrThrow(entry), func.get());
}
@OnlyIn(Dist.CLIENT)
private static void registerCTBehviour(Block entry, Supplier<ConnectedTextureBehaviour> behaviorSupplier) {
ConnectedTextureBehaviour behavior = behaviorSupplier.get();
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
.register(RegisteredObjects.getKeyOrThrow(entry), model -> new CTModel(model, behavior));
}
}

View File

@@ -0,0 +1,4 @@
package com.drmangotea.tfmg.registry;
public class TFMGSounds {
}

View File

@@ -0,0 +1,172 @@
{
"multipart": [
{
"apply": [
{
"model": "tfmg:block/blue_fire_floor0"
},
{
"model": "tfmg:block/blue_fire_floor1"
}
],
"when": {
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
},
{
"apply": [
{
"model": "tfmg:block/blue_fire_side0"
},
{
"model": "tfmg:block/blue_fire_side1"
},
{
"model": "tfmg:block/blue_fire_side_alt0"
},
{
"model": "tfmg:block/blue_fire_side_alt1"
}
],
"when": {
"OR": [
{
"north": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/blue_fire_side0",
"y": 90
},
{
"model": "tfmg:block/blue_fire_side1",
"y": 90
},
{
"model": "tfmg:block/blue_fire_side_alt0",
"y": 90
},
{
"model": "tfmg:block/blue_fire_side_alt1",
"y": 90
}
],
"when": {
"OR": [
{
"east": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/blue_fire_side0",
"y": 180
},
{
"model": "tfmg:block/blue_fire_side1",
"y": 180
},
{
"model": "tfmg:block/blue_fire_side_alt0",
"y": 180
},
{
"model": "tfmg:block/blue_fire_side_alt1",
"y": 180
}
],
"when": {
"OR": [
{
"south": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/blue_fire_side0",
"y": 270
},
{
"model": "tfmg:block/blue_fire_side1",
"y": 270
},
{
"model": "tfmg:block/blue_fire_side_alt0",
"y": 270
},
{
"model": "tfmg:block/blue_fire_side_alt1",
"y": 270
}
],
"when": {
"OR": [
{
"west": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/blue_fire_up0"
},
{
"model": "tfmg:block/blue_fire_up1"
},
{
"model": "tfmg:block/blue_fire_up_alt0"
},
{
"model": "tfmg:block/blue_fire_up_alt1"
}
],
"when": {
"up": "true"
}
}
]
}

View File

@@ -0,0 +1,172 @@
{
"multipart": [
{
"apply": [
{
"model": "tfmg:block/green_fire_floor0"
},
{
"model": "tfmg:block/green_fire_floor1"
}
],
"when": {
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
},
{
"apply": [
{
"model": "tfmg:block/green_fire_side0"
},
{
"model": "tfmg:block/green_fire_side1"
},
{
"model": "tfmg:block/green_fire_side_alt0"
},
{
"model": "tfmg:block/green_fire_side_alt1"
}
],
"when": {
"OR": [
{
"north": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/green_fire_side0",
"y": 90
},
{
"model": "tfmg:block/green_fire_side1",
"y": 90
},
{
"model": "tfmg:block/green_fire_side_alt0",
"y": 90
},
{
"model": "tfmg:block/green_fire_side_alt1",
"y": 90
}
],
"when": {
"OR": [
{
"east": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/green_fire_side0",
"y": 180
},
{
"model": "tfmg:block/green_fire_side1",
"y": 180
},
{
"model": "tfmg:block/green_fire_side_alt0",
"y": 180
},
{
"model": "tfmg:block/green_fire_side_alt1",
"y": 180
}
],
"when": {
"OR": [
{
"south": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/green_fire_side0",
"y": 270
},
{
"model": "tfmg:block/green_fire_side1",
"y": 270
},
{
"model": "tfmg:block/green_fire_side_alt0",
"y": 270
},
{
"model": "tfmg:block/green_fire_side_alt1",
"y": 270
}
],
"when": {
"OR": [
{
"west": "true"
},
{
"east": "false",
"north": "false",
"south": "false",
"up": "false",
"west": "false"
}
]
}
},
{
"apply": [
{
"model": "tfmg:block/green_fire_up0"
},
{
"model": "tfmg:block/green_fire_up1"
},
{
"model": "tfmg:block/green_fire_up_alt0"
},
{
"model": "tfmg:block/green_fire_up_alt1"
}
],
"when": {
"up": "true"
}
}
]
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_floor",
"textures": {
"fire": "tfmg:block/blue_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_floor",
"textures": {
"fire": "tfmg:block/blue_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side",
"textures": {
"fire": "tfmg:block/blue_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side",
"textures": {
"fire": "tfmg:block/blue_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side_alt",
"textures": {
"fire": "tfmg:block/blue_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side_alt",
"textures": {
"fire": "tfmg:block/blue_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up",
"textures": {
"fire": "tfmg:block/blue_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up",
"textures": {
"fire": "tfmg:block/blue_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up_alt",
"textures": {
"fire": "tfmg:block/blue_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up_alt",
"textures": {
"fire": "tfmg:block/blue_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_floor",
"textures": {
"fire": "tfmg:block/green_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_floor",
"textures": {
"fire": "tfmg:block/green_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side",
"textures": {
"fire": "tfmg:block/green_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side",
"textures": {
"fire": "tfmg:block/green_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side_alt",
"textures": {
"fire": "tfmg:block/green_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_side_alt",
"textures": {
"fire": "tfmg:block/green_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up",
"textures": {
"fire": "tfmg:block/green_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up",
"textures": {
"fire": "tfmg:block/green_fire_1"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up_alt",
"textures": {
"fire": "tfmg:block/green_fire_0"
}
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fire_up_alt",
"textures": {
"fire": "tfmg:block/green_fire_1"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Some files were not shown because too many files have changed in this diff Show More