beginning of gamerules, config works, translations
This commit is contained in:
parent
c735b06779
commit
579a9f0f45
|
@ -3,7 +3,7 @@ package me.parsell.wireddust;
|
||||||
import me.shedaniel.autoconfig.ConfigData;
|
import me.shedaniel.autoconfig.ConfigData;
|
||||||
import me.shedaniel.autoconfig.annotation.Config;
|
import me.shedaniel.autoconfig.annotation.Config;
|
||||||
|
|
||||||
@Config(name = "GlowstoneWire")
|
@Config(name = "WiredDust")
|
||||||
public class WiredDustConfig implements ConfigData{
|
public class WiredDustConfig implements ConfigData{
|
||||||
public boolean useVanillaItems = true;
|
public boolean useVanillaItems = true;
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ public class WiredDustConfig implements ConfigData{
|
||||||
public boolean addGlowstoneWire = true;
|
public boolean addGlowstoneWire = true;
|
||||||
|
|
||||||
public boolean addBlazePowderWire = true;
|
public boolean addBlazePowderWire = true;
|
||||||
public boolean doBlazePowderDamage = true;
|
//public boolean doBlazePowderDamage = true; // GR
|
||||||
|
|
||||||
public boolean addGunpowderWire = true;
|
public boolean addGunpowderWire = true;
|
||||||
public boolean gunpowderWireIgnitesExtremelyFlammableBlocks = true;
|
public boolean gunpowderWireIgnitesExtremelyFlammableBlocks = true; //GR: Campfire, leaves
|
||||||
public boolean gunpowderWireIgnitesFlammableBlocks = false;
|
public boolean gunpowderWireIgnitesFlammableBlocks = false; //GR: wool, hay
|
||||||
public boolean gunpowderWireIgnitesTNT = true;
|
//public boolean gunpowderWireIgnitesTNT = true; //GR: tnt duh
|
||||||
|
|
||||||
//TODO Consider gamerules for additional functionality instead of mod config
|
//TODO Consider gamerules for additional functionality instead of mod config
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package me.parsell.wireddust.common;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import me.parsell.wireddust.core.WiredDustGamerules;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -22,8 +23,9 @@ public class WDBlazePowderWireBlock extends WDWireBlock{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
|
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
|
||||||
if (!entity.isFireImmune() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entity))
|
if(world.getGameRules().getBoolean(WiredDustGamerules.DO_BLAZE_POWDER_WIRE_DAMAGE))
|
||||||
entity.damage(DamageSource.HOT_FLOOR, 1.0F);
|
if (!entity.isFireImmune() && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entity))
|
||||||
|
entity.damage(DamageSource.HOT_FLOOR, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package me.parsell.wireddust.common;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import me.parsell.wireddust.core.WiredDustGamerules;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -28,7 +29,8 @@ import net.minecraft.util.math.Direction.Axis;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
|
|
||||||
// TODO: All the magic to make this work the way i want
|
// TODO: All the magic to make this work the way i
|
||||||
|
// TODO: make textures differ for lit state, and burnt state
|
||||||
public class WDGunpowderWireBlock extends WDWireBlock{
|
public class WDGunpowderWireBlock extends WDWireBlock{
|
||||||
public static final BooleanProperty LIT;
|
public static final BooleanProperty LIT;
|
||||||
public static final BooleanProperty BURNT;
|
public static final BooleanProperty BURNT;
|
||||||
|
@ -126,7 +128,7 @@ public class WDGunpowderWireBlock extends WDWireBlock{
|
||||||
if(state.get(super.DIRECTION_TO_WIRE_CONNECTION.get(dir)).isConnected())
|
if(state.get(super.DIRECTION_TO_WIRE_CONNECTION.get(dir)).isConnected())
|
||||||
if(offsetBlockState.isOf(this))
|
if(offsetBlockState.isOf(this))
|
||||||
light(world, offsetPos, offsetBlockState);
|
light(world, offsetPos, offsetBlockState);
|
||||||
else if(offsetBlockState.isOf(Blocks.TNT)) {
|
else if(offsetBlockState.isOf(Blocks.TNT) && world.getGameRules().getBoolean(WiredDustGamerules.GUNPOWDER_WIRE_IGNITES_TNT)) {
|
||||||
TntBlock.primeTnt(world, offsetPos);
|
TntBlock.primeTnt(world, offsetPos);
|
||||||
world.setBlockState(offsetPos, Blocks.AIR.getDefaultState());
|
world.setBlockState(offsetPos, Blocks.AIR.getDefaultState());
|
||||||
} else if(offsetBlockState.isOf(Blocks.CAMPFIRE) && !offsetBlockState.get(CampfireBlock.LIT))
|
} else if(offsetBlockState.isOf(Blocks.CAMPFIRE) && !offsetBlockState.get(CampfireBlock.LIT))
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class WDWireBlock extends Block{
|
||||||
else if (!NORTH && !SOUTH && WEST && !state.get(WIRE_CONNECTION_EAST).isBroken())
|
else if (!NORTH && !SOUTH && WEST && !state.get(WIRE_CONNECTION_EAST).isBroken())
|
||||||
state = state.with(WIRE_CONNECTION_EAST, WDWireConnection.SIDE);
|
state = state.with(WIRE_CONNECTION_EAST, WDWireConnection.SIDE);
|
||||||
|
|
||||||
//TODO: FIX THIS.
|
//TODO: FIX n&s issue
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package me.parsell.wireddust.core;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
|
||||||
|
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
|
||||||
|
import net.minecraft.world.GameRules;
|
||||||
|
import net.minecraft.world.GameRules.Category;
|
||||||
|
|
||||||
|
public class WiredDustGamerules {
|
||||||
|
public static final GameRules.Key<GameRules.BooleanRule> DO_BLAZE_POWDER_WIRE_DAMAGE;
|
||||||
|
public static final GameRules.Key<GameRules.BooleanRule> GUNPOWDER_WIRE_IGNITES_TNT;
|
||||||
|
|
||||||
|
public void init(){
|
||||||
|
// placeabo, just ensures that static gets ran here
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
DO_BLAZE_POWDER_WIRE_DAMAGE = GameRuleRegistry.register("doBlazePowderWireDamage", Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||||
|
GUNPOWDER_WIRE_IGNITES_TNT = GameRuleRegistry.register("gunpowderWireIgnitesTNT", Category.MISC, GameRuleFactory.createBooleanRule(true));
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package me.parsell.wireddust.core;
|
||||||
|
|
||||||
import com.mojang.serialization.Lifecycle;
|
import com.mojang.serialization.Lifecycle;
|
||||||
|
|
||||||
|
import me.parsell.wireddust.WiredDust;
|
||||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
|
@ -11,12 +12,16 @@ import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
|
||||||
public class WiredDustItems {
|
public class WiredDustItems {
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Registry.ITEM.set(Registry.ITEM.getRawId(Items.GLOWSTONE_DUST), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("glowstone_dust")), new BlockItem(WiredDustBlocks.GLOWSTONE_WIRE, new FabricItemSettings().group(ItemGroup.MATERIALS)), Lifecycle.stable());
|
if(WiredDust.CONFIG.useVanillaItems) {
|
||||||
Registry.ITEM.set(Registry.ITEM.getRawId(Items.BLAZE_POWDER), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("blaze_powder")), new BlockItem(WiredDustBlocks.BLAZE_POWDER_WIRE, new FabricItemSettings().group(ItemGroup.BREWING)), Lifecycle.stable());
|
if(WiredDust.CONFIG.addGlowstoneWire)
|
||||||
Registry.ITEM.set(Registry.ITEM.getRawId(Items.GUNPOWDER), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("gunpowder")), new BlockItem(WiredDustBlocks.GUNPOWDER_WIRE, new FabricItemSettings().group(ItemGroup.MATERIALS)), Lifecycle.stable());
|
Registry.ITEM.set(Registry.ITEM.getRawId(Items.GLOWSTONE_DUST), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("glowstone_dust")), new BlockItem(WiredDustBlocks.GLOWSTONE_WIRE, new FabricItemSettings().group(ItemGroup.MATERIALS)), Lifecycle.stable());
|
||||||
Registry.ITEM.set(Registry.ITEM.getRawId(Items.SUGAR), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("sugar")), new BlockItem(WiredDustBlocks.SUGAR_WIRE, new FabricItemSettings().group(ItemGroup.MATERIALS)), Lifecycle.stable());
|
if(WiredDust.CONFIG.addBlazePowderWire)
|
||||||
|
Registry.ITEM.set(Registry.ITEM.getRawId(Items.BLAZE_POWDER), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("blaze_powder")), new BlockItem(WiredDustBlocks.BLAZE_POWDER_WIRE, new FabricItemSettings().group(ItemGroup.BREWING)), Lifecycle.stable());
|
||||||
|
if(WiredDust.CONFIG.addGunpowderWire)
|
||||||
|
Registry.ITEM.set(Registry.ITEM.getRawId(Items.GUNPOWDER), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("gunpowder")), new BlockItem(WiredDustBlocks.GUNPOWDER_WIRE, new FabricItemSettings().group(ItemGroup.MATERIALS)), Lifecycle.stable());
|
||||||
|
if(WiredDust.CONFIG.addSugarWire)
|
||||||
|
Registry.ITEM.set(Registry.ITEM.getRawId(Items.SUGAR), RegistryKey.of(Registry.ITEM.getKey(), new Identifier("sugar")), new BlockItem(WiredDustBlocks.SUGAR_WIRE, new FabricItemSettings().group(ItemGroup.MATERIALS)), Lifecycle.stable());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"itemGroup.wireddust.general": "Wired Dust",
|
"itemGroup.wireddust.general": "Wired Dust",
|
||||||
"block.wireddust.glowstone_wire": "Glowstone Wire",
|
"block.wireddust.glowstone_wire": "Glowstone",
|
||||||
"block.wireddust.sugar_wire": "Sugar Wire",
|
"block.wireddust.sugar_wire": "Sugar",
|
||||||
"block.wireddust.blaze_powder_wire": "Blaze Powder Wire",
|
"block.wireddust.blaze_powder_wire": "Blaze Powder",
|
||||||
"block.wireddust.gunpowder_wire": "Gunpowder Wire"
|
"block.wireddust.gunpowder_wire": "Gunpowder"
|
||||||
}
|
}
|
Loading…
Reference in New Issue