Block entity parent saving corrected. Forge/gradle update. Fixed waterlogging.
This commit is contained in:
parent
ee3e8de99e
commit
82c2484872
29 changed files with 370 additions and 139 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -43,3 +43,4 @@ signing.*
|
||||||
tests
|
tests
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
tmp
|
tmp
|
||||||
|
todo.*
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -72,6 +72,7 @@ mrproper: clean-all
|
||||||
init:
|
init:
|
||||||
@echo "[1.18] Initialising eclipse workspace using gradle ..."
|
@echo "[1.18] Initialising eclipse workspace using gradle ..."
|
||||||
@$(GRADLE) eclipse
|
@$(GRADLE) eclipse
|
||||||
|
-@$(GRADLE) hideOfficialWarningUntilChanged
|
||||||
|
|
||||||
sanitize:
|
sanitize:
|
||||||
@echo "[1.18] Running sanitising tasks ..."
|
@echo "[1.18] Running sanitising tasks ..."
|
||||||
|
|
46
build.gradle
46
build.gradle
|
@ -2,18 +2,17 @@
|
||||||
// Engineer's decor mod gradle build.
|
// Engineer's decor mod gradle build.
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven { url = 'https://maven.minecraftforge.net' }
|
maven { url = 'https://maven.minecraftforge.net' }
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: 'net.minecraftforge.gradle'
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
version = "${version_engineersdecor}"
|
version = "${version_engineersdecor}"
|
||||||
group = "wile.engineersdecor"
|
group = "wile.engineersdecor"
|
||||||
|
@ -68,27 +67,22 @@ jar {
|
||||||
}
|
}
|
||||||
|
|
||||||
jar.finalizedBy('reobfJar')
|
jar.finalizedBy('reobfJar')
|
||||||
// def reobfFile = file("$buildDir/reobfJar/output.jar")
|
|
||||||
// def reobfArtifact = artifacts.add('default', reobfFile) { type 'jar'; builtBy 'reobfJar' }
|
|
||||||
|
|
||||||
|
// Signing
|
||||||
//import net.minecraftforge.gradle.common.task.SignJar
|
import net.minecraftforge.gradle.common.tasks.SignJar
|
||||||
// task signJar(type: SignJar, dependsOn: jar) {
|
project.afterEvaluate {
|
||||||
// onlyIf { project.hasProperty("keystore_file") }
|
task signJar(type: SignJar, dependsOn: jar) {
|
||||||
// if(project.hasProperty("keystore_file")) {
|
onlyIf { project.hasProperty("keystore_file") }
|
||||||
// keyStore = project.getProperty("keystore_file")
|
if(project.hasProperty("keystore_file")) {
|
||||||
// alias = project.getProperty("keystore_alias")
|
keyStore = project.getProperty("keystore_file")
|
||||||
// storePass = project.getProperty("keystore_pass")
|
alias = project.getProperty("keystore_alias")
|
||||||
// keyPass = project.getProperty("keystore_keypass")
|
storePass = project.getProperty("keystore_pass")
|
||||||
// inputFile = jar.archivePath
|
keyPass = project.getProperty("keystore_keypass")
|
||||||
// outputFile = jar.archivePath
|
inputFile = jar.archiveFile
|
||||||
// } else {
|
outputFile = jar.archiveFile
|
||||||
// logger.warn("[WARNING] Signing skipped.")
|
} else {
|
||||||
// }
|
logger.warn("[WARNING] Signing skipped.")
|
||||||
// }
|
}
|
||||||
// build.dependsOn signJar
|
}
|
||||||
|
reobfJar.finalizedBy('signJar')
|
||||||
publishing {
|
|
||||||
publications { mavenJava(MavenPublication) { artifact jar } }
|
|
||||||
repositories { maven { url "file:///${project.projectDir}/mcmodsrepo" } }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ org.gradle.daemon=false
|
||||||
org.gradle.jvmargs=-Xmx8G
|
org.gradle.jvmargs=-Xmx8G
|
||||||
version_minecraft=1.18.1
|
version_minecraft=1.18.1
|
||||||
version_forge_minecraft=1.18.1-39.0.5
|
version_forge_minecraft=1.18.1-39.0.5
|
||||||
version_jei=1.18.1:9.1.2.50
|
version_jei=1.18.1:9.1.2.54
|
||||||
version_engineersdecor=1.1.19-b1
|
version_engineersdecor=1.1.19-b2
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.2-20210702220150+0000-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||||
"1.18.1": {
|
"1.18.1": {
|
||||||
"1.1.19-b1": "[R] Initial 1.18.1 port.",
|
"1.1.19-b2": "[F] Fixed waterlogging.\n[F] Block entity parent saving corrected, ticker unified.\n[U] Forge/gradle update.",
|
||||||
|
"1.1.19-b1": "[U] Initial 1.18.1 port.",
|
||||||
"1.1.18": "[F] Block Placer placement context issue fix.\n[F] Fixed compatibility to Forge >=37.0.82.\n[M] Update lang ru_ru (PR#191, Smollet777).",
|
"1.1.18": "[F] Block Placer placement context issue fix.\n[F] Fixed compatibility to Forge >=37.0.82.\n[M] Update lang ru_ru (PR#191, Smollet777).",
|
||||||
"1.1.17": "[R] Initial 1.17.1 release.",
|
"1.1.17": "[R] Initial 1.17.1 release.",
|
||||||
"1.1.17-b5": "[F] Refurbished Mineral Melter code.\n[F] Fixed Block Placer item insertion.",
|
"1.1.17-b5": "[F] Refurbished Mineral Melter code.\n[F] Fixed Block Placer item insertion.",
|
||||||
|
@ -48,6 +49,6 @@
|
||||||
},
|
},
|
||||||
"promos": {
|
"promos": {
|
||||||
"1.18.1-recommended": "1.1.18",
|
"1.18.1-recommended": "1.1.18",
|
||||||
"1.18.1-latest": "1.1.19-b1"
|
"1.18.1-latest": "1.1.19-b2"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,11 @@ Mod sources for Minecraft version 1.18.x.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- v1.1.19-b1 [R] Initial 1.18.1 port.
|
- v1.1.19-b2 [F] Fixed waterlogging.
|
||||||
|
[F] Block entity parent saving corrected, ticker unified.
|
||||||
|
[U] Forge/gradle update.
|
||||||
|
|
||||||
|
- v1.1.19-b1 [U] Initial 1.18.1 port.
|
||||||
|
|
||||||
- v1.1.18 [F] Block Placer placement context issue fix.
|
- v1.1.18 [F] Block Placer placement context issue fix.
|
||||||
[F] Fixed compatibility to Forge >=37.0.82.
|
[F] Fixed compatibility to Forge >=37.0.82.
|
||||||
|
|
|
@ -98,6 +98,10 @@ public class EdBreaker
|
||||||
public BlockEntityType<BreakerTileEntity> getBlockEntityType()
|
public BlockEntityType<BreakerTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_BLOCK_BREAKER; }
|
{ return ModContent.TET_SMALL_BLOCK_BREAKER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(ACTIVE); }
|
{ super.createBlockStateDefinition(builder); builder.add(ACTIVE); }
|
||||||
|
@ -220,7 +224,7 @@ public class EdBreaker
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -98,6 +98,10 @@ public class EdCraftingTable
|
||||||
public BlockEntityType<EdCraftingTable.CraftingTableTileEntity> getBlockEntityType()
|
public BlockEntityType<EdCraftingTable.CraftingTableTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_CRAFTING_TABLE; }
|
{ return ModContent.TET_CRAFTING_TABLE; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldCheckWeakPower(BlockState state, LevelReader world, BlockPos pos, Direction side)
|
public boolean shouldCheckWeakPower(BlockState state, LevelReader world, BlockPos pos, Direction side)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
@ -211,7 +215,7 @@ public class EdCraftingTable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getUpdateTag()
|
public CompoundTag getUpdateTag()
|
||||||
|
|
|
@ -93,6 +93,10 @@ public class EdDropper
|
||||||
public BlockEntityType<EdDropper.DropperTileEntity> getBlockEntityType()
|
public BlockEntityType<EdDropper.DropperTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_FACTORY_DROPPER; }
|
{ return ModContent.TET_FACTORY_DROPPER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderTypeHint getRenderTypeHint()
|
public RenderTypeHint getRenderTypeHint()
|
||||||
{ return RenderTypeHint.SOLID; }
|
{ return RenderTypeHint.SOLID; }
|
||||||
|
@ -294,7 +298,7 @@ public class EdDropper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt, false); }
|
{ super.saveAdditional(nbt); writenbt(nbt, false); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -96,6 +96,10 @@ public class EdElectricalFurnace
|
||||||
public BlockEntityType<EdElectricalFurnace.ElectricalFurnaceTileEntity> getBlockEntityType()
|
public BlockEntityType<EdElectricalFurnace.ElectricalFurnaceTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_ELECTRICAL_FURNACE; }
|
{ return ModContent.TET_SMALL_ELECTRICAL_FURNACE; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
@ -338,7 +342,7 @@ public class EdElectricalFurnace
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -104,6 +104,10 @@ public class EdFluidBarrel
|
||||||
public BlockEntityType<EdFluidBarrel.FluidBarrelTileEntity> getBlockEntityType()
|
public BlockEntityType<EdFluidBarrel.FluidBarrelTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_FLUID_BARREL; }
|
{ return ModContent.TET_FLUID_BARREL; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockItem getBlockItem(Block block, Item.Properties builder)
|
public BlockItem getBlockItem(Block block, Item.Properties builder)
|
||||||
{ return new FluidBarrelItem(block, builder); }
|
{ return new FluidBarrelItem(block, builder); }
|
||||||
|
@ -272,7 +276,7 @@ public class EdFluidBarrel
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
@ -379,7 +383,7 @@ public class EdFluidBarrel
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBarWidth(ItemStack stack)
|
public int getBarWidth(ItemStack stack)
|
||||||
{ return Math.round(13f * ((stack.getMaxDamage()<=0) ? (1f) : Mth.clamp((float)stack.getDamageValue()/(float)stack.getMaxDamage(), 0f, 1f))); }
|
{ return (int)Math.round(13f * Mth.clamp(((double)(getFluid(stack).getAmount()))/((double)capacity_), 0.0, 1.0)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBarColor(ItemStack stack)
|
public int getBarColor(ItemStack stack)
|
||||||
|
|
|
@ -82,6 +82,10 @@ public class EdFluidFunnel
|
||||||
public BlockEntityType<EdFluidFunnel.FluidFunnelTileEntity> getBlockEntityType()
|
public BlockEntityType<EdFluidFunnel.FluidFunnelTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_FLUID_FUNNEL; }
|
{ return ModContent.TET_SMALL_FLUID_FUNNEL; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderTypeHint getRenderTypeHint()
|
public RenderTypeHint getRenderTypeHint()
|
||||||
{ return RenderTypeHint.CUTOUT; }
|
{ return RenderTypeHint.CUTOUT; }
|
||||||
|
@ -215,7 +219,7 @@ public class EdFluidFunnel
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -81,6 +81,10 @@ public class EdFreezer
|
||||||
public BlockEntityType<EdFreezer.FreezerTileEntity> getBlockEntityType()
|
public BlockEntityType<EdFreezer.FreezerTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_FREEZER; }
|
{ return ModContent.TET_FREEZER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
@ -264,7 +268,7 @@ public class EdFreezer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -94,6 +94,10 @@ public class EdFurnace
|
||||||
public BlockEntityType<EdFurnace.FurnaceTileEntity> getBlockEntityType()
|
public BlockEntityType<EdFurnace.FurnaceTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_LAB_FURNACE; }
|
{ return ModContent.TET_SMALL_LAB_FURNACE; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(LIT); }
|
{ super.createBlockStateDefinition(builder); builder.add(LIT); }
|
||||||
|
@ -386,7 +390,7 @@ public class EdFurnace
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -33,11 +33,14 @@ import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
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.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import wile.engineersdecor.libmc.blocks.StandardBlocks;
|
import wile.engineersdecor.libmc.blocks.StandardBlocks;
|
||||||
|
import wile.engineersdecor.libmc.detail.Auxiliaries;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
public class EdHatchBlock extends StandardBlocks.HorizontalWaterLoggable
|
public class EdHatchBlock extends StandardBlocks.HorizontalWaterLoggable
|
||||||
|
@ -55,6 +58,20 @@ public class EdHatchBlock extends StandardBlocks.HorizontalWaterLoggable
|
||||||
public EdHatchBlock(long config, BlockBehaviour.Properties builder, final AABB[] unrotatedAABBsClosed, final AABB[] unrotatedAABBsOpen)
|
public EdHatchBlock(long config, BlockBehaviour.Properties builder, final AABB[] unrotatedAABBsClosed, final AABB[] unrotatedAABBsOpen)
|
||||||
{ super(config, builder, unrotatedAABBsClosed); vshapes_open = makeHorizontalShapeLookup(unrotatedAABBsOpen); }
|
{ super(config, builder, unrotatedAABBsClosed); vshapes_open = makeHorizontalShapeLookup(unrotatedAABBsOpen); }
|
||||||
|
|
||||||
|
protected static ArrayList<VoxelShape> makeHorizontalShapeLookup(final AABB[] unrotatedAABBs)
|
||||||
|
{
|
||||||
|
return new ArrayList<>(Arrays.asList(
|
||||||
|
Shapes.block(),
|
||||||
|
Shapes.block(),
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.NORTH, true)),
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.SOUTH, true)),
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.WEST, true)),
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.EAST, true)),
|
||||||
|
Shapes.block(),
|
||||||
|
Shapes.block()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderTypeHint getRenderTypeHint()
|
public RenderTypeHint getRenderTypeHint()
|
||||||
{ return RenderTypeHint.CUTOUT; }
|
{ return RenderTypeHint.CUTOUT; }
|
||||||
|
@ -63,6 +80,10 @@ public class EdHatchBlock extends StandardBlocks.HorizontalWaterLoggable
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return state.getValue(OPEN) ? vshapes_open.get((state.getValue(HORIZONTAL_FACING)).get3DDataValue() & 0x7) : super.getShape(state, source, pos, selectionContext); }
|
{ return state.getValue(OPEN) ? vshapes_open.get((state.getValue(HORIZONTAL_FACING)).get3DDataValue() & 0x7) : super.getShape(state, source, pos, selectionContext); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
||||||
|
{ return getShape(state, source, pos, selectionContext); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos)
|
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos)
|
||||||
{ return state.getValue(OPEN); }
|
{ return state.getValue(OPEN); }
|
||||||
|
@ -135,6 +156,6 @@ public class EdHatchBlock extends StandardBlocks.HorizontalWaterLoggable
|
||||||
Vec3 v = centre.subtract(ppos);
|
Vec3 v = centre.subtract(ppos);
|
||||||
if(ppos.y() < (centre.y()-0.1) || (v.lengthSqr() > 0.3)) return;
|
if(ppos.y() < (centre.y()-0.1) || (v.lengthSqr() > 0.3)) return;
|
||||||
v = v.scale(0.3);
|
v = v.scale(0.3);
|
||||||
player.push(v.x, 0, v.z);
|
player.push(v.x, -0.1, v.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,10 @@ public class EdHopper
|
||||||
public BlockEntityType<EdHopper.HopperTileEntity> getBlockEntityType()
|
public BlockEntityType<EdHopper.HopperTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_FACTORY_HOPPER; }
|
{ return ModContent.TET_FACTORY_HOPPER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
@ -274,7 +278,7 @@ public class EdHopper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt, false); }
|
{ super.saveAdditional(nbt); writenbt(nbt, false); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -90,6 +90,10 @@ public class EdLabeledCrate
|
||||||
public BlockEntityType<EdLabeledCrate.LabeledCrateTileEntity> getBlockEntityType()
|
public BlockEntityType<EdLabeledCrate.LabeledCrateTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_LABELED_CRATE; }
|
{ return ModContent.TET_LABELED_CRATE; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public boolean hasAnalogOutputSignal(BlockState state)
|
public boolean hasAnalogOutputSignal(BlockState state)
|
||||||
|
@ -278,7 +282,7 @@ public class EdLabeledCrate
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -42,6 +42,7 @@ import net.minecraft.world.level.material.Fluids;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
@ -117,7 +118,7 @@ public class EdMilker
|
||||||
public MilkerBlock(long config, BlockBehaviour.Properties builder, final AABB[] unrotatedAABBs)
|
public MilkerBlock(long config, BlockBehaviour.Properties builder, final AABB[] unrotatedAABBs)
|
||||||
{
|
{
|
||||||
super(config, builder, unrotatedAABBs);
|
super(config, builder, unrotatedAABBs);
|
||||||
overrideCollisionShape(Auxiliaries.getPixeledAABB(0,0,0, 16,24,16));
|
cshapes.replaceAll((state,shape)->Shapes.create(Auxiliaries.getPixeledAABB(0,0,0, 16,24,16)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -125,6 +126,10 @@ public class EdMilker
|
||||||
public BlockEntityType<EdMilker.MilkerTileEntity> getBlockEntityType()
|
public BlockEntityType<EdMilker.MilkerTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_MILKING_MACHINE; }
|
{ return ModContent.TET_SMALL_MILKING_MACHINE; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(ACTIVE); builder.add(FILLED); }
|
{ super.createBlockStateDefinition(builder); builder.add(ACTIVE); builder.add(FILLED); }
|
||||||
|
@ -283,7 +288,7 @@ public class EdMilker
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt, false); }
|
{ super.saveAdditional(nbt); writenbt(nbt, false); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -87,6 +87,10 @@ public class EdMineralSmelter
|
||||||
public BlockEntityType<EdMineralSmelter.MineralSmelterTileEntity> getBlockEntityType()
|
public BlockEntityType<EdMineralSmelter.MineralSmelterTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_MINERAL_SMELTER; }
|
{ return ModContent.TET_MINERAL_SMELTER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
@ -368,7 +372,7 @@ public class EdMineralSmelter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -80,6 +80,10 @@ public class EdPipeValve
|
||||||
public BlockEntityType<EdPipeValve.PipeValveTileEntity> getBlockEntityType()
|
public BlockEntityType<EdPipeValve.PipeValveTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_STRAIGHT_PIPE_VALVE; }
|
{ return ModContent.TET_STRAIGHT_PIPE_VALVE; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
|
|
@ -88,6 +88,10 @@ public class EdPlacer
|
||||||
public BlockEntityType<EdPlacer.PlacerTileEntity> getBlockEntityType()
|
public BlockEntityType<EdPlacer.PlacerTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_FACTORY_PLACER; }
|
{ return ModContent.TET_FACTORY_PLACER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
@ -261,7 +265,7 @@ public class EdPlacer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt, false); }
|
{ super.saveAdditional(nbt); writenbt(nbt, false); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -81,6 +81,10 @@ public class EdSolarPanel
|
||||||
public BlockEntityType<EdSolarPanel.SolarPanelTileEntity> getBlockEntityType()
|
public BlockEntityType<EdSolarPanel.SolarPanelTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_SOLAR_PANEL; }
|
{ return ModContent.TET_SMALL_SOLAR_PANEL; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(EXPOSITION); }
|
{ super.createBlockStateDefinition(builder); builder.add(EXPOSITION); }
|
||||||
|
@ -153,7 +157,7 @@ public class EdSolarPanel
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt, false); }
|
{ super.saveAdditional(nbt); writenbt(nbt, false); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -67,6 +67,10 @@ public class EdTestBlock
|
||||||
public BlockEntityType<EdTestBlock.TestTileEntity> getBlockEntityType()
|
public BlockEntityType<EdTestBlock.TestTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_TEST_BLOCK; }
|
{ return ModContent.TET_TEST_BLOCK; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return Shapes.block(); }
|
{ return Shapes.block(); }
|
||||||
|
@ -168,7 +172,7 @@ public class EdTestBlock
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{
|
{
|
||||||
super.save(nbt);
|
super.saveAdditional(nbt);
|
||||||
tank_.save(nbt);
|
tank_.save(nbt);
|
||||||
battery_.save(nbt);
|
battery_.save(nbt);
|
||||||
nbt.putInt("rf_fed_avg", rf_fed_avg);
|
nbt.putInt("rf_fed_avg", rf_fed_avg);
|
||||||
|
|
|
@ -69,6 +69,10 @@ public class EdTreeCutter
|
||||||
public BlockEntityType<EdTreeCutter.TreeCutterTileEntity> getBlockEntityType()
|
public BlockEntityType<EdTreeCutter.TreeCutterTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_SMALL_TREE_CUTTER; }
|
{ return ModContent.TET_SMALL_TREE_CUTTER; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(ACTIVE); }
|
{ super.createBlockStateDefinition(builder); builder.add(ACTIVE); }
|
||||||
|
@ -83,7 +87,7 @@ public class EdTreeCutter
|
||||||
{
|
{
|
||||||
if((state.getBlock()!=this) || (!state.getValue(ACTIVE))) return;
|
if((state.getBlock()!=this) || (!state.getValue(ACTIVE))) return;
|
||||||
// Sound
|
// Sound
|
||||||
if(true || (world.getGameTime() & 0x1) == 0) {
|
/*if((world.getGameTime() & 0x1) == 0)*/ {
|
||||||
world.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.WOOD_HIT, SoundSource.BLOCKS, 0.1f, 1.0f, false);
|
world.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.WOOD_HIT, SoundSource.BLOCKS, 0.1f, 1.0f, false);
|
||||||
}
|
}
|
||||||
// Particles
|
// Particles
|
||||||
|
@ -174,7 +178,7 @@ public class EdTreeCutter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ super.save(nbt); writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -87,6 +87,10 @@ public class EdWasteIncinerator
|
||||||
public BlockEntityType<EdWasteIncinerator.WasteIncineratorTileEntity> getBlockEntityType()
|
public BlockEntityType<EdWasteIncinerator.WasteIncineratorTileEntity> getBlockEntityType()
|
||||||
{ return ModContent.TET_WASTE_INCINERATOR; }
|
{ return ModContent.TET_WASTE_INCINERATOR; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
|
{ return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(LIT); }
|
{ super.createBlockStateDefinition(builder); builder.add(LIT); }
|
||||||
|
@ -224,7 +228,7 @@ public class EdWasteIncinerator
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void saveAdditional(CompoundTag nbt)
|
protected void saveAdditional(CompoundTag nbt)
|
||||||
{ writenbt(nbt); }
|
{ super.saveAdditional(nbt); writenbt(nbt); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemoved()
|
public void setRemoved()
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.SpawnPlacements;
|
import net.minecraft.world.entity.SpawnPlacements;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
@ -34,6 +35,7 @@ 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.BlockStateProperties;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
|
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
@ -52,6 +54,7 @@ import wile.engineersdecor.libmc.detail.Auxiliaries;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,8 +105,9 @@ public class StandardBlocks
|
||||||
BlockItem getBlockItem(Block block, Item.Properties builder);
|
BlockItem getBlockItem(Block block, Item.Properties builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BaseBlock extends Block implements IStandardBlock, LiquidBlockContainer
|
public static class BaseBlock extends Block implements IStandardBlock, SimpleWaterloggedBlock
|
||||||
{
|
{
|
||||||
|
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||||
public final long config;
|
public final long config;
|
||||||
|
|
||||||
public BaseBlock(long conf, BlockBehaviour.Properties properties)
|
public BaseBlock(long conf, BlockBehaviour.Properties properties)
|
||||||
|
@ -111,6 +115,7 @@ public class StandardBlocks
|
||||||
super(properties);
|
super(properties);
|
||||||
config = conf;
|
config = conf;
|
||||||
BlockState state = getStateDefinition().any();
|
BlockState state = getStateDefinition().any();
|
||||||
|
if((conf & CFG_WATERLOGGABLE)!=0) state = state.setValue(WATERLOGGED, false);
|
||||||
registerDefaultState(state);
|
registerDefaultState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,14 +132,6 @@ public class StandardBlocks
|
||||||
public RenderTypeHint getRenderTypeHint()
|
public RenderTypeHint getRenderTypeHint()
|
||||||
{ return getRenderTypeHint(config); }
|
{ return getRenderTypeHint(config); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlaceLiquid(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid)
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean placeLiquid(LevelAccessor world, BlockPos pos, BlockState state, FluidState fluidstate)
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type)
|
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type)
|
||||||
|
@ -164,11 +161,42 @@ public class StandardBlocks
|
||||||
return dropList(state, world, te, is_explosion);
|
return dropList(state, world, te, is_explosion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos)
|
||||||
|
{ return (((config & CFG_WATERLOGGABLE)==0) || (!state.getValue(WATERLOGGED))) && super.propagatesSkylightDown(state, reader, pos); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public FluidState getFluidState(BlockState state)
|
||||||
|
{ return (((config & CFG_WATERLOGGABLE)!=0) && state.getValue(WATERLOGGED)) ? Fluids.WATER.getSource(false) : super.getFluidState(state); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos pos, BlockPos facingPos)
|
||||||
|
{
|
||||||
|
if(((config & CFG_WATERLOGGABLE)!=0) && (state.getValue(WATERLOGGED))) world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // SimpleWaterloggedBlock
|
||||||
|
public boolean canPlaceLiquid(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid)
|
||||||
|
{ return ((config & CFG_WATERLOGGABLE)!=0) && SimpleWaterloggedBlock.super.canPlaceLiquid(world, pos, state, fluid); }
|
||||||
|
|
||||||
|
@Override // SimpleWaterloggedBlock
|
||||||
|
public boolean placeLiquid(LevelAccessor world, BlockPos pos, BlockState state, FluidState fluidState)
|
||||||
|
{ return ((config & CFG_WATERLOGGABLE)!=0) && SimpleWaterloggedBlock.super.placeLiquid(world, pos, state, fluidState); }
|
||||||
|
|
||||||
|
@Override // SimpleWaterloggedBlock
|
||||||
|
public ItemStack pickupBlock(LevelAccessor world, BlockPos pos, BlockState state)
|
||||||
|
{ return ((config & CFG_WATERLOGGABLE)!=0) ? (SimpleWaterloggedBlock.super.pickupBlock(world, pos, state)) : (ItemStack.EMPTY); }
|
||||||
|
|
||||||
|
@Override // SimpleWaterloggedBlock
|
||||||
|
public Optional<SoundEvent> getPickupSound()
|
||||||
|
{ return ((config & CFG_WATERLOGGABLE)!=0) ? (SimpleWaterloggedBlock.super.getPickupSound()) : Optional.empty(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Cutout extends BaseBlock implements IStandardBlock
|
public static class Cutout extends BaseBlock implements IStandardBlock
|
||||||
{
|
{
|
||||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
|
||||||
private final VoxelShape vshape;
|
private final VoxelShape vshape;
|
||||||
|
|
||||||
public Cutout(long conf, BlockBehaviour.Properties properties)
|
public Cutout(long conf, BlockBehaviour.Properties properties)
|
||||||
|
@ -185,7 +213,6 @@ public class StandardBlocks
|
||||||
super(conf, properties);
|
super(conf, properties);
|
||||||
vshape = voxel_shape;
|
vshape = voxel_shape;
|
||||||
BlockState state = getStateDefinition().any();
|
BlockState state = getStateDefinition().any();
|
||||||
if((conf & CFG_WATERLOGGABLE)!=0) state = state.setValue(WATERLOGGED, false);
|
|
||||||
registerDefaultState(state);
|
registerDefaultState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,41 +298,41 @@ public class StandardBlocks
|
||||||
|
|
||||||
public static class Directed extends Cutout implements IStandardBlock
|
public static class Directed extends Cutout implements IStandardBlock
|
||||||
{
|
{
|
||||||
public static final DirectionProperty FACING = DirectionalBlock.FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||||
protected final ArrayList<VoxelShape> vshapes;
|
protected final Map<BlockState,VoxelShape> vshapes;
|
||||||
protected final ArrayList<VoxelShape> cshapes;
|
|
||||||
|
public Directed(long config, BlockBehaviour.Properties properties, final Function<List<BlockState>, Map<BlockState,VoxelShape>> shape_supplier)
|
||||||
|
{
|
||||||
|
super(config, properties);
|
||||||
|
registerDefaultState(stateDefinition.any().setValue(FACING, Direction.UP));
|
||||||
|
vshapes = shape_supplier.apply(getStateDefinition().getPossibleStates());
|
||||||
|
}
|
||||||
|
|
||||||
public Directed(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
public Directed(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||||
{
|
{
|
||||||
super(config, properties);
|
this(config, properties, (states)->{
|
||||||
registerDefaultState(super.defaultBlockState().setValue(FACING, Direction.UP));
|
final Map<BlockState,VoxelShape> vshapes = new HashMap<>();
|
||||||
vshapes = shape_supplier.get();
|
final ArrayList<VoxelShape> indexed_shapes = shape_supplier.get();
|
||||||
cshapes = new ArrayList<>(vshapes);
|
for(BlockState state:states) vshapes.put(state, indexed_shapes.get(state.getValue(FACING).get3DDataValue()));
|
||||||
|
return vshapes;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Directed(long config, BlockBehaviour.Properties properties, final AABB[] unrotatedAABBs)
|
public Directed(long config, BlockBehaviour.Properties properties, final AABB[] unrotatedAABBs)
|
||||||
{
|
{
|
||||||
this(config, properties, ()->{
|
this(config, properties, (states)->{
|
||||||
final boolean is_horizontal = ((config & CFG_HORIZIONTAL)!=0);
|
final boolean is_horizontal = ((config & CFG_HORIZIONTAL)!=0);
|
||||||
return new ArrayList<>(Arrays.asList(
|
Map<BlockState,VoxelShape> vshapes = new HashMap<>();
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.DOWN, is_horizontal)),
|
for(BlockState state:states) {
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.UP, is_horizontal)),
|
vshapes.put(state, Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, state.getValue(FACING), is_horizontal)));
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.NORTH, is_horizontal)),
|
}
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.SOUTH, is_horizontal)),
|
return vshapes;
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.WEST, is_horizontal)),
|
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.EAST, is_horizontal)),
|
|
||||||
Shapes.block(),
|
|
||||||
Shapes.block()
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Directed(long config, BlockBehaviour.Properties properties, final AABB unrotatedAABB)
|
public Directed(long config, BlockBehaviour.Properties properties, final AABB unrotatedAABB)
|
||||||
{ this(config, properties, new AABB[]{unrotatedAABB}); }
|
{ this(config, properties, new AABB[]{unrotatedAABB}); }
|
||||||
|
|
||||||
protected void overrideCollisionShape(final AABB unrotatedAABB)
|
|
||||||
{ for(int i=0; i<cshapes.size(); ++i) cshapes.set(i, Shapes.create(unrotatedAABB)); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPossibleToRespawnInThis()
|
public boolean isPossibleToRespawnInThis()
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
@ -316,11 +343,11 @@ public class StandardBlocks
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return vshapes.get((state.getValue(FACING)).get3DDataValue() & 0x7); }
|
{ return vshapes.get(state); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
{ return cshapes.get((state.getValue(FACING)).get3DDataValue() & 0x7); }
|
{ return getShape(state, world, pos, selectionContext); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
|
@ -330,6 +357,8 @@ public class StandardBlocks
|
||||||
@Nullable
|
@Nullable
|
||||||
public BlockState getStateForPlacement(BlockPlaceContext context)
|
public BlockState getStateForPlacement(BlockPlaceContext context)
|
||||||
{
|
{
|
||||||
|
BlockState state = super.getStateForPlacement(context);
|
||||||
|
if(state == null) return null;
|
||||||
Direction facing = context.getClickedFace();
|
Direction facing = context.getClickedFace();
|
||||||
if((config & (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) == (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) {
|
if((config & (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) == (CFG_HORIZIONTAL|CFG_LOOK_PLACEMENT)) {
|
||||||
// horizontal placement in direction the player is looking
|
// horizontal placement in direction the player is looking
|
||||||
|
@ -342,64 +371,141 @@ public class StandardBlocks
|
||||||
facing = context.getNearestLookingDirection();
|
facing = context.getNearestLookingDirection();
|
||||||
}
|
}
|
||||||
if((config & CFG_OPPOSITE_PLACEMENT)!=0) facing = facing.getOpposite();
|
if((config & CFG_OPPOSITE_PLACEMENT)!=0) facing = facing.getOpposite();
|
||||||
if(((config & CFG_FLIP_PLACEMENT_SHIFTCLICK) != 0) && (context.getPlayer().isShiftKeyDown())) facing = facing.getOpposite();
|
if(((config & CFG_FLIP_PLACEMENT_SHIFTCLICK) != 0) && (context.getPlayer()!=null) && (context.getPlayer().isShiftKeyDown())) facing = facing.getOpposite();
|
||||||
return super.getStateForPlacement(context).setValue(FACING, facing);
|
return state.setValue(FACING, facing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AxisAligned extends Cutout implements IStandardBlock
|
||||||
|
{
|
||||||
|
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
|
||||||
|
protected final ArrayList<VoxelShape> vshapes;
|
||||||
|
|
||||||
|
public AxisAligned(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||||
|
{
|
||||||
|
super(config, properties);
|
||||||
|
registerDefaultState(super.defaultBlockState().setValue(AXIS, Direction.Axis.X));
|
||||||
|
vshapes = shape_supplier.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AxisAligned(long config, BlockBehaviour.Properties properties, final AABB[] unrotatedAABBs)
|
||||||
|
{
|
||||||
|
this(config, properties, ()-> new ArrayList<>(Arrays.asList(
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.EAST, false)),
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.UP, false)),
|
||||||
|
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.SOUTH, false)),
|
||||||
|
Shapes.block()
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AxisAligned(long config, BlockBehaviour.Properties properties, final AABB unrotatedAABB)
|
||||||
|
{ this(config, properties, new AABB[]{unrotatedAABB}); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPossibleToRespawnInThis()
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidSpawn(BlockState state, BlockGetter world, BlockPos pos, SpawnPlacements.Type type, @Nullable EntityType<?> entityType)
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
||||||
|
{ return vshapes.get((state.getValue(AXIS)).ordinal() & 0x3); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
|
{ return getShape(state, world, pos, selectionContext); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
|
{ super.createBlockStateDefinition(builder); builder.add(AXIS); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public BlockState getStateForPlacement(BlockPlaceContext context)
|
||||||
|
{
|
||||||
|
Direction facing;
|
||||||
|
if((config & CFG_LOOK_PLACEMENT)!=0) {
|
||||||
|
facing = context.getNearestLookingDirection();
|
||||||
|
} else {
|
||||||
|
facing = context.getClickedFace();
|
||||||
|
}
|
||||||
|
return super.getStateForPlacement(context).setValue(AXIS, facing.getAxis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public BlockState rotate(BlockState state, Rotation rotation)
|
||||||
|
{
|
||||||
|
switch(rotation) {
|
||||||
|
case CLOCKWISE_90:
|
||||||
|
case COUNTERCLOCKWISE_90:
|
||||||
|
switch(state.getValue(AXIS)) {
|
||||||
|
case X: return state.setValue(AXIS, Direction.Axis.Z);
|
||||||
|
case Z: return state.setValue(AXIS, Direction.Axis.X);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Horizontal extends Cutout implements IStandardBlock
|
public static class Horizontal extends Cutout implements IStandardBlock
|
||||||
{
|
{
|
||||||
public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
|
public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||||
protected final ArrayList<VoxelShape> vshapes;
|
protected final Map<BlockState,VoxelShape> vshapes;
|
||||||
protected final ArrayList<VoxelShape> cshapes;
|
protected final Map<BlockState,VoxelShape> cshapes;
|
||||||
|
|
||||||
|
public Horizontal(long config, BlockBehaviour.Properties properties, final Function<List<BlockState>, Map<BlockState,VoxelShape>> shape_supplier)
|
||||||
|
{
|
||||||
|
super(config|CFG_HORIZIONTAL, properties);
|
||||||
|
registerDefaultState(stateDefinition.any().setValue(HORIZONTAL_FACING, Direction.NORTH));
|
||||||
|
vshapes = shape_supplier.apply(getStateDefinition().getPossibleStates());
|
||||||
|
cshapes = shape_supplier.apply(getStateDefinition().getPossibleStates());
|
||||||
|
}
|
||||||
|
|
||||||
public Horizontal(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
public Horizontal(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||||
{
|
{
|
||||||
super(config|CFG_HORIZIONTAL, properties);
|
this(config, properties, (states)->{
|
||||||
registerDefaultState(super.defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH));
|
final Map<BlockState,VoxelShape> vshapes = new HashMap<>();
|
||||||
vshapes = shape_supplier.get();
|
final ArrayList<VoxelShape> indexed_shapes = shape_supplier.get();
|
||||||
cshapes = new ArrayList<>(vshapes);
|
for(BlockState state:states) vshapes.put(state, indexed_shapes.get(state.getValue(HORIZONTAL_FACING).get3DDataValue()));
|
||||||
|
return vshapes;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Horizontal(long config, BlockBehaviour.Properties properties, final AABB[] unrotatedAABBs)
|
|
||||||
{ this(config, properties, ()->makeHorizontalShapeLookup(unrotatedAABBs)); }
|
|
||||||
|
|
||||||
public Horizontal(long config, BlockBehaviour.Properties properties, final AABB unrotatedAABB)
|
public Horizontal(long config, BlockBehaviour.Properties properties, final AABB unrotatedAABB)
|
||||||
{ this(config, properties, new AABB[]{unrotatedAABB}); }
|
{ this(config, properties, new AABB[]{unrotatedAABB}); }
|
||||||
|
|
||||||
protected static ArrayList<VoxelShape> makeHorizontalShapeLookup(final AABB[] unrotatedAABBs)
|
public Horizontal(long config, BlockBehaviour.Properties properties, final AABB[] unrotatedAABBs)
|
||||||
{
|
{
|
||||||
return new ArrayList<>(Arrays.asList(
|
this(config, properties, (states)->{
|
||||||
Shapes.block(),
|
Map<BlockState,VoxelShape> vshapes = new HashMap<>();
|
||||||
Shapes.block(),
|
for(BlockState state:states) {
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.NORTH, true)),
|
vshapes.put(state, Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, state.getValue(HORIZONTAL_FACING), true)));
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.SOUTH, true)),
|
}
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.WEST, true)),
|
return vshapes;
|
||||||
Auxiliaries.getUnionShape(Auxiliaries.getRotatedAABB(unrotatedAABBs, Direction.EAST, true)),
|
});
|
||||||
Shapes.block(),
|
|
||||||
Shapes.block()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void overrideCollisionShape(final AABB unrotatedAABB)
|
|
||||||
{ for(int i=0; i<cshapes.size(); ++i) cshapes.set(i, Shapes.create(unrotatedAABB)); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
|
||||||
{ return vshapes.get((state.getValue(HORIZONTAL_FACING)).get3DDataValue() & 0x7); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
|
||||||
{ return cshapes.get((state.getValue(HORIZONTAL_FACING)).get3DDataValue() & 0x7); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(HORIZONTAL_FACING); }
|
{ super.createBlockStateDefinition(builder); builder.add(HORIZONTAL_FACING); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getShape(BlockState state, BlockGetter source, BlockPos pos, CollisionContext selectionContext)
|
||||||
|
{ return vshapes.get(state); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext selectionContext)
|
||||||
|
{ return cshapes.get(state); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public BlockState getStateForPlacement(BlockPlaceContext context)
|
public BlockState getStateForPlacement(BlockPlaceContext context)
|
||||||
{
|
{
|
||||||
|
BlockState state = super.getStateForPlacement(context);
|
||||||
|
if(state == null) return null;
|
||||||
Direction facing = context.getClickedFace();
|
Direction facing = context.getClickedFace();
|
||||||
if((config & CFG_LOOK_PLACEMENT) != 0) {
|
if((config & CFG_LOOK_PLACEMENT) != 0) {
|
||||||
// horizontal placement in direction the player is looking
|
// horizontal placement in direction the player is looking
|
||||||
|
@ -409,8 +515,8 @@ public class StandardBlocks
|
||||||
facing = ((facing==Direction.UP)||(facing==Direction.DOWN)) ? (context.getHorizontalDirection()) : facing;
|
facing = ((facing==Direction.UP)||(facing==Direction.DOWN)) ? (context.getHorizontalDirection()) : facing;
|
||||||
}
|
}
|
||||||
if((config & CFG_OPPOSITE_PLACEMENT)!=0) facing = facing.getOpposite();
|
if((config & CFG_OPPOSITE_PLACEMENT)!=0) facing = facing.getOpposite();
|
||||||
if(((config & CFG_FLIP_PLACEMENT_SHIFTCLICK) != 0) && (context.getPlayer().isShiftKeyDown())) facing = facing.getOpposite();
|
if(((config & CFG_FLIP_PLACEMENT_SHIFTCLICK) != 0) && (context.getPlayer()!=null) && (context.getPlayer().isShiftKeyDown())) facing = facing.getOpposite();
|
||||||
return super.getStateForPlacement(context).setValue(HORIZONTAL_FACING, facing);
|
return state.setValue(HORIZONTAL_FACING, facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -432,6 +538,9 @@ public class StandardBlocks
|
||||||
public DirectedWaterLoggable(long config, BlockBehaviour.Properties properties, AABB[] aabbs)
|
public DirectedWaterLoggable(long config, BlockBehaviour.Properties properties, AABB[] aabbs)
|
||||||
{ super(config|CFG_WATERLOGGABLE, properties, aabbs); }
|
{ super(config|CFG_WATERLOGGABLE, properties, aabbs); }
|
||||||
|
|
||||||
|
public DirectedWaterLoggable(long config, BlockBehaviour.Properties properties, final Function<List<BlockState>, Map<BlockState,VoxelShape>> shape_supplier)
|
||||||
|
{ super(config|CFG_WATERLOGGABLE, properties, shape_supplier); }
|
||||||
|
|
||||||
public DirectedWaterLoggable(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
public DirectedWaterLoggable(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||||
{ super(config|CFG_WATERLOGGABLE, properties, shape_supplier); }
|
{ super(config|CFG_WATERLOGGABLE, properties, shape_supplier); }
|
||||||
|
|
||||||
|
@ -440,6 +549,22 @@ public class StandardBlocks
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(WATERLOGGED); }
|
{ super.createBlockStateDefinition(builder); builder.add(WATERLOGGED); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class AxisAlignedWaterLoggable extends AxisAligned implements IStandardBlock
|
||||||
|
{
|
||||||
|
public AxisAlignedWaterLoggable(long config, BlockBehaviour.Properties properties, AABB aabb)
|
||||||
|
{ super(config|CFG_WATERLOGGABLE, properties, aabb); }
|
||||||
|
|
||||||
|
public AxisAlignedWaterLoggable(long config, BlockBehaviour.Properties properties, AABB[] aabbs)
|
||||||
|
{ super(config|CFG_WATERLOGGABLE, properties, aabbs); }
|
||||||
|
|
||||||
|
public AxisAlignedWaterLoggable(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||||
|
{ super(config|CFG_WATERLOGGABLE, properties, shape_supplier); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
|
{ super.createBlockStateDefinition(builder); builder.add(WATERLOGGED); }
|
||||||
|
}
|
||||||
|
|
||||||
public static class HorizontalWaterLoggable extends Horizontal implements IStandardBlock
|
public static class HorizontalWaterLoggable extends Horizontal implements IStandardBlock
|
||||||
{
|
{
|
||||||
public HorizontalWaterLoggable(long config, BlockBehaviour.Properties properties, AABB aabb)
|
public HorizontalWaterLoggable(long config, BlockBehaviour.Properties properties, AABB aabb)
|
||||||
|
@ -451,6 +576,9 @@ public class StandardBlocks
|
||||||
public HorizontalWaterLoggable(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
public HorizontalWaterLoggable(long config, BlockBehaviour.Properties properties, final Supplier<ArrayList<VoxelShape>> shape_supplier)
|
||||||
{ super(config|CFG_WATERLOGGABLE|CFG_HORIZIONTAL, properties, shape_supplier); }
|
{ super(config|CFG_WATERLOGGABLE|CFG_HORIZIONTAL, properties, shape_supplier); }
|
||||||
|
|
||||||
|
public HorizontalWaterLoggable(long config, BlockBehaviour.Properties properties, final Function<List<BlockState>, Map<BlockState,VoxelShape>> shape_supplier)
|
||||||
|
{ super(config|CFG_WATERLOGGABLE|CFG_HORIZIONTAL, properties, shape_supplier); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder)
|
||||||
{ super.createBlockStateDefinition(builder); builder.add(WATERLOGGED); }
|
{ super.createBlockStateDefinition(builder); builder.add(WATERLOGGED); }
|
||||||
|
@ -465,7 +593,7 @@ public class StandardBlocks
|
||||||
protected final Map<BlockState, VoxelShape> shapes;
|
protected final Map<BlockState, VoxelShape> shapes;
|
||||||
protected final Map<BlockState, VoxelShape> collision_shapes;
|
protected final Map<BlockState, VoxelShape> collision_shapes;
|
||||||
|
|
||||||
public HorizontalFourWayWaterLoggable(long config, BlockBehaviour.Properties properties, AABB base_aabb, final AABB side_aabb[], int railing_height_extension)
|
public HorizontalFourWayWaterLoggable(long config, BlockBehaviour.Properties properties, AABB base_aabb, final AABB[] side_aabb, int railing_height_extension)
|
||||||
{
|
{
|
||||||
super(config, properties, base_aabb);
|
super(config, properties, base_aabb);
|
||||||
Map<BlockState, VoxelShape> build_shapes = new HashMap<>();
|
Map<BlockState, VoxelShape> build_shapes = new HashMap<>();
|
||||||
|
|
|
@ -31,20 +31,8 @@ public class StandardEntityBlocks
|
||||||
@Nullable
|
@Nullable
|
||||||
BlockEntityType<ET> getBlockEntityType();
|
BlockEntityType<ET> getBlockEntityType();
|
||||||
|
|
||||||
@Override
|
default boolean isBlockEntityTicking(Level world, BlockState state)
|
||||||
@Nullable
|
{ return false; }
|
||||||
default BlockEntity newBlockEntity(BlockPos pos, BlockState state)
|
|
||||||
{ return (getBlockEntityType()==null) ? null : getBlockEntityType().create(pos, state); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
default <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, BlockState state, BlockEntityType<T> te_type)
|
|
||||||
{ return (world.isClientSide) ? (null) : ((Level w, BlockPos p, BlockState s, T te) -> ((StandardBlockEntity)te).tick()); } // To be evaluated if
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
default <T extends BlockEntity> GameEventListener getListener(Level world, T te)
|
|
||||||
{ return null; }
|
|
||||||
|
|
||||||
default InteractionResult useOpenGui(BlockState state, Level world, BlockPos pos, Player player)
|
default InteractionResult useOpenGui(BlockState state, Level world, BlockPos pos, Player player)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +42,21 @@ public class StandardEntityBlocks
|
||||||
player.openMenu((MenuProvider)te);
|
player.openMenu((MenuProvider)te);
|
||||||
return InteractionResult.CONSUME;
|
return InteractionResult.CONSUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
default BlockEntity newBlockEntity(BlockPos pos, BlockState state)
|
||||||
|
{ return (getBlockEntityType()==null) ? null : getBlockEntityType().create(pos, state); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
default <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, BlockState state, BlockEntityType<T> te_type)
|
||||||
|
{ return (world.isClientSide || (!isBlockEntityTicking(world, state))) ? (null) : ((Level w, BlockPos p, BlockState s, T te) -> ((StandardBlockEntity)te).tick()); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
default <T extends BlockEntity> GameEventListener getListener(Level world, T te)
|
||||||
|
{ return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class StandardBlockEntity extends BlockEntity
|
public static abstract class StandardBlockEntity extends BlockEntity
|
||||||
|
|
|
@ -121,12 +121,17 @@ public class Auxiliaries
|
||||||
// -------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text localisation wrapper, implicitly prepends `MODID` to the
|
* Text localization wrapper, implicitly prepends `MODID` to the
|
||||||
* translation keys. Forces formatting argument, nullable if no special formatting shall be applied..
|
* translation keys. Forces formatting argument, nullable if no special formatting shall be applied..
|
||||||
*/
|
*/
|
||||||
public static TranslatableComponent localizable(String modtrkey, Object... args)
|
public static TranslatableComponent localizable(String modtrkey, Object... args)
|
||||||
|
{ return new TranslatableComponent((modtrkey.startsWith("block.") || (modtrkey.startsWith("item."))) ? (modtrkey) : (modid+"."+modtrkey), args); }
|
||||||
|
|
||||||
|
public static TranslatableComponent localizable(String modtrkey, @Nullable ChatFormatting color, Object... args)
|
||||||
{
|
{
|
||||||
return new TranslatableComponent((modtrkey.startsWith("block.") || (modtrkey.startsWith("item."))) ? (modtrkey) : (modid+"."+modtrkey), args);
|
TranslatableComponent tr = new TranslatableComponent(modid+"."+modtrkey, args);
|
||||||
|
if(color!=null) tr.withStyle(color);
|
||||||
|
return tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TranslatableComponent localizable(String modtrkey)
|
public static TranslatableComponent localizable(String modtrkey)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue