CrushCrushCrush

- Added some rudimentary crushing ambience
- Dyed nixie tubes now return the correct item for Pickblock and Schematicannons
This commit is contained in:
simibubi 2021-07-08 16:22:59 +02:00
parent 801f5fa130
commit 5a031bb99d
23 changed files with 223 additions and 84 deletions

View file

@ -426,20 +426,20 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
e1d3c02695cbd2ee7bbede97f72941835634a3a5 assets/create/lang/en_ud.json
ae6c1882c3049b20409f233d7984fdb6498e1cec assets/create/lang/en_us.json
4d1f84c2fe9d6ed58d9ce555f09b408c3a2d5349 assets/create/lang/unfinished/de_de.json
3fa0debc2eff551c3cbbdf917766e835f803d467 assets/create/lang/unfinished/es_es.json
6f0034ff2b0a4dc2ef1c390aa76a88e325e17159 assets/create/lang/unfinished/es_mx.json
a8bf7fa74b00f2ce89d3687e5cee17607f18fa5f assets/create/lang/unfinished/fr_fr.json
7633b95d4e27ca0edd77f2d88fcc90e279e09edf assets/create/lang/unfinished/it_it.json
423b5f8f07b0ca5825c038859f9b506a28982659 assets/create/lang/unfinished/ja_jp.json
20f19b6699ab131e64b73283f1a5dfd4e3d47bb8 assets/create/lang/unfinished/ko_kr.json
34435d8e73e3b06095b6dbb77f133e9695c9e39c assets/create/lang/unfinished/nl_nl.json
f8aafddf029b41c3ad46ed81ff2ccd5289ef2a65 assets/create/lang/unfinished/pl_pl.json
7f2cf06e9e33f14ca61fd4632df7adfa02b33311 assets/create/lang/unfinished/pt_br.json
9f44fe3b87225017fd7975ee8fd5e4ff309e6296 assets/create/lang/unfinished/ru_ru.json
a99c3e9642cc1748a30e011e0651f89e206175a0 assets/create/lang/unfinished/zh_cn.json
79d2ba1dee4c4d677dd9e99878a522bfb575c3f4 assets/create/lang/unfinished/zh_tw.json
e45592394573a5e5bae6520976ef0760e27833b1 assets/create/lang/en_us.json
3e80da8da3fd705c5a9abcef3bb88c848d694452 assets/create/lang/unfinished/de_de.json
2957ff5031fce02979fe0029756705c80909160f assets/create/lang/unfinished/es_es.json
58c0101a854c4a717058b593572707a035b2bd17 assets/create/lang/unfinished/es_mx.json
2dca9cad484ec7991d4303f7b79b613da85aa213 assets/create/lang/unfinished/fr_fr.json
93c30ea554df1b96d493f3c15660665342ea54e2 assets/create/lang/unfinished/it_it.json
2d19c1bd0b16c7f4d3cab91566b10f8b20fd92b8 assets/create/lang/unfinished/ja_jp.json
00a5e891f481ddbbd2e043f05d4c60c8519d30b4 assets/create/lang/unfinished/ko_kr.json
3264c35ea11ad73c63b42d3c3e86b3e4a683e8a7 assets/create/lang/unfinished/nl_nl.json
284b09bca2e8dafbf6c39d562a6bec7d6d9e277e assets/create/lang/unfinished/pl_pl.json
ebabdc30b05702af5cc4b28e95fa5792035db73a assets/create/lang/unfinished/pt_br.json
ab37de7ff2c14415e29782bba6382233e585fa6f assets/create/lang/unfinished/ru_ru.json
f70cb0834d60693a62bef99c2b81b40fae37417a assets/create/lang/unfinished/zh_cn.json
f78d0693929030d6ede68d4233407f6c832ea93e assets/create/lang/unfinished/zh_tw.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
@ -1698,8 +1698,8 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
866fbb0ce2878a73e0440d1caf6534c8bd7c384f assets/create/models/item/zinc_ingot.json
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
bbe7fc4aef29420319f59d02d4cd376a78244e70 assets/create/sounds.json
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
58880e397902f8ca5b3b59ed4423e626109ddc4c assets/create/sounds.json
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json

View file

@ -1221,6 +1221,7 @@
"create.subtitle.mechanical_press_activation_belt": "Mechanical Press bonks",
"create.subtitle.fwoomp": "Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "Worldshaper zaps",
"create.subtitle.crushing_1": "Crushing noises",
"create.subtitle.depot_slide": "Item slides",
"create.subtitle.saw_activate_stone": "Mechanical Saw activates",
"create.subtitle.blaze_munch": "Blaze Burner munches",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1124",
"_": "Missing Localizations: 1125",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "Lohe kaut glücklich",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 47",
"_": "Missing Localizations: 48",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "",
"create.subtitle.fwoomp": "",
"create.subtitle.worldshaper_place": "",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "",
"create.subtitle.saw_activate_stone": "",
"create.subtitle.blaze_munch": "",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1491",
"_": "Missing Localizations: 1492",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1376",
"_": "Missing Localizations: 1377",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 904",
"_": "Missing Localizations: 905",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "Il blaze lo gusta felicemente",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 36",
"_": "Missing Localizations: 37",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "メカニカルプレスがボンと鳴る",
"create.subtitle.fwoomp": "ポテトランチャーがバキューンと鳴る",
"create.subtitle.worldshaper_place": "ワールドシェーパーが設置する",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "アイテムが滑る",
"create.subtitle.saw_activate_stone": "メカニカルソーが動作する",
"create.subtitle.blaze_munch": "ブレイズの咀嚼音",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 282",
"_": "Missing Localizations: 283",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "기계식 압착기가 무언가를 압착함",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "블레이즈 가열기가 무언가를 먹어 치움",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1757",
"_": "Missing Localizations: 1758",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 246",
"_": "Missing Localizations: 247",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "Mechaniczna prasa stuka",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "Kształter strzela",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "Przedmiot ślizga się",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "Płomyk szczęśliwie przeżuwa",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 1798",
"_": "Missing Localizations: 1799",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "UNLOCALIZED: Blaze Burner munches",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 277",
"_": "Missing Localizations: 278",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "Всполох радостно жуёт",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 287",
"_": "Missing Localizations: 288",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "UNLOCALIZED: Mechanical Press bonks",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "烈焰人:咀嚼",

View file

@ -1,5 +1,5 @@
{
"_": "Missing Localizations: 282",
"_": "Missing Localizations: 283",
"_": "->------------------------] Game Elements [------------------------<-",
@ -1222,6 +1222,7 @@
"create.subtitle.mechanical_press_activation_belt": "液壓機工作",
"create.subtitle.fwoomp": "UNLOCALIZED: Potato Launcher fwoomps",
"create.subtitle.worldshaper_place": "UNLOCALIZED: Worldshaper zaps",
"create.subtitle.crushing_1": "UNLOCALIZED: Crushing noises",
"create.subtitle.depot_slide": "UNLOCALIZED: Item slides",
"create.subtitle.saw_activate_stone": "UNLOCALIZED: Mechanical Saw activates",
"create.subtitle.blaze_munch": "烈焰使者開心地吃著",

View file

@ -128,6 +128,31 @@
}
]
},
"crushing_1": {
"sounds": [
{
"name": "minecraft:block.netherrack.hit",
"type": "event"
}
],
"subtitle": "create.subtitle.crushing_1"
},
"crushing_2": {
"sounds": [
{
"name": "minecraft:block.gravel.place",
"type": "event"
}
]
},
"crushing_3": {
"sounds": [
{
"name": "minecraft:block.netherite_block.break",
"type": "event"
}
]
},
"deny": {
"sounds": [
{

View file

@ -28,8 +28,8 @@
"trigger": "create:bracket_apply",
"conditions": {
"accepted_entries": [
"create:cogwheel",
"create:large_cogwheel"
"create:large_cogwheel",
"create:cogwheel"
]
}
},

View file

@ -199,6 +199,21 @@ public class AllSoundEvents {
.category(SoundCategory.BLOCKS)
.build(),
CRUSHING_1 = create("crushing_1").subtitle("Crushing noises")
.playExisting(SoundEvents.BLOCK_NETHERRACK_HIT)
.category(SoundCategory.BLOCKS)
.build(),
CRUSHING_2 = create("crushing_2").noSubtitle()
.playExisting(SoundEvents.BLOCK_GRAVEL_PLACE)
.category(SoundCategory.BLOCKS)
.build(),
CRUSHING_3 = create("crushing_3").noSubtitle()
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_BREAK)
.category(SoundCategory.BLOCKS)
.build(),
PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls")
.playExisting(SoundEvents.BLOCK_BELL_USE)
.category(SoundCategory.BLOCKS)
@ -230,7 +245,8 @@ public class AllSoundEvents {
public static JsonElement provideLangEntries() {
JsonObject object = new JsonObject();
for (SoundEntry entry : entries.values())
object.addProperty(entry.getSubtitleKey(), entry.getSubtitle());
if (entry.hasSubtitle())
object.addProperty(entry.getSubtitleKey(), entry.getSubtitle());
return object;
}
@ -306,6 +322,11 @@ public class AllSoundEvents {
this.subtitle = subtitle;
return this;
}
public SoundEntryBuilder noSubtitle() {
this.subtitle = null;
return this;
}
public SoundEntryBuilder category(SoundCategory category) {
this.category = category;
@ -361,6 +382,10 @@ public class AllSoundEvents {
public ResourceLocation getLocation() {
return Create.asResource(id);
}
public boolean hasSubtitle() {
return subtitle != null;
}
public String getSubtitle() {
return subtitle;
@ -460,7 +485,7 @@ public class AllSoundEvents {
s.addProperty("type", "event");
list.add(s);
entry.add("sounds", list);
if (i == 0)
if (i == 0 && hasSubtitle())
entry.addProperty("subtitle", getSubtitleKey());
json.add(getIdOf(i), entry);
}

View file

@ -9,6 +9,8 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class HandCrankTileEntity extends GeneratingKineticTileEntity {
@ -82,6 +84,7 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
}
@Override
@OnlyIn(Dist.CLIENT)
public void tickAudio() {
super.tickAudio();
if (inUse > 0 && AnimationTickHolder.getTicks() % 10 == 0) {

View file

@ -13,6 +13,8 @@ import com.simibubi.create.content.contraptions.processing.ProcessingInventory;
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.sound.SoundScapes;
import com.simibubi.create.foundation.sound.SoundScapes.AmbienceGroup;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
@ -38,8 +40,11 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.RecipeWrapper;
@ -87,37 +92,41 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
if (searchForEntity) {
searchForEntity = false;
List<Entity> search = world.getEntitiesInAABBexcluding(null, new AxisAlignedBB(getPos()),
e -> entityUUID.equals(e.getUniqueID()));
e -> entityUUID.equals(e.getUniqueID()));
if (search.isEmpty())
clear();
else
processingEntity = search.get(0);
}
if (!isOccupied())
return;
if (crushingspeed == 0)
return;
if (world.isRemote)
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio());
float speed = crushingspeed * 4;
Vector3d centerPos = VecHelper.getCenterOf(pos);
Direction facing = getBlockState().get(FACING);
int offset = facing.getAxisDirection().getOffset();
Vector3d outSpeed = new Vector3d((facing.getAxis() == Axis.X ? 0.25D : 0.0D) * offset
, offset == 1 ? (facing.getAxis() == Axis.Y ? 0.5D : 0.0D) : 0.0D //Increased upwards speed so upwards crushing wheels shoot out the item properly.
, (facing.getAxis() == Axis.Z ? 0.25D : 0.0D) * offset); //No downwards speed, so downwards crushing wheels drop the items as before.
Vector3d outPos = centerPos.add((facing.getAxis() == Axis.X ? .55f * offset : 0f)
, (facing.getAxis() == Axis.Y ? .55f * offset : 0f)
, (facing.getAxis() == Axis.Z ? .55f * offset : 0f));
int offset = facing.getAxisDirection()
.getOffset();
Vector3d outSpeed = new Vector3d((facing.getAxis() == Axis.X ? 0.25D : 0.0D) * offset,
offset == 1 ? (facing.getAxis() == Axis.Y ? 0.5D : 0.0D) : 0.0D // Increased upwards speed so upwards
// crushing wheels shoot out the item
// properly.
, (facing.getAxis() == Axis.Z ? 0.25D : 0.0D) * offset); // No downwards speed, so downwards crushing wheels
// drop the items as before.
Vector3d outPos = centerPos.add((facing.getAxis() == Axis.X ? .55f * offset : 0f),
(facing.getAxis() == Axis.Y ? .55f * offset : 0f), (facing.getAxis() == Axis.Z ? .55f * offset : 0f));
if (!hasEntity()) {
float processingSpeed =
MathHelper.clamp((speed) / (!inventory.appliedRecipe ? MathHelper.log2(inventory.getStackInSlot(0)
.getCount()) : 1), .25f, 20);
MathHelper.clamp((speed) / (!inventory.appliedRecipe ? MathHelper.log2(inventory.getStackInSlot(0)
.getCount()) : 1), .25f, 20);
inventory.remainingTime -= processingSpeed;
spawnParticles(inventory.getStackInSlot(0));
@ -136,12 +145,13 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
}
inventory.remainingTime = 0;
//Output Items
if (facing.getAxis().isHorizontal() || facing == Direction.DOWN) {
BlockPos nextPos = pos.add(facing.getAxis() == Axis.X ? 1f * offset : 0f
, (-1f)
, facing.getAxis() == Axis.Z ? 1f * offset : 0f);
DirectBeltInputBehaviour behaviour = TileEntityBehaviour.get(world, nextPos, DirectBeltInputBehaviour.TYPE);
// Output Items
if (facing.getAxis()
.isHorizontal() || facing == Direction.DOWN) {
BlockPos nextPos = pos.add(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f),
facing.getAxis() == Axis.Z ? 1f * offset : 0f);
DirectBeltInputBehaviour behaviour =
TileEntityBehaviour.get(world, nextPos, DirectBeltInputBehaviour.TYPE);
if (behaviour != null) {
boolean changed = false;
if (!behaviour.canInsertFromSide(facing))
@ -164,7 +174,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
}
}
//Eject Items
// Eject Items
for (int slot = 0; slot < inventory.getSlots(); slot++) {
ItemStack stack = inventory.getStackInSlot(slot);
if (stack.isEmpty())
@ -172,18 +182,17 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
ItemEntity entityIn = new ItemEntity(world, outPos.x, outPos.y, outPos.z, stack);
entityIn.setMotion(outSpeed);
entityIn.getPersistentData()
.put("BypassCrushingWheel", NBTUtil.writeBlockPos(pos));
.put("BypassCrushingWheel", NBTUtil.writeBlockPos(pos));
world.addEntity(entityIn);
}
inventory.clear();
world.notifyBlockUpdate(pos, getBlockState(), getBlockState(), 2 | 16);
return;
}
if (!processingEntity.isAlive() || !processingEntity.getBoundingBox()
.intersects(new AxisAlignedBB(pos).grow(.5f))) {
.intersects(new AxisAlignedBB(pos).grow(.5f))) {
clear();
return;
}
@ -193,33 +202,40 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
if (processingEntity.isSneaking())
xMotion = zMotion = 0;
double movement = Math.max(-speed / 4f, -.5f) * -offset;
processingEntity.setMotion(new Vector3d(facing.getAxis() == Axis.X ? movement : xMotion
, facing.getAxis() == Axis.Y ? movement : 0f //Do not move entities upwards or downwards for horizontal crushers,
, facing.getAxis() == Axis.Z ? movement : zMotion)); //Or they'll only get their feet crushed.
processingEntity.setMotion(
new Vector3d(facing.getAxis() == Axis.X ? movement : xMotion, facing.getAxis() == Axis.Y ? movement : 0f // Do
// not
// move
// entities
// upwards
// or
// downwards
// for
// horizontal
// crushers,
, facing.getAxis() == Axis.Z ? movement : zMotion)); // Or they'll only get their feet crushed.
if (world.isRemote)
return;
if (!(processingEntity instanceof ItemEntity)) {
Vector3d entityOutPos = outPos.add(facing.getAxis() == Axis.X ? .5f * offset : 0f
, facing.getAxis() == Axis.Y ? .5f * offset : 0f
, facing.getAxis() == Axis.Z ? .5f * offset : 0f);
Vector3d entityOutPos = outPos.add(facing.getAxis() == Axis.X ? .5f * offset : 0f,
facing.getAxis() == Axis.Y ? .5f * offset : 0f, facing.getAxis() == Axis.Z ? .5f * offset : 0f);
int crusherDamage = AllConfigs.SERVER.kinetics.crushingDamage.get();
if (processingEntity instanceof LivingEntity) {
if ((((LivingEntity) processingEntity).getHealth() - crusherDamage <= 0) //Takes LivingEntity instances as exception, so it can move them before it would kill them.
&& (((LivingEntity) processingEntity).hurtTime <= 0)) { //This way it can actually output the items to the right spot.
processingEntity.setPosition(entityOutPos.x
, entityOutPos.y
, entityOutPos.z);
if ((((LivingEntity) processingEntity).getHealth() - crusherDamage <= 0) // Takes LivingEntity instances
// as exception, so it can
// move them before it would
// kill them.
&& (((LivingEntity) processingEntity).hurtTime <= 0)) { // This way it can actually output the items
// to the right spot.
processingEntity.setPosition(entityOutPos.x, entityOutPos.y, entityOutPos.z);
}
}
processingEntity.attackEntityFrom(CrushingWheelTileEntity.damageSource,
crusherDamage);
processingEntity.attackEntityFrom(CrushingWheelTileEntity.damageSource, crusherDamage);
if (!processingEntity.isAlive()) {
processingEntity.setPosition(entityOutPos.x
, entityOutPos.y
, entityOutPos.z);
processingEntity.setPosition(entityOutPos.x, entityOutPos.y, entityOutPos.z);
}
return;
}
@ -227,24 +243,33 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
ItemEntity itemEntity = (ItemEntity) processingEntity;
itemEntity.setPickupDelay(20);
if (facing.getAxis() == Axis.Y) {
if (processingEntity.getY() * -offset < (centerPos.y - .25f) * -offset) {
if (processingEntity.getY() * -offset < (centerPos.y - .25f) * -offset) {
intakeItem(itemEntity);
}
} else if (facing.getAxis() == Axis.Z) {
if (processingEntity.getZ() * -offset < (centerPos.z - .25f) * -offset) {
if (processingEntity.getZ() * -offset < (centerPos.z - .25f) * -offset) {
intakeItem(itemEntity);
}
} else {
if (processingEntity.getX() * -offset < (centerPos.x - .25f) * -offset) {
if (processingEntity.getX() * -offset < (centerPos.x - .25f) * -offset) {
intakeItem(itemEntity);
}
}
}
@OnlyIn(Dist.CLIENT)
public void tickAudio() {
float pitch = MathHelper.clamp((crushingspeed / 256f) + .45f, .85f, 1f);
if (entityUUID == null && inventory.getStackInSlot(0)
.isEmpty())
return;
SoundScapes.play(AmbienceGroup.CRUSHING, pos, pitch);
}
private void intakeItem(ItemEntity itemEntity) {
inventory.clear();
inventory.setStackInSlot(0, itemEntity.getItem()
.copy());
.copy());
itemInserted(inventory.getStackInSlot(0));
itemEntity.remove();
world.notifyBlockUpdate(pos, getBlockState(), getBlockState(), 2 | 16);
@ -257,14 +282,14 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
IParticleData particleData = null;
if (stack.getItem() instanceof BlockItem)
particleData = new BlockParticleData(ParticleTypes.BLOCK, ((BlockItem) stack.getItem()).getBlock()
.getDefaultState());
.getDefaultState());
else
particleData = new ItemParticleData(ParticleTypes.ITEM, stack);
Random r = world.rand;
for (int i = 0; i < 4; i++)
world.addParticle(particleData, pos.getX() + r.nextFloat(), pos.getY() + r.nextFloat(),
pos.getZ() + r.nextFloat(), 0, 0, 0);
pos.getZ() + r.nextFloat(), 0, 0, 0);
}
private void applyRecipe() {
@ -273,11 +298,11 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
List<ItemStack> list = new ArrayList<>();
if (recipe.isPresent()) {
int rolls = inventory.getStackInSlot(0)
.getCount();
.getCount();
inventory.clear();
for (int roll = 0; roll < rolls; roll++) {
List<ItemStack> rolledResults = recipe.get()
.rollResults();
.rollResults();
for (int i = 0; i < rolledResults.size(); i++) {
ItemStack stack = rolledResults.get(i);
ItemHelper.addToList(stack, list);
@ -326,7 +351,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
private void itemInserted(ItemStack stack) {
Optional<ProcessingRecipe<RecipeWrapper>> recipe = findRecipe();
inventory.remainingTime = recipe.isPresent() ? recipe.get()
.getProcessingDuration() : 100;
.getProcessingDuration() : 100;
inventory.appliedRecipe = false;
}

View file

@ -5,6 +5,8 @@ import java.util.Optional;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.foundation.sound.SoundScapes;
import com.simibubi.create.foundation.sound.SoundScapes.AmbienceGroup;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
import com.simibubi.create.foundation.utility.VecHelper;
@ -19,6 +21,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandler;
@ -41,13 +45,28 @@ public class MillstoneTileEntity extends KineticTileEntity {
outputInv = new ItemStackHandler(9);
capability = LazyOptional.of(MillstoneInventoryHandler::new);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
behaviours.add(new DirectBeltInputBehaviour(this));
super.addBehaviours(behaviours);
}
@Override
@OnlyIn(Dist.CLIENT)
public void tickAudio() {
super.tickAudio();
if (getSpeed() == 0)
return;
if (inputInv.getStackInSlot(0)
.isEmpty())
return;
float pitch = MathHelper.clamp((Math.abs(getSpeed()) / 256f) + .45f, .85f, 1f);
SoundScapes.play(AmbienceGroup.MILLING, pos, pitch);
}
@Override
public void tick() {
super.tick();
@ -98,7 +117,7 @@ public class MillstoneTileEntity extends KineticTileEntity {
super.remove();
capability.invalidate();
}
private void process() {
RecipeWrapper inventoryIn = new RecipeWrapper(inputInv);

View file

@ -6,6 +6,9 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement;
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.DyeHelper;
import com.simibubi.create.foundation.utility.Iterate;
@ -35,7 +38,8 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class NixieTubeBlock extends HorizontalBlock implements ITE<NixieTubeTileEntity>, IWrenchable {
public class NixieTubeBlock extends HorizontalBlock
implements ITE<NixieTubeTileEntity>, IWrenchable, ISpecialBlockItemRequirement {
public static final BooleanProperty CEILING = BooleanProperty.create("ceiling");
private DyeColor color;
@ -122,6 +126,17 @@ public class NixieTubeBlock extends HorizontalBlock implements ITE<NixieTubeTile
p_196243_2_.removeTileEntity(p_196243_3_);
}
@Override
public ItemStack getItem(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
return AllBlocks.ORANGE_NIXIE_TUBE.asStack();
}
@Override
public ItemRequirement getRequiredItems(BlockState state, TileEntity te) {
return new ItemRequirement(ItemUseType.CONSUME, AllBlocks.ORANGE_NIXIE_TUBE.get()
.asItem());
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_,
ISelectionContext p_220053_4_) {

View file

@ -30,7 +30,9 @@ public class SoundScapes {
KINETIC(SoundScapes::kinetic),
COG(SoundScapes::cogwheel),
CRUSHING(SoundScapes::crushing),
MILLING(SoundScapes::milling),
;
private BiFunction<Float, AmbienceGroup, SoundScape> factory;
@ -53,6 +55,17 @@ public class SoundScapes {
return new SoundScape(pitch, group).continuous(AllSoundEvents.COGS.getMainEvent(), 1.5f, 1);
}
private static SoundScape crushing(float pitch, AmbienceGroup group) {
return new SoundScape(pitch, group).repeating(AllSoundEvents.CRUSHING_1.getMainEvent(), 1.545f, .75f, 1)
.repeating(AllSoundEvents.CRUSHING_2.getMainEvent(), 0.425f, .75f, 2)
.repeating(AllSoundEvents.CRUSHING_3.getMainEvent(), 2f, 1.75f, 2);
}
private static SoundScape milling(float pitch, AmbienceGroup group) {
return new SoundScape(pitch, group).repeating(AllSoundEvents.CRUSHING_1.getMainEvent(), 1.545f, .75f, 1)
.repeating(AllSoundEvents.CRUSHING_2.getMainEvent(), 0.425f, .75f, 2);
}
enum PitchGroup {
VERY_LOW, LOW, NORMAL, HIGH, VERY_HIGH
}