WIP 1.20.1 port
1.0.3 update 2 new squirrel anims
This commit is contained in:
1 parent
fcc8dbb227
commit
a1ca3138dd
4541 files changed
+7104
-719
No files matched your search
+42
-36
@@ -1,40 +1,12 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "java-library"
|
||||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
id "maven-publish"
|
||||||
// id "com.modrinth.minotaur" version "2.+"
|
|
||||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
|
||||||
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
minecraft = rootProject.minecraft_version
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: "dev.architectury.loom"
|
|
||||||
// apply plugin: "com.modrinth.minotaur"
|
|
||||||
apply plugin: "me.modmuss50.mod-publish-plugin"
|
|
||||||
apply plugin: "com.matthewprenger.cursegradle"
|
|
||||||
|
|
||||||
version = "${rootProject.mod_version}+${rootProject.minecraft_version}-${name}"
|
|
||||||
|
|
||||||
loom {
|
|
||||||
silentMojangMappingsLicense()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
|
||||||
mappings loom.officialMojangMappings()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: "java"
|
apply plugin: "java-library"
|
||||||
apply plugin: "architectury-plugin"
|
|
||||||
apply plugin: "maven-publish"
|
apply plugin: "maven-publish"
|
||||||
|
|
||||||
archivesBaseName = rootProject.modid
|
|
||||||
version = "${rootProject.mod_version}+${rootProject.minecraft_version}-${name}"
|
|
||||||
group = rootProject.maven_group
|
group = rootProject.maven_group
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -60,7 +32,6 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
maven { url "https://nexus.resourcefulbees.com/repository/telepathicgrunt/" }
|
maven { url "https://nexus.resourcefulbees.com/repository/telepathicgrunt/" }
|
||||||
maven { url "https://maven.architectury.dev/" }
|
|
||||||
maven { url "https://maven.shedaniel.me" }
|
maven { url "https://maven.shedaniel.me" }
|
||||||
maven { url "https://jitpack.io" }
|
maven { url "https://jitpack.io" }
|
||||||
maven { url "https://www.cursemaven.com" }
|
maven { url "https://www.cursemaven.com" }
|
||||||
@@ -70,13 +41,48 @@ allprojects {
|
|||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
options.release = 21
|
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
toolchain {
|
}
|
||||||
languageVersion = JavaLanguageVersion.of(21)
|
}
|
||||||
}
|
|
||||||
|
// Don't build the root project itself.
|
||||||
|
tasks.named('jar') {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delegate forge-1.20.1 tasks to its own Gradle 8.8 wrapper. ForgeGradle 6 can't run
|
||||||
|
// on Gradle 9 and includeBuild can't mix Gradle versions, so we shell out instead.
|
||||||
|
def forge1201Dir = file('forge-1.20.1')
|
||||||
|
def forge1201Wrapper = providers.systemProperty('os.name').get().toLowerCase().contains('win')
|
||||||
|
? new File(forge1201Dir, 'gradlew.bat')
|
||||||
|
: new File(forge1201Dir, 'gradlew')
|
||||||
|
|
||||||
|
['build', 'assemble', 'clean', 'runClient', 'runServer'].each { name ->
|
||||||
|
tasks.register("forge1201${name.capitalize()}", Exec) {
|
||||||
|
group = 'forge-1.20.1'
|
||||||
|
description = "Runs ':${name}' inside the forge-1.20.1 build"
|
||||||
|
workingDir = forge1201Dir
|
||||||
|
commandLine forge1201Wrapper.absolutePath, name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delegate fabric-1.20.1 tasks to its own standalone Gradle wrapper. Fabric Loom's
|
||||||
|
// build-wide tinyRemapperService isn't classloader-safe across two loom projects
|
||||||
|
// targeting different Minecraft versions in the same Gradle invocation, so
|
||||||
|
// fabric-1.20.1 can't be a normal included subproject alongside fabric-1.21.1.
|
||||||
|
def fabric120Dir = file('fabric-1.20.1')
|
||||||
|
def fabric120Wrapper = providers.systemProperty('os.name').get().toLowerCase().contains('win')
|
||||||
|
? new File(fabric120Dir, 'gradlew.bat')
|
||||||
|
: new File(fabric120Dir, 'gradlew')
|
||||||
|
|
||||||
|
['build', 'assemble', 'clean', 'runClient', 'runServer'].each { name ->
|
||||||
|
tasks.register("fabric120${name.capitalize()}", Exec) {
|
||||||
|
group = 'fabric-1.20.1'
|
||||||
|
description = "Runs ':${name}' inside the fabric-1.20.1 build"
|
||||||
|
workingDir = fabric120Dir
|
||||||
|
commandLine fabric120Wrapper.absolutePath, name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+121
@@ -0,0 +1,121 @@
|
|||||||
|
package com.craisinlord.antarchy.content.dispenser;
|
||||||
|
|
||||||
|
import com.craisinlord.antarchy.content.block.AbstractAntimetalRailBlock;
|
||||||
|
import com.craisinlord.antarchy.content.minecart.AntimetalRailHelper;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.BlockSource;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
|
||||||
|
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.MinecartItem;
|
||||||
|
import net.minecraft.world.level.block.BaseRailBlock;
|
||||||
|
import net.minecraft.world.level.block.DispenserBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.block.state.properties.RailShape;
|
||||||
|
|
||||||
|
public final class AntimetalMinecartDispenseBehavior extends DefaultDispenseItemBehavior {
|
||||||
|
private final DefaultDispenseItemBehavior fallback = new DefaultDispenseItemBehavior();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack execute(BlockSource source, ItemStack stack) {
|
||||||
|
if (!(stack.getItem() instanceof MinecartItem)) {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
Direction direction = source.getBlockState().getValue(DispenserBlock.FACING);
|
||||||
|
BlockPos frontPos = source.getPos().relative(direction);
|
||||||
|
BlockState frontState = source.getLevel().getBlockState(frontPos);
|
||||||
|
|
||||||
|
if (frontState.getBlock() instanceof AbstractAntimetalRailBlock) {
|
||||||
|
return this.spawnOnAntimetalRail(source, stack, frontPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frontState.isAir()) {
|
||||||
|
BlockPos hangingRailPos = frontPos.above();
|
||||||
|
BlockState hangingRailState = source.getLevel().getBlockState(hangingRailPos);
|
||||||
|
if (hangingRailState.getBlock() instanceof AbstractAntimetalRailBlock) {
|
||||||
|
return this.spawnOnAntimetalRail(source, stack, hangingRailPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.dispenseVanillaMinecart(source, stack, direction, frontPos, frontState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack spawnOnAntimetalRail(BlockSource source, ItemStack stack, BlockPos railPos) {
|
||||||
|
AbstractMinecart.Type minecartType = minecartType(stack.getItem());
|
||||||
|
if (minecartType == null) {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
double x = railPos.getX() + 0.5D;
|
||||||
|
double y = AntimetalRailHelper.attachY(railPos.getY(), 0);
|
||||||
|
double z = railPos.getZ() + 0.5D;
|
||||||
|
AbstractMinecart minecart = AbstractMinecart.createMinecart(source.getLevel(), x, y, z, minecartType);
|
||||||
|
if (minecart == null) {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
if (stack.hasCustomHoverName()) {
|
||||||
|
minecart.setCustomName(stack.getHoverName());
|
||||||
|
}
|
||||||
|
|
||||||
|
source.getLevel().addFreshEntity(minecart);
|
||||||
|
stack.shrink(1);
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack dispenseVanillaMinecart(BlockSource source, ItemStack stack, Direction direction, BlockPos frontPos, BlockState frontState) {
|
||||||
|
double x = source.x() + direction.getStepX() * 1.125D;
|
||||||
|
double y = Math.floor(source.y()) + direction.getStepY();
|
||||||
|
double z = source.z() + direction.getStepZ() * 1.125D;
|
||||||
|
double yOffset;
|
||||||
|
|
||||||
|
if (frontState.getBlock() instanceof BaseRailBlock) {
|
||||||
|
yOffset = railShape(frontState).isAscending() ? 0.6D : 0.1D;
|
||||||
|
} else if (frontState.isAir()) {
|
||||||
|
BlockState belowFrontState = source.getLevel().getBlockState(frontPos.below());
|
||||||
|
if (!(belowFrontState.getBlock() instanceof BaseRailBlock)) {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
yOffset = direction != Direction.DOWN && railShape(belowFrontState).isAscending() ? -0.4D : -0.9D;
|
||||||
|
} else {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractMinecart.Type minecartType = minecartType(stack.getItem());
|
||||||
|
if (minecartType == null) {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractMinecart minecart = AbstractMinecart.createMinecart(source.getLevel(), x, y + yOffset, z, minecartType);
|
||||||
|
if (minecart == null) {
|
||||||
|
return this.fallback.dispense(source, stack);
|
||||||
|
}
|
||||||
|
if (stack.hasCustomHoverName()) {
|
||||||
|
minecart.setCustomName(stack.getHoverName());
|
||||||
|
}
|
||||||
|
|
||||||
|
source.getLevel().addFreshEntity(minecart);
|
||||||
|
stack.shrink(1);
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RailShape railShape(BlockState state) {
|
||||||
|
if (state.getBlock() instanceof BaseRailBlock railBlock) {
|
||||||
|
return state.getValue(railBlock.getShapeProperty());
|
||||||
|
}
|
||||||
|
return RailShape.NORTH_SOUTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AbstractMinecart.Type minecartType(Item item) {
|
||||||
|
if (item == Items.MINECART) return AbstractMinecart.Type.RIDEABLE;
|
||||||
|
if (item == Items.CHEST_MINECART) return AbstractMinecart.Type.CHEST;
|
||||||
|
if (item == Items.FURNACE_MINECART) return AbstractMinecart.Type.FURNACE;
|
||||||
|
if (item == Items.TNT_MINECART) return AbstractMinecart.Type.TNT;
|
||||||
|
if (item == Items.HOPPER_MINECART) return AbstractMinecart.Type.HOPPER;
|
||||||
|
if (item == Items.COMMAND_BLOCK_MINECART) return AbstractMinecart.Type.COMMAND_BLOCK;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.craisinlord.antarchy.mixins;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.FireBlock;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(FireBlock.class)
|
||||||
|
public interface AccessorFireBlock {
|
||||||
|
@Accessor("igniteOdds")
|
||||||
|
Object2IntMap<Block> antarchy$getIgniteOdds();
|
||||||
|
|
||||||
|
@Accessor("burnOdds")
|
||||||
|
Object2IntMap<Block> antarchy$getBurnOdds();
|
||||||
|
}
|
||||||
+1757
-35
File diff suppressed because it is too large.
Load diff
+19
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"feature": "antarchy:termite_nest",
|
||||||
|
"placement": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:rarity_filter",
|
||||||
|
"chance": 44
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:in_square"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:heightmap",
|
||||||
|
"heightmap": "WORLD_SURFACE_WG"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:biome"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = "${mod_id}-common-1.21.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Source-only module — each loader module compiles these sources itself.
|
||||||
|
tasks.named('compileJava').configure {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('jar').configure {
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
from sourceSets.main.allJava
|
||||||
|
from sourceSets.main.resources
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly("curse.maven:intapi-${intapi_curseforge_id}:${intapi_curseforge_file_id_neoforge}")
|
||||||
|
compileOnly(files("$rootDir/infinite_dimensions_jars/infinity-2.7.2+1.21.1-neoforge.jar"))
|
||||||
|
compileOnly(files("$rootDir/infinite_dimensions_jars/gravity-api-1.0.7-1.20.1.jar"))
|
||||||
|
compileOnly(files("$rootDir/infinite_dimensions_jars/sable-neoforge-1.21.1-2.0.3.jar"))
|
||||||
|
compileOnly(files("$rootDir/sizeable_foliage_jars/sizeable_foliage-neoforge-1.21.1-1.0.0.jar"))
|
||||||
|
compileOnly("software.bernie.geckolib:geckolib-neoforge-1.21.1:${geckolib_version}")
|
||||||
|
compileOnly("mezz.jei:jei-1.21.1-common-api:${jei_version}")
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+6
-1
@@ -32,7 +32,7 @@ import net.minecraft.util.RandomSource;
|
|||||||
import net.minecraft.world.ticks.TickPriority;
|
import net.minecraft.world.ticks.TickPriority;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
public class BluestoneComparatorBlock extends ComparatorBlock {
|
public class BluestoneComparatorBlock extends ComparatorBlock implements BluestoneSignalSource {
|
||||||
public static final MapCodec<BluestoneComparatorBlock> CODEC = simpleCodec(BluestoneComparatorBlock::new);
|
public static final MapCodec<BluestoneComparatorBlock> CODEC = simpleCodec(BluestoneComparatorBlock::new);
|
||||||
private static final VoxelShape SHAPE = Block.box(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
|
private static final VoxelShape SHAPE = Block.box(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
|
||||||
private static final DustParticleOptions BLUESTONE_PARTICLE = new DustParticleOptions(new Vector3f(0.18F, 0.54F, 1.0F), 1.0F);
|
private static final DustParticleOptions BLUESTONE_PARTICLE = new DustParticleOptions(new Vector3f(0.18F, 0.54F, 1.0F), 1.0F);
|
||||||
@@ -134,6 +134,11 @@ public class BluestoneComparatorBlock extends ComparatorBlock {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBluestoneSignal(LevelReader level, BlockPos pos, BlockState state, Direction direction) {
|
||||||
|
return level == null ? 0 : state.getSignal(level, pos, direction);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void checkTickOnNeighbor(Level level, BlockPos pos, BlockState state) {
|
protected void checkTickOnNeighbor(Level level, BlockPos pos, BlockState state) {
|
||||||
if (level.getBlockTicks().willTickThisTick(pos, this)) {
|
if (level.getBlockTicks().willTickThisTick(pos, this)) {
|
||||||
File renamed without changes.
File renamed without changes.
+6
-1
@@ -20,7 +20,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
public class BluestoneRepeaterBlock extends RepeaterBlock {
|
public class BluestoneRepeaterBlock extends RepeaterBlock implements BluestoneSignalSource {
|
||||||
public static final MapCodec<BluestoneRepeaterBlock> CODEC = simpleCodec(BluestoneRepeaterBlock::new);
|
public static final MapCodec<BluestoneRepeaterBlock> CODEC = simpleCodec(BluestoneRepeaterBlock::new);
|
||||||
private static final VoxelShape SHAPE = Block.box(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
|
private static final VoxelShape SHAPE = Block.box(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
|
||||||
private static final DustParticleOptions BLUESTONE_PARTICLE = new DustParticleOptions(new Vector3f(0.18F, 0.54F, 1.0F), 1.0F);
|
private static final DustParticleOptions BLUESTONE_PARTICLE = new DustParticleOptions(new Vector3f(0.18F, 0.54F, 1.0F), 1.0F);
|
||||||
@@ -102,6 +102,11 @@ public class BluestoneRepeaterBlock extends RepeaterBlock {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBluestoneSignal(LevelReader level, BlockPos pos, BlockState state, Direction direction) {
|
||||||
|
return level == null ? 0 : state.getSignal(level, pos, direction);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void animateTick(BlockState state, net.minecraft.world.level.Level level, BlockPos pos, RandomSource random) {
|
public void animateTick(BlockState state, net.minecraft.world.level.Level level, BlockPos pos, RandomSource random) {
|
||||||
if (!state.getValue(POWERED)) {
|
if (!state.getValue(POWERED)) {
|
||||||
File renamed without changes.
+10
-2
@@ -42,7 +42,7 @@ public final class BluestoneSignalHelper {
|
|||||||
|
|
||||||
public static int getSignalExcludingRedstoneWire(LevelReader level, BlockPos pos, Direction direction) {
|
public static int getSignalExcludingRedstoneWire(LevelReader level, BlockPos pos, Direction direction) {
|
||||||
BlockState state = level.getBlockState(pos);
|
BlockState state = level.getBlockState(pos);
|
||||||
if (state.is(Blocks.REDSTONE_WIRE)) {
|
if (isVanillaRedstoneComponent(state)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int signal = state.getSignal(level, pos, direction);
|
int signal = state.getSignal(level, pos, direction);
|
||||||
@@ -57,7 +57,7 @@ public final class BluestoneSignalHelper {
|
|||||||
for (Direction direction : Direction.values()) {
|
for (Direction direction : Direction.values()) {
|
||||||
BlockPos neighborPos = pos.relative(direction);
|
BlockPos neighborPos = pos.relative(direction);
|
||||||
BlockState neighborState = level.getBlockState(neighborPos);
|
BlockState neighborState = level.getBlockState(neighborPos);
|
||||||
if (neighborState.is(Blocks.REDSTONE_WIRE)) {
|
if (isVanillaRedstoneComponent(neighborState)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
signal = Math.max(signal, neighborState.getDirectSignal(level, neighborPos, direction));
|
signal = Math.max(signal, neighborState.getDirectSignal(level, neighborPos, direction));
|
||||||
@@ -82,4 +82,12 @@ public final class BluestoneSignalHelper {
|
|||||||
level.updateNeighborsAt(pos.relative(direction), level.getBlockState(pos).getBlock());
|
level.updateNeighborsAt(pos.relative(direction), level.getBlockState(pos).getBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isVanillaRedstoneComponent(BlockState state) {
|
||||||
|
return state.is(Blocks.REDSTONE_WIRE)
|
||||||
|
|| state.is(Blocks.REDSTONE_TORCH)
|
||||||
|
|| state.is(Blocks.REDSTONE_WALL_TORCH)
|
||||||
|
|| state.is(Blocks.REPEATER)
|
||||||
|
|| state.is(Blocks.COMPARATOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
+17
-10
@@ -1,7 +1,6 @@
|
|||||||
package com.craisinlord.antarchy.content.block;
|
package com.craisinlord.antarchy.content.block;
|
||||||
|
|
||||||
import com.craisinlord.antarchy.content.AntarchyTags;
|
import com.craisinlord.antarchy.content.AntarchyTags;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -33,6 +32,7 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
import org.spongepowered.include.com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
public class BluestoneWireBlock extends Block implements BluestoneSignalSource {
|
public class BluestoneWireBlock extends Block implements BluestoneSignalSource {
|
||||||
public static final MapCodec<BluestoneWireBlock> CODEC = simpleCodec(BluestoneWireBlock::new);
|
public static final MapCodec<BluestoneWireBlock> CODEC = simpleCodec(BluestoneWireBlock::new);
|
||||||
@@ -41,12 +41,12 @@ public class BluestoneWireBlock extends Block implements BluestoneSignalSource {
|
|||||||
public static final EnumProperty<BluestoneSide> SOUTH = EnumProperty.create("south", BluestoneSide.class);
|
public static final EnumProperty<BluestoneSide> SOUTH = EnumProperty.create("south", BluestoneSide.class);
|
||||||
public static final EnumProperty<BluestoneSide> WEST = EnumProperty.create("west", BluestoneSide.class);
|
public static final EnumProperty<BluestoneSide> WEST = EnumProperty.create("west", BluestoneSide.class);
|
||||||
public static final IntegerProperty POWER = IntegerProperty.create("power", 0, 15);
|
public static final IntegerProperty POWER = IntegerProperty.create("power", 0, 15);
|
||||||
public static final Map<Direction, EnumProperty<BluestoneSide>> PROPERTY_BY_DIRECTION = ImmutableMap.of(
|
public static final Map<Direction, EnumProperty<BluestoneSide>> PROPERTY_BY_DIRECTION = ImmutableMap.<Direction, EnumProperty<BluestoneSide>>builder()
|
||||||
Direction.NORTH, NORTH,
|
.put(Direction.NORTH, NORTH)
|
||||||
Direction.EAST, EAST,
|
.put(Direction.EAST, EAST)
|
||||||
Direction.SOUTH, SOUTH,
|
.put(Direction.SOUTH, SOUTH)
|
||||||
Direction.WEST, WEST
|
.put(Direction.WEST, WEST)
|
||||||
);
|
.build();
|
||||||
private static final VoxelShape DOT_SHAPE = Block.box(3.0D, 14.0D, 3.0D, 13.0D, 16.0D, 13.0D);
|
private static final VoxelShape DOT_SHAPE = Block.box(3.0D, 14.0D, 3.0D, 13.0D, 16.0D, 13.0D);
|
||||||
private static final VoxelShape NORTH_SHAPE = Block.box(3.0D, 14.0D, 0.0D, 13.0D, 16.0D, 13.0D);
|
private static final VoxelShape NORTH_SHAPE = Block.box(3.0D, 14.0D, 0.0D, 13.0D, 16.0D, 13.0D);
|
||||||
private static final VoxelShape SOUTH_SHAPE = Block.box(3.0D, 14.0D, 3.0D, 13.0D, 16.0D, 16.0D);
|
private static final VoxelShape SOUTH_SHAPE = Block.box(3.0D, 14.0D, 3.0D, 13.0D, 16.0D, 16.0D);
|
||||||
@@ -321,13 +321,20 @@ public class BluestoneWireBlock extends Block implements BluestoneSignalSource {
|
|||||||
for (Direction direction : Direction.values()) {
|
for (Direction direction : Direction.values()) {
|
||||||
BlockPos neighborPos = pos.relative(direction);
|
BlockPos neighborPos = pos.relative(direction);
|
||||||
BlockState neighborState = level.getBlockState(neighborPos);
|
BlockState neighborState = level.getBlockState(neighborPos);
|
||||||
if (neighborState.is(net.minecraft.world.level.block.Blocks.REDSTONE_WIRE)) {
|
if (BluestoneSignalHelper.isVanillaRedstoneComponent(neighborState)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (neighborState.getBlock() instanceof BluestoneWireBlock) {
|
if (neighborState.getBlock() instanceof BluestoneWireBlock) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
signal = Math.max(signal, BluestoneSignalHelper.getSignalExcludingRedstoneWire(level, neighborPos, direction.getOpposite()));
|
if (neighborState.getBlock() instanceof BluestoneSignalSource source) {
|
||||||
|
signal = Math.max(signal, source.getBluestoneSignal(level, neighborPos, neighborState, direction));
|
||||||
|
if (signal >= 15) {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
signal = Math.max(signal, BluestoneSignalHelper.getSignalExcludingRedstoneWire(level, neighborPos, direction));
|
||||||
if (signal >= 15) {
|
if (signal >= 15) {
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
@@ -416,7 +423,7 @@ public class BluestoneWireBlock extends Block implements BluestoneSignalSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean canConnectTo(BlockState state, Direction direction) {
|
private boolean canConnectTo(BlockState state, Direction direction) {
|
||||||
if (state.getBlock() instanceof RedStoneWireBlock || state.is(net.minecraft.world.level.block.Blocks.REDSTONE_WIRE)) {
|
if (BluestoneSignalHelper.isVanillaRedstoneComponent(state)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (state.getBlock() instanceof BluestoneWireBlock || state.getBlock() instanceof BluestoneTorchBlock || state.getBlock() instanceof BluestoneBlock) {
|
if (state.getBlock() instanceof BluestoneWireBlock || state.getBlock() instanceof BluestoneTorchBlock || state.getBlock() instanceof BluestoneBlock) {
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-20
@@ -4,14 +4,7 @@ import com.craisinlord.antarchy.content.AntarchyObjects;
|
|||||||
import com.craisinlord.antarchy.content.block.entity.DreamCampfireBlockEntity;
|
import com.craisinlord.antarchy.content.block.entity.DreamCampfireBlockEntity;
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.CampfireBlock;
|
import net.minecraft.world.level.block.CampfireBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||||
@@ -55,17 +48,4 @@ public class DreamCampfireBlock extends CampfireBlock {
|
|||||||
? createTickerHelper(blockEntityType, dreamCampfireType, CampfireBlockEntity::cookTick)
|
? createTickerHelper(blockEntityType, dreamCampfireType, CampfireBlockEntity::cookTick)
|
||||||
: createTickerHelper(blockEntityType, dreamCampfireType, CampfireBlockEntity::cooldownTick);
|
: createTickerHelper(blockEntityType, dreamCampfireType, CampfireBlockEntity::cooldownTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void playerDestroy(Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, ItemStack stack) {
|
|
||||||
var silkTouch = level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.SILK_TOUCH);
|
|
||||||
boolean hasSilkTouch = EnchantmentHelper.getItemEnchantmentLevel(silkTouch, stack) > 0;
|
|
||||||
ItemStack droppedCampfire = hasSilkTouch ? this.getCloneItemStack(level, pos, state) : ItemStack.EMPTY;
|
|
||||||
|
|
||||||
super.playerDestroy(level, player, pos, state, blockEntity, stack);
|
|
||||||
|
|
||||||
if (hasSilkTouch && !droppedCampfire.isEmpty() && level instanceof ServerLevel serverLevel) {
|
|
||||||
Block.popResource(serverLevel, pos, droppedCampfire);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package com.craisinlord.antarchy.content.block;
|
||||||
|
|
||||||
|
import com.craisinlord.antarchy.content.AntarchyTags;
|
||||||
|
import com.craisinlord.antarchy.mixins.AccessorFireBlock;
|
||||||
|
import com.mojang.serialization.MapCodec;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.FireBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.LevelReader;
|
||||||
|
|
||||||
|
public class DreamFireBlock extends FireBlock {
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
public static final MapCodec<FireBlock> CODEC = (MapCodec) simpleCodec(DreamFireBlock::new);
|
||||||
|
|
||||||
|
public DreamFireBlock(BlockBehaviour.Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
this.copyVanillaFlammability();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MapCodec<FireBlock> codec() {
|
||||||
|
return CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
|
||||||
|
return level.getBlockState(pos.below()).is(AntarchyTags.Blocks.DREAM_FIRE_BASE_BLOCKS)
|
||||||
|
|| super.canSurvive(state, level, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyVanillaFlammability() {
|
||||||
|
AccessorFireBlock vanillaFire = (AccessorFireBlock) Blocks.FIRE;
|
||||||
|
Object2IntMap<net.minecraft.world.level.block.Block> vanillaIgniteOdds = vanillaFire.antarchy$getIgniteOdds();
|
||||||
|
Object2IntMap<net.minecraft.world.level.block.Block> vanillaBurnOdds = vanillaFire.antarchy$getBurnOdds();
|
||||||
|
for (Object2IntMap.Entry<net.minecraft.world.level.block.Block> entry : vanillaIgniteOdds.object2IntEntrySet()) {
|
||||||
|
this.setFlammable(entry.getKey(), entry.getIntValue(), vanillaBurnOdds.getInt(entry.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 4541 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user